Classical

C Programming MCQ - Decision Making & Looping

11:  

Which is true of conditional compilation ?

A.

it is taken care of by the compiler

B.

 it is taken care of by the pre-processor

C.

it is compiling a program based on a condition

D.

both (b) & (c)

 
 

Option: D

Explanation :


12:  

Consider the following program fragment

 char c = ' a ';
 while ( c++ <= ' z ')
 putchar ( xxx );


If the required output is abcdefghijklmnopqrstuvwxyz, then xxx should be

A.

c

B.

c++

C.

c-1

D.

-c

 
 

Option: C

Explanation :


13:  

Choose the statements that are syntactically correct

A.

/*  Is /* this a valid */ comment */

B.

for ( ; ; ) ;

C.

return;

D.

both (b) & (c)

 
 

Option: D

Explanation :


14:  

The following program fragment

for(i = 3 ; i < 15; i += 3);
printf(" %d ", i);


results in

A.

a syntax error

B.

an execution error

C.

printing of 12

D.

printing of 15

 
 

Option: D

Explanation :


15:  

The following program fragment

for (i = 1; i< 5; ++ i )
if ( i == 3) continue;
else printf( " %d " i );


results in the printing of

A.

1 2 4 5

B.

1 2 4

C.

2 4 5

D.

none of the above

 
 

Option: B

Explanation :

The use of continue statement forces the execution to skip the remainder of the current pass over the loop and initiates the next. If ' U ' is 3. print f statement will be skipped. Hence the answer is b




Suggest an improvement