2011 Logica Placement Paper - I:-1. Main
2011 Logica Placement Paper - I:-1. Main
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
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
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: 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: A. 6,2,1,5
2..
main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit >> (i - (i -1)));
}
}
a. 512, 256, 0, 0, 0
b. 256, 256, 0, 0, 0
c. 512, 512, 512, 512, 512
d. 256, 256, 256, 256, 256
3. main()
{
if (!(1&&0))
{
printf("OK I am done.");
}
else
{
printf(“OK I am gone.”); }
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above
4. main()
{
if ((1||0) && (0||1))
{
printf("OK I am done.");
}
else
{
printf(“OK I am gone.”); }
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above
5. main()
{
signed int bit=512, mBit;
{
mBit = ~bit;
bit = bit & ~bit ;
a. 0, 0
b. 0, 513
c. 512, 0
d. 0, -513
6. printf("%f", 9/5);
prints
(a) 1.8,
(b) 1.0,
(c) 2.0,
(d) none
.
7. if (a=7)
printf(" a is 7 ");
else
printf("a is not 7");
prints
(a) a is 7,
(b) a is not 7,
(c) nothing,
(d) garbage.
8. if (a>b)
if(b>c)
s1;
else s2;
s2 will be executed if
(a) a<= b,
(b) b>c,
(c) b<=c and a<=b,
(d) a>b and b<=c.
9. printf("%d", sizeof(""));
prints
(a) error
(b)0
(c) garbage
(d) 1.
10. 20% of a 6 litre solution and 60% of 4 litre solution are mixed. What percentage of the mixture of
solution
Ans: 36%
11. A family I know has several children. Each boy in this family has as many sisters as brothers but each
girl has twice as many brothers as sisters. How many brothers and sisters are there?
12. In a soap company a soap is manufactured with 11 parts. For making one soap you will get 1 part as
scrap. At the end of the day u have 251 such scraps. From that how many soaps can be manufactured?
Ans: 25.
13. There is a 5digit no. 3 pairs of sum is eleven each. Last digit is 3 times the first one. 3 rd digit is 3 less
than the second.4 th digit is 4 more than the second one. Find the digit.
Ans : 25296.
14. Every day a cyclist meets a train at a particular crossing. The road is straight before the crossing and
both are traveling in the same direction. The cyclist travels with a speed of 10 Kmph. One day the cyclist
comes late by 25 min. and meets the train 5km before the crossing. What is the speed of the train?
Ans: 60 kmph
15. City A's population is 68000, decreasing at a rate of 80 people per year. City B having population
42000 is increasing at a rate of 120 people per year. In how many years both the cities will have same
population?
16. Two cars are 15 kms apart. One is turning at a speed of 50kmph and the other at 40kmph . How
much time will it take for the two cars to meet?
17. A person wants to buy 3 paise and 5 paise stamps costing exactly one rupee. If he buys which of the
following number of stamps he won't able to buy 3 paise stamps.
Ans: 9
18. Some guy holding a glass of wine in his hand looking around in the room says, "This is same as it was
four years ago, how old are your two kids now?" Other guy says "Three now, Pam had one more in the
meanwhile." Pam says, "If you multiply their ages, answer is 96 and if you add the ages of first two kids,
addition is same as our house number." The first guy says, "You are very smart but that doesn't tell me
their ages." Pam says, "It's very simple, just think." What are the ages of three kids?
Ans: 8, 6, 2
17. A motor cyclist participant of a race says "We drove with the speed of 10 miles an hour one way, but
while returning because of less traffic we drove on the same route with 15 miles per hour." What was
their average speed in the whole journey?
18. Given following sequence, find the next term in the series:
19. Three customers want haircut and a shave. In a saloon, two barbers operate at same speed. They
take quarter of an hour for the haircut and 5 mins for the shave. How quickly can they finish the haircut
and shave of these three customers?
Ans: 30 minutes
20. A shopkeeper likes to arrange and rearrange his collection of stamps. He arranges them sometimes
in pair, sometimes in bundle of three, sometimes in bundle of fours, occasionally in bundle of fives and
sixes. Every time he's left with one stamp in hand after arrangement in bundles. But if he arranges in the
bundle of seven, he's not left with any stamp. How many stamps does a shopkeeper have?
Ans: 301
21. Three different types of objects in a bucket. How many times does one need to select object from
the bucket to get atleast 3 objects of the same type?
Ans: 7
22. There are total 15 people. 7 speaks french and 8 speaks spanish. 3 do not speak any language. Which
part of total people speaks both languages.
Ans: 1/5
23. A jogger wants to save ?th of his jogging time. He should increase his speed by how much %age.
Ans: 33.33 %
24. A is an integer. Dividing 89 & 125 gives remainders 4 & 6 respectively. Find a ?
Ans: 17
25. How many 1's are there in the binary form of 8*1024 + 3*64 + 3
Ans. 4