Control Structure Questions and Answers

Control Structure

Showing 10 of 97 questions
1. Which of the following is a selection statement?
  • for, while
  • while, do-while
  • if, switch
  • Continue, goto
Show Answer Report
2. The value in the expression of a switch statement can't be
  • An arithmetic expression
  • Return value from a function call
  • A bitwise expression
  • A floating point expression
Show Answer Report
3. Find the output? void main ( ) { int a=5; if (a++, a--,a) printf("hellow"); else printf("byte"); }
  • int a=5;
  • bye
  • Compilation error
  • None of these
Show Answer Report
4. In switch statement, wehch of the following is/are true? I. Only constant value is applicable. II. Character constants are automatically converted to integers. III. Nested if can be used in case statements.
  • All of the above
  • Both I & II
  • Both II & III
  • Only II
Show Answer Report
5. Find the output. void main ( ) { goto start; { int a=1; start:printf ("%d',a); } }
  • 1
  • 0
  • Garbage
  • None of these
Show Answer Report
6. Switch-case statement does not implement on
  • Non exclusive case
  • Mutually exclusive case
  • Mutually non exclusive case
  • Exclusive case
Show Answer Report
7. Find the output void main ( ) { int i=1; while (i<=5) { printf("%d", i); if (i==2) continue; i++; } }
  • 122222....
  • 122345
  • 11111....
  • None of these
Show Answer Report
8. Find the output void main ( ) { int i=1; if (++i) if (i++) printf("%d", i); else printf("%d", i); }
  • 1
  • 2
  • 3
  • Compilation error
Show Answer Report
9. Which one is best suited for control statements? I. To alter the flow of a program II. Test the logical conditions III. Control the flow of execution as per the selection.
  • Only III
  • Both I & II
  • Both II & III
  • All of the above
Show Answer Report
10. Find the output void main ( ) { int x=5, 5f; switch (x++) { case x*1: printf("raja"): break; case x*2: printf(rani"); break; default: printf("fool"); } }
  • fool
  • raja
  • Constant expression required
  • Switch selection expression must be of integral type
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test