C MCQ

1. In the following loop construct, which one is executed only once always.
    for(exp1; exp2; exp3)

A. exp1
B. exp3
C. exp1 and exp3
D. exp1, exp2 and exp3

View Answer

2. The continue statment cannot be used with

A. for
B. while
C. do while
D. switch

View Answer


3. Which keyword can be used for coming out of recursion?

A. return
B. break
C. exit
D. both A and B

View Answer


4. goto can be used to jump from main to within a function?

A. True
B. False

View Answer


5. Which of the following is an invalid if-else statement?

A. if (if (a == 1)){}
B. if (a){}
C. if ((char) a){}
D. if (func1 (a)){}

View Answer


6. Switch statement accepts.

A. int
B. char
C. long
D. All of the above

View Answer


7. Which loop is guaranteed to execute at least one time.

A. for
B. while
C. do while
D. None of the above

View Answer


8. A labeled statement consist of an identifier followed by

A. ;
B. :
C. ,
D. =

View Answer


9. do-while loop terminates when conditional expression returns?

A. One
B. Zero
C. Non - zero
D. None of the above

View Answer


10. c = (n) ? a : b; can be rewritten asexp1 ? exp2 : exp3;

A. if(n){c = a;}else{c = b;}
B. if(!n){c = a;}else{c = b;}
C. if(n){c = b;}else{c = a;}
D. None of the above

View Answer






Also check :


Discussion


* You must be logged in to add comment.