Vous êtes sur la page 1sur 29

Q1.

Which is the largest fraction: 3/4

7/8

4/5

7/9

A. 3/4
B. 7/8
C. 4/5
D. 7/9
ANSWER: B

Q2. A car left Canterbury at 7.12 am and arrived in Birmingham, 180 miles distant at 10.57 am. What
was its average speed in miles per hour?
A. 42
B. 44
C. 46
D. 48
ANSWER: D

Q3. A cube has a volume of 8 cubic metres. If each side is doubled in length what will its new volume
be in cubic metres?
A. 24
B. 32
C. 48
D. 64
ANSWER: D

Q4. What is the missing letter in this series: x


A. r
B. s
C. q
D. t
ANSWER: D

Q5. In a horse race: Hill Royal came in ahead of Trigger.Hill Royal finished after Black Beauty.
Copenhagen beat Black Beauty but finished after Bucephalus Where did Copenhagen finish?
A. First
B. Second
C. Third
D. Fourth
ANSWER: B

Q6. Alan thinks of a number.He squares it, then takes away 5, next multiplies it by 4, takes away 7,
divides it by 3 and finally adds 6.His answer is 9. What number did he start with?
A. 1
B. 2
C. 3
D. 4
ANSWER: C

Q7. You are facing North. Turn 90 degrees left. Turn 180 degrees right. Reverse direction. Turn 45
degrees left. Reverse direction. Turn 270 degrees right. In which direction are you now facing?
A. N
B. W
C. SE
D. NW
ANSWER: D

Q8. Wayne is double the age of Fernando and one third as old as Didier who will be 48 years old in 6
years.How old is Fernando?
A. 7
B. 8
C. 10
D. 11
ANSWER: A

Q9. A crofter has to get to his herd of sheep quickly as he has been told they are being attacked by a
dog. His sheep are on the other side of a steep hill. He can run over the hill (3 miles) at 4 miles an
hour, or take his tractor via an old dirt track which is 5 miles at an average of 6 miles an hour or he
can drive his car along a very narrow winding road but this is 14 miles and he can only go at 18 miles
an hour on average.Which method should he choose?
A. Running
B. Tractor
C. Car
D. Sleep
ANSWER: A

Q10. A tank is filled by three pipes with uniform flow. The first two pipes operating simultaneously
fill the tank in the same time during which the tank is filled by the third pipe alone. The second pipe
fills the tank 5 hours faster than the first pipe and 4 hours slower than the third pipe. The time
required by the first pipe is:
A. 6 hours
B. 10 hours
C. 15 hours
D. 30 hours
ANSWER: C

Q11. Three partners shared the profit in a business in the ratio 5 : 7 : 8. They had partnered for 14
months, 8 months and 7 months respectively. What was the ratio of their investments?
A. 5:7:8
B. 20:49:64
C. 38:28:21
D. None of these
ANSWER: B

Q12. Simran started a software business by investing Rs. 50,000. After six months, Nanda joined her
with a capital of Rs. 80,000. After 3 years, they earned a profit of Rs. 24,500. What was Simran's
share in the profit?
A. Rs. 9,423

B. Rs. 10,250
C. Rs. 12,500
D. Rs. 10,500
ANSWER: D

Q13. The sum of the present ages of a father and his son is 60 years. Six years ago, father's age was
five times the age of the son. After 6 years, son's age will be:
A. 12 years
B. 14 years
C. 18 years
D. 20 years
ANSWER: D

Q14. A container contains 40 litres of milk. From this container 4 litres of milk was taken out and
replaced by water. This process was repeated further two times. How much milk is now contained
by the container?
A. 26.34 litres
B. 27.36 litres
C. 28 litres
D. 29.16 litres
ANSWER: D

Q15. The angle of elevation of the sun, when the length of the shadow of a tree 3 times the height of
the tree, is:
A. 30
B. 45
C. 60
D. 90
ANSWER: A

Q16. Which is the largest fraction: 3/4

7/8

4/5

7/9

A. 3/4
B. 7/8
C. 4/5
D. 7/9
ANSWER: B

Q17. A car left Canterbury at 7.12 am and arrived in Birmingham, 180 miles distant at 10.57 am.
What was its average speed in miles per hour?
A. 42
B. 44
C. 46
D. 48
ANSWER: D

Q18. A cube has a volume of 8 cubic metres. If each side is doubled in length what will its new
volume be in cubic metres?
A. 24
B. 32
C. 48
D. 64
ANSWER: D

Q19. What is the missing letter in this series: x

A. r
B. s
C. q
D. t
ANSWER: D

Q20. In a horse race: Hill Royal came in ahead of Trigger.Hill Royal finished after Black Beauty.
Copenhagen beat Black Beauty but finished after Bucephalus Where did Copenhagen finish?
A. First

B. Second
C. Third
D. Fourth
ANSWER: B

Q21. Alan thinks of a number.He squares it, then takes away 5, next multiplies it by 4, takes away 7,
divides it by 3 and finally adds 6.His answer is 9. What number did he start with?
A. 1
B. 2
C. 3
D. 4
ANSWER: C

Q22. You are facing North. Turn 90 degrees left. Turn 180 degrees right. Reverse direction. Turn 45
degrees left. Reverse direction. Turn 270 degrees right. In which direction are you now facing?
A. N
B. W
C. SE
D. NW
ANSWER: D

Q23. Wayne is double the age of Fernando and one third as old as Didier who will be 48 years old in
6 years.How old is Fernando?
A. 7
B. 8
C. 10
D. 11
ANSWER: A

Q24. A crofter has to get to his herd of sheep quickly as he has been told they are being attacked by
a dog. His sheep are on the other side of a steep hill. He can run over the hill (3 miles) at 4 miles an
hour, or take his tractor via an old dirt track which is 5 miles at an average of 6 miles an hour or he

can drive his car along a very narrow winding road but this is 14 miles and he can only go at 18 miles
an hour on average.Which method should he choose?
A. Running
B. Tractor
C. Car
D. Sleep
ANSWER: A

Q25. A tank is filled by three pipes with uniform flow. The first two pipes operating simultaneously
fill the tank in the same time during which the tank is filled by the third pipe alone. The second pipe
fills the tank 5 hours faster than the first pipe and 4 hours slower than the third pipe. The time
required by the first pipe is:
A. 6 hours
B. 10 hours
C. 15 hours
D. 30 hours
ANSWER: C

Q26. Three partners shared the profit in a business in the ratio 5 : 7 : 8. They had partnered for 14
months, 8 months and 7 months respectively. What was the ratio of their investments?
A. 5:7:8
B. 20:49:64
C. 38:28:21
D. None of these
ANSWER: B

Q27. Simran started a software business by investing Rs. 50,000. After six months, Nanda joined her
with a capital of Rs. 80,000. After 3 years, they earned a profit of Rs. 24,500. What was Simran's
share in the profit?
A. Rs. 9,423
B. Rs. 10,250
C. Rs. 12,500

D. Rs. 10,500
ANSWER: D

Q28. The sum of the present ages of a father and his son is 60 years. Six years ago, father's age was
five times the age of the son. After 6 years, son's age will be:
A. 12 years
B. 14 years
C. 18 years
D. 20 years
ANSWER: D

Q29. A container contains 40 litres of milk. From this container 4 litres of milk was taken out and
replaced by water. This process was repeated further two times. How much milk is now contained
by the container?
A. 26.34 litres
B. 27.36 litres
C. 28 litres
D. 29.16 litres
ANSWER: D

Q30. The angle of elevation of the sun, when the length of the shadow of a tree 3 times the height of
the tree, is:
A. 30
B. 45
C. 60
D. 90
ANSWER: A

Q1. Output of the following program


void main()
{
while(1){
if(printf(%d,printf(%d)))
break;
else
continue;
}
}
A. Garbage values
B. infinite loop
C. 4
D. 1
ANSWER: A

Q2. What is the output of the following program


main()
{
unsigned char i=0;
for(;i>=0;i++) ;
printf(%d\n,i);
}
A. Infinite loop
B. Run-time error
C. 0
D. Finite loop with memory addresses
ANSWER: A

Q3. What is the output of the following program

int some=0;
main()
{
int thing = 0;
printf(%d %d\n, some ,thing);
}
A. 0 0
B. Compile error
C. Run time error
D. 0 <memory address>
ANSWER: A

Q4. What is the output of the following program


main(){
int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf(%d%d\n,x,y);
}
A. 5693
B. 5694
C. 5793
D. 5794
ANSWER: D

Q5. What is the output of the following program


main(){
int x=5;
printf(%d,%d,%d\n,x,x< <2,x>>2);
}
A. Compilation error

B. 5,20,1
C. 5,10,2
D. 5,1,20
ANSWER: B

Q6. The following variable is available in file1.c, who can access it?
static int averg;
A. All the functions in file1.c can access
B. All the functions in all files in the same directory can access
C. Only the first function following the variable in file1.c can access
D. It is not a valid declaration
ANSWER: A

Q7. Which of the following about automatic storage class is false


A. It is stored in main memory
B. Default value is 0
C. Scope is local to the block in which the variable is defined
D. Its lifetime will be till the control remains within the block
ANSWER: B

Q8. Which of the following about union is false


A. It is a collection of data items of different data types.
B. If it has two members of different data types, they are allocated in the different memory
C. The data is interpreted in bytes
D. Only one union member can be initialized at a time
ANSWER: B

Q9. What is the output of the following program


main()
{
printf("\nab");

printf("\bsi");
printf("\rha");
}
A. has
B. hasaiaab
C. hai
D. aas
ANSWER: C

Q10. What is the output of the following program


void main()
{
int const * p = 5
printf("%d", ++(*p));
}
A. 6
B. 5
C. Compile error
D. Run time error
ANSWER: C

Q11. What type of memory could be accessed in least time


A. cache memory
B. secondary memory
C. main memory
D. none
ANSWER: A

Q12. What is the integer return value of sizeof(void *)


A. 0
B. 1

C. 2
D. 4
ANSWER: C

Q13. What is the output of the following program


void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf("%d",i);
}
A. Infinite loop
B. Runtime error
C. 32767
D. 11
ANSWER: C

Q14. What is the output of the following program


void main()
{
int const * p=5;
printf(%d,++(*p));
}
A. compile error
B. 6
C. 5
D. memory location address plus 1
ANSWER: A

Q15. Which of the following statements are correct about the following program

#include<stdio.h>
int main()
{
printf("%p\n", main());
return 0;
}

A.

It prints garbage values infinitely

B.

Runs infinitely without printing anything

C.

Error: main() cannot be called inside printf()

D.

No Error and print nothing

ANSWER: B

Q16. Which is the largest fraction:


3/4

7/8

4/5

7/9

A. 3/4
B. 7/8
C. 4/5
D. 7/9
ANSWER: B

Q17. A car left Canterbury at 7.12 am and arrived in Birmingham, 180 miles distant at 10.57 am.
What was its average speed in miles per hour?
A. 42
B. 44
C. 46
D. 48
ANSWER: D

Q18. A cube has a volume of 8 cubic metres. If each side is doubled in length what will its new
volume be in cubic metres?

A. 24
B. 32
C. 48
D. 64
ANSWER: D

Q19. What is the missing letter in this series:


x

A. r
B. s
C. q
D. t
ANSWER: D

Q20. In a horse race: Hill Royal came in ahead of Trigger.


Hill Royal finished after Black Beauty.
Copenhagen beat Black Beauty but finished after Bucephalus
Where did Copenhagen finish?
A. First
B. Second
C. Third
D. Fourth
ANSWER: B

Q21. Alan thinks of a number.


He squares it, then takes away 5, next multiplies it by 4, takes away 7, divides it by 3 and finally adds
6.
His answer is 9.
What number did he start with?
A. 1
B. 2

C. 3
D. 4
ANSWER: C

Q22. You are facing North. Turn 90 degrees left. Turn 180 degrees right. Reverse direction. Turn 45
degrees left. Reverse direction. Turn 270 degrees right.
In which direction are you now facing?
A. N
B. W
C. SE
D. NW
ANSWER: D

Q23. Wayne is double the age of Fernando and one third as old as Didier who will be 48 years old in
6 years.
How old is Fernando?
A. 7
B. 8
C. 10
D. 11
ANSWER: A

Q24. A crofter has to get to his herd of sheep quickly as he has been told they are being attacked by
a dog. His sheep are on the other side of a steep hill. He can run over the hill (3 miles) at 4 miles an
hour, or take his tractor via an old dirt track which is 5 miles at an average of 6 miles an hour or he
can drive his car along a very narrow winding road but this is 14 miles and he can only go at 18 miles
an hour on average.
Which method should he choose?
A. Running
B. Tractor
C. Car
D. Sleep
ANSWER: A

Q25. A tank is filled by three pipes with uniform flow. The first two pipes operating simultaneously
fill the tank in the same time during which the tank is filled by the third pipe alone. The second pipe
fills the tank 5 hours faster than the first pipe and 4 hours slower than the third pipe. The time
required by the first pipe is:
A. 6 hours
B. 10 hours
C. 15 hours
D. 30 hours
ANSWER: C

Q26. Three partners shared the profit in a business in the ratio 5 : 7 : 8. They had partnered for 14
months, 8 months and 7 months respectively. What was the ratio of their investments?
A. 5:7:8
B. 20:49:64
C. 38:28:21
D. None of these
ANSWER: B

Q27. Simran started a software business by investing Rs. 50,000. After six months, Nanda joined her
with a capital of Rs. 80,000. After 3 years, they earned a profit of Rs. 24,500. What was Simran's
share in the profit?
A. Rs. 9,423
B. Rs. 10,250
C. Rs. 12,500
D. Rs. 10,500
ANSWER: D

Q28. The sum of the present ages of a father and his son is 60 years. Six years ago, father's age was
five times the age of the son. After 6 years, son's age will be:
A. 12 years
B. 14 years

C. 18 years
D. 20 years
ANSWER: D

Q29. A container contains 40 litres of milk. From this container 4 litres of milk was taken out and
replaced by water. This process was repeated further two times. How much milk is now contained
by the container?
A. 26.34 litres
B. 27.36 litres
C. 28 litres
D. 29.16 litres
ANSWER: D

Q30. The angle of elevation of the sun, when the length of the shadow of a tree 3 times the height of
the tree, is:
A. 30
B. 45
C. 60
D. 90
ANSWER: A

1. Two students appeared at an examination. One of them secured 9 marks more than the other and
his marks was 56% of the sum of their marks. The marks obtained by them are:
A. 42,33
B. 41,32
C. 39,30
D. 43,34
ANS: A
2. Find out the wrong number in the given sequence of numbers.(1, 2, 6, 15, 31, 56, 91)
A. 31
B. 56
C. 91
D. 15
ANS: C
3.
Robert is travelling on his cycle and has calculated to reach point A at 2 P.M. if he travels at 10 kmph,
he will reach there at 12 noon if he travels at 15 kmph. At what speed must he travel to reach A at 1
P.M.?
A. 8 kmph
B. 11 kmph
C. 14 kmph
D. 12 kmph
ANS: D
Let the distance travelled by x km.
Then, x
x
=2
10
15
3x - 2x = 60
x = 60 km.
Time taken to travel 60 km at 10 km/hr =
10

60

So, Robert started 6 hours before 2 P.M. i.e., at 8 A.M.


Required speed =
60
kmph. = 12 kmph.

hrs

= 6 hrs.

4. 10 women can complete a work in 7 days and 10 children take 14 days to complete the work. How
many days will 5 women and 10 children take to complete the work?
A. 3
B. 5
C. 7
D. none of these
ANS: C
1 woman's 1 day's work =
1
70
1 child's 1 day's work = 1
140
(5 women + 10 children)'s day's work =
+
1
=
1
70
140
14
14
7

10

5 women and 10 children will complete the work in 7 days.

5. The least number which when divided by 5, 6 , 7 and 8 leaves a remainder 3, but when divided by
9 leaves no remainder, is:
A. 1677
B. 3363
C. 2523
D. 1683
ANS: D
L.C.M. of 5, 6, 7, 8 = 840.
Required number is of the form 840k + 3
Least value of k for which (840k + 3) is divisible by 9 is k = 2.
Required number = (840 x 2 + 3) = 1683.

6. A wheel that has 6 cogs is meshed with a larger wheel of 14 cogs. When the smaller wheel has
made 21 revolutions, then the number of revolutions mad by the larger wheel is:
A. 4
B. 49
C. 12
D. 9
ANS: D

Let the required number of revolutions made by larger wheel be x.


Then, More cogs, Less revolutions (Indirect Proportion)
14 : 6 :: 21 : x
x=
6 x 21
14

14 x x = 6 x 21

x = 9.

7. Five farmers have 7, 9, 11, 13 & 14 apple trees, respectively in their orchards. Last year, each of
them discovered that every tree in their own orchard bore exactly the same number of apples.
Further, if the third farmer gives one apple to the first, and the fifth gives three to each of the
second and the fourth, they would all have exactly the same number of apples. What were the yields
per tree in the orchards of the third and fourth farmers?
A. 9 & 11 apples per tree
B. 11 & 9 apples per tree
C. 11 & 11 apples per tree
D. 9 & 9 apples per tree
ANS: B
Let a, b, c, d & e be the total number of apples bored per year in A, B, C, D & E s orchard. Given that
a+1=b+3=c1=d+3=e6
But the question is to find the number of apples bored per tree in C and D s orchard. If is enough to
consider c 1 = d + 3.
Since the number of trees in Cs orchard is 11 and that of Ds orchard is 13. Let x and y be the
number of apples bored per tree in C & d s orchard respectively.
Therefore 11 x 1 = 13 y + 3
By trial and error method, we get the value for x and y as 11 and 9

8. What is the sum of all numbers between 100 and 1000 which are divisible by 14 ?
A. 34398
B. 35280
C. 36400
D. 35392

ANS: D
The number closest to 100 which is greater than 100 and divisible by 14 is 112, which is the first
term of the series which has to be summed.

The number closest to 1000 which is less than 1000 and divisible by 14 is 994, which is the last term
of the series.
112 + 126 + .... + 994 = 14(8+9+ ... + 71) = 35392
9. A man invested Rs. 14,400 in Rs.100 shares of a company at 20% premium. If the company
declares 5% dividend at the end of the year , then how much does he get?
A. Rs. 500
B. Rs. 650
C. Rs. 600
D. Rs. 720
ANS: C
Number of shares
= (14400 / 120)
=120.
Face value
=Rs.(100 120)
=Rs. 12000.
Annual Income = Rs.(5/100 12000)
=Rs. 600.

10. Rajan got married 8 years ago. His present age is 6 / 5 times his age at the time of his marriage.
Rajan's sister was 10 years younger to him at the time of his marriage. The age of Rajan's sister is
A. 32 years
B. 38 years
C. 36 years
D. 40 years
ANS: B

Let Rajan's present age be x years. Then, his age at the time of marriage =(x-8) years.
Therefore
x= 6/5(x-6)
5x = 6x-48
x=48.
Rajan's sister's age at the time of his marriage=(x-8)-10 =(x-18)=30
Rajan's sister's present age
=(30+8)
= 38 years.

11. A tap can fill a tank in 6 hours. After half the tank is filled, three more similar taps are opened.
What is the total time taken to fill the tank completely ?
A. 3 hrs 15 min
B. 4 hrs
C. 3 hrs 45 min

D. 4 hrs 15 min
ANS:C
Time taken by one tap to fill half the tank = 3hrs.
Part filled by the four taps in 1 hour
= (41/6)
= 2/3.
Remaining part = (1 - 1/2)
= 1/2.
Therefore,
= 2/3 : 1/2 :: 1 : x
= (1/213/2)
= 3/ 4 hrs i.e 45 mins.
So, total time taken = 3 hrs 45 min.

12. A man earns on the first day and spends Rs. 15 on the next day. He again earns Rs. 20 on the
third day and spends Rs. 15 on the fourth day. If he continues to save like this, how soon will he have
Rs. 60 in hand?
A. on 27th day
B. on 17th day
C. on 30th day
D. on 40th day
ANS: B
Money earned in 2 days = Rs.(20 - 15)
=Rs. 15.
Money earned in 16 days
= Rs.(5/2 x 16)
=Rs. 40.
On 17th day, money in hand = Rs.(40 + 20 )
= Rs. 60.

13. A boat takes 19 hours for travelling downstream from point A to point B and coming back to a
point C midway between A and B. If the velocity of the stream is 4 kmph and the speed of the boat in
still water is 14 kmph, what is the distance between A and B ?
A. 160 km
B. 220 km
C. 200 km
D. 180 km
ANS: D
Speed Downstream
= (14 + 4) km/hr
= 18 km/hr.
Speed upstream
=(14 - 4) km/hr
= 10 km/hr..
Let the distance b/w A and B
be xkm.Then =(x/18+ x/2 / 10)
= 19
= 19x / 180 = 19

x= 180.

14. A milk vendor has 2 cans of milk.The first contains 25% water and the rest milk.The second
contains 50% water. How much milk should he mix from each of the containers so as to get 12 litres
of milk such that the ratio of water to milk is 3 : 5 ?
A. 4 lit, 8 lit
B. 6 lit, 6 lit
C. 5 lit, 7 lit
D. 7 lit, 4 lit
ANS:B
Let the cost of 1 litre milk be Re. 1
Milk in 1 litre mix. in 1st can = 3/4 litre, C.P. of 1 litre mix. in 1st can Re. 3/4
Milk in 1 litre mix. in 2nd can = 1/2 litre, C.P. of 1 litre mix. in 2nd can Re. 1/2
Milk in 1 litre of final mix. = 5/8 litre, mean price = Re. 5/8.
By the rule of alligation, we have:
Cost of 1 kg mixture of 1st kind Cost of 1 kg mixture of 2nd kind
Ratio of two mixtures = 1/8 : 1/8 = 1:1.
So, quantity of mixture taken from each can = (1/2 X 12) = 6 litres

15. In how many different ways can the letters of the word 'AUCTION' be arranged in such a way
that the vowels always come together?
A. 30
B. 48
C. 144
D. 576
ANS: D
The word Auction has 7 different letters.
When, the vowels AUIO are always together, they can be supposed to form one letter.
Then, we have to arrange the letters CTN (AUIO).
Now, 4 letters can be arranged in 4! = 24 ways.
The vowels (AUIO) can be arranged in 4!= 24 ways.
Required number of ways
= (24 x 24)
= 576.
C QUESTIONS:
16. What will be the output of following program?
main()
{
int x=15;
printf(\n%d%d%d, x!=15, x=20, x<30);
}
A. 0,0,0

B. 15, 20, 30
C. 0, 20, 1
D. Error
ANS: C
17. The purpose for mode w+b in file operation is
(A) create a binary file for read/write
(B) create a binary file for write
(C) open a binary file for writing
(D) open a binary file for reading/writing
ANS. A
18. void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
}
}
What is the output?

A. XAM is printed
B. Nothing is printed
C. compiler error
D. EXAM is printed
ANS: B
19. main()
{
struct
{
int i;
}xyz;
(*xyz)->i=10;
printf("%d",xyz.i);
}
What is the output of this program?

A. program will not compile


B. god only knows
C. 10

D. adddress of I
ANS: C
20. What will be the value of `a` after the following code is executed
#define square(x) x*x
a = square(2+3)
A. 25
B. 13
C. 10
D. 11

ANS: D
21. What will be the output of the following program ?
#include
void main()
{
int a = 36, b = 9;
printf("%d",a>>a/b-2);
}
A. 5
B. 7
C. 9
D. None of these
ANS: C

22. What will be the output of the following statements ?


int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]);
A. 0 3 %D
B. 0 0 0
C. 3 2 1
D. 0 3 2
ANS: D
23. In which header file is the NULL macro defined?
A. stdio.h
B. stddef.h
C. stdio.h and stddef.h
d. math.h
ANS: C

24. Point out the error, if any in the while loop.


#include<stdio.h>
int main()
{

int i=1;
while()
{
printf("%d\n", i++);
if(i>10)
break;
}
return 0;
}
A.

No error

B.

There should be at least a semicolon in the while

C.

The while loop should be replaced with for loop.

D.

There should be a condition in the while loop

ANS: D
25. Point out the error, if any in the program.
#include<stdio.h>
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}
A. Error: L value required for b
B. 200
C. 100
D. Garbage Value
ANS: A
26. What will be the output of the program (myprog.c) given below if it is executed from the
command line?
cmd> myprog one two three
/* myprog.c */
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char **argv)
{
printf("%s\n", *++argv);
return 0;
}
A. myprog
B. three
C. two
D. one
ANS: D

27. To print out a and b given below, which of the following printf() statement will you use?
#include<stdio.h>
float a=3.14;
double b=3.14;
A.
B.
C.
D.
ANS: B

printf("%Lf %f", a, b);


printf("%f %lf", a, b);
printf("%Lf %Lf", a, b);
printf("%f %Lf", a, b);

28.
Which of the following function is used to find the first occurrence of a given string in another
string?
A.
B.
C.
D.
ANS: C

strchr()
strrchr()
strstr()
strnset()

29. What will be the output of the program ?


#include<stdio.h>
int main()
{
char p[] = "%d\n";
p[1] = 'c';
printf(p, 65);
return 0;
}

A. a
B. A
C. c
D. 65
ANS: B

Step 1: char p[] = "%d\n"; The variable p is declared as an array of characters and initialized with
string "%d".
Step 2: p[1] = 'c'; Here, we overwrite the second element of array p by 'c'. So array p becomes "%c".
Step 3: printf(p, 65); becomes printf("%c", 65);
Therefore it prints the ASCII value of 65. The output is 'A'.

30.
What will be the output of the program ?
#include<stdio.h>

int main()
{
printf(5+"Good Morning\n");
return 0;
}
A.
Good Morning
B.

Good

C.

Morning

D.

ANS: C
printf(5+"Good Morning\n"); It skips the 5 characters and prints the given string.

Hence the output is "Morning"

Vous aimerez peut-être aussi