Control Structure Questions and Answers
Control Structure Questions with Answers form the foundation of logic building in C programming. These C programming questions and answers focus on decision-making statements like if-else, switch, loops, and nested conditions. Mastering control structures helps in writing efficient and optimized programs, which is crucial for placements at TCS, Infosys, and Accenture. Practicing control structure MCQs with solutions enables you to solve complex programming tasks confidently. Start your C aptitude preparation now by downloading our free control structure practice questions PDF or attempt the online test for immediate feedback.
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
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
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
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
5. Find the output. void main ( ) { goto start; { int a=1; start:printf ("%d',a); } }
- 1
- 0
- Garbage
- None of these
6. Switch-case statement does not implement on
- Non exclusive case
- Mutually exclusive case
- Mutually non exclusive case
- Exclusive case
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
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
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
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