Control Structure Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q1
Which of the following is a selection statement?
  • A for, while
  • B while, do-while
  • C if, switch
  • D Continue, goto
Answer: Option C
Q2
The value in the expression of a switch statement can't be
  • A An arithmetic expression
  • B Return value from a function call
  • C A bitwise expression
  • D A floating point expression
Answer: Option D
Q3
Find the output? void main ( ) { int a=5; if (a++, a--,a) printf("hellow"); else printf("byte"); }
  • A int a=5;
  • B bye
  • C Compilation error
  • D None of these
Answer: Option A
Q4
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.
  • A All of the above
  • B Both I & II
  • C Both II & III
  • D Only II
Answer: Option A
Q5
Find the output. void main ( ) { goto start; { int a=1; start:printf ("%d',a); } }
  • A 1
  • B 0
  • C Garbage
  • D None of these
Answer: Option C
Q6
Switch-case statement does not implement on
  • A Non exclusive case
  • B Mutually exclusive case
  • C Mutually non exclusive case
  • D Exclusive case
Answer: Option C
Q7
Find the output void main ( ) { int i=1; while (i<=5) { printf("%d", i); if (i==2) continue; i++; } }
  • A 122222....
  • B 122345
  • C 11111....
  • D None of these
Answer: Option A
Q8
Find the output void main ( ) { int i=1; if (++i) if (i++) printf("%d", i); else printf("%d", i); }
  • A 1
  • B 2
  • C 3
  • D Compilation error
Answer: Option C
Q9
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.
  • A Only III
  • B Both I & II
  • C Both II & III
  • D All of the above
Answer: Option D
Q10
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"); } }
  • A fool
  • B raja
  • C Constant expression required
  • D Switch selection expression must be of integral type
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test