2011 Logica Placement Paper

1. main()
{
int x=5;
{
printf(“x=%d ”, x--); }
}

a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5

2. main()
{
unsigned int bit=256;
printf(“%d”, bit); }
{
unsigned int bit=512;
printf(“%d”, bit); }
}

a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error

3. What is the output in the following program

main()
{char c=-64;
int i=-32
unsigned int u =-16;
if(c>i)
{printf("pass1,");
if(c
printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1);
if(i
printf("pass2");
else
printf("Fail2")
}

a) Pass1,Pass2
b) Pass1,Fail2
c) Fail1,Pass2
d) Fail1,Fail2
e) None of these

Ans. (c)


4. main()
{
int i;
for(i=0;i<5;i++)
{
printf("%d\n", 1L << i);
}
}
a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16

5. main()
{
signed int bit=512, i=5;

for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4

6. main(int argc,int *argv[])
{
int i;
for(i=1;i<argc;i++)
printf("\n%s%s",argv[i],(i<argc-1)?"":"");
return 0;
getch();
}
Ans: I work for oracle

7. void main()
{
int i,j,k;
for(i=0;i<3;i++)
k=sum(i,i);
printf("\n%d",k);
getch();
}
sum(s,t)
{
static int m;
m+=s+t;
return m;
}
Ans: 6

8..void main()
{
int i;
clrscr();
for(i=1;i<6;++i)
switch(i)
{
case 1:
case 2: printf("%d,",i++);break;
case 3: continue;
case 4: printf("%d,",i);
}
printf("%d",i);
getch();
}
Ans: 1,4,6

9. Which of the storage class(es) becomes the global variables for the entire Program

(A) Extern
(B) Static
(C) Auto
(D) Register
Ans: A

10. What is the output of the program
void main()
{
char s[]="oracle is the best";
char t[40];
char *ss,*tt;
while(*tt++=*ss++);
printf("%s",t);
getch();
}
// A. oracle is the best
// B. Core dump
// c. Error Message
// D. Goes into infinite loop
Ans: B. core dump (Garbage value)


11. value of automatic variable that is declared but not initialized will be
(a) 0,
(b) -1,
(c) unpredictable,
(d) none,

12. Each side of a rectangle is increased by 100% .By what percentage does the area increase?

Ans : 300%

13. Perimeter of the back wheel = 9 feet, front wheel = 7 feet on a certain distance, the front wheel gets 10 revolutions more than the back wheel .What is the distance?



Ans : 315 feet.

14. A man starts walking at 3 pm . ha walks at a speed of 4 km/hr on level ground and at a speed of 3 km/hr on uphill , 6 km/hr downhill and then 4 km/hr on level ground to reach home at 9 pm. What is the distance covered on one way?

Ans: 12 km

15. A grandma has many sons; each son has as many sons as his brothers. What is her age if it?s the product of the no: of her sons and grandsons plus no: of her sons?(age b/w 70 and 100).

Ans: 81

16. An electric wire runs for 1 km b/w some no: of poles. If one pole is removed the distance b/w each pole increases by 1 2/6 (mixed fraction). How many poles were there initially?

17. There is a church tower 150 feet tall and another catholic tower at a distance of 350 feet from it which is 200 feet tall. There is one each bird sitting on top of both the towers. They fly at a constant speed and time to reach a grain in b/w the towers at the same time. At what distance from the church is the grain?

Ans: 90

18. A person wants to meet a lawyer and as that lawyer is busy he asks him to come three days after the before day of the day after tomorrow? on which day the lawyer asks the person to come?

Ans: thursday

19. A person is 80 years old in 490 and only 70 years old in 500 in which year is he born?

Ans: 470

20. Perimeter of front wheel =30, back wheel = 20. If front wheel revolves 240 times. How many revolutions will the back wheel take?

Ans: 360 times