Home Subjects C Programming

C Programming

C language from basics to advanced placement prep

1,000 Q 10 Topics Take Test
Advertisement
Difficulty: All Easy Medium Hard 741–750 of 1,000
Topics in C Programming
Q.741 Easy Control Flow
Which control flow statement allows jumping to a labeled location in C?
A jump
B goto
C skip
D branch
Correct Answer:  B. goto
EXPLANATION

goto statement allows unconditional jump to a labeled location. Though generally discouraged, it's valid in C and sometimes used for error handling.

Take Test
Q.742 Easy Control Flow
In a switch statement, if a case label is missing the break statement, what occurs?
A Compilation error
B Runtime error
C Fall-through to next case (no error)
D Automatic break is inserted by compiler
Correct Answer:  C. Fall-through to next case (no error)
EXPLANATION

Missing break causes fall-through behavior where execution continues to the next case label until a break or end of switch is encountered.

Take Test
Q.743 Easy Control Flow
What is the primary difference between while and do-while loops?
A while is faster than do-while
B do-while executes the body at least once before checking condition
C while can use break statement but do-while cannot
D do-while requires a semicolon after the closing parenthesis
Correct Answer:  B. do-while executes the body at least once before checking condition
EXPLANATION

do-while loop checks the condition after executing the loop body, ensuring at least one execution. while loop checks before executing.

Take Test
Q.744 Easy Control Flow
Which of the following control flow statements will cause a compilation error in C?
A break; used outside any loop or switch
B continue; used inside a for loop
C return; used inside main function
D goto label; where label is defined later
Correct Answer:  A. break; used outside any loop or switch
EXPLANATION

break and continue statements can only be used within loops or switch statements. Using break outside these constructs results in a compilation error.

Take Test
Q.745 Hard Control Flow
What is the output of this complex nested loop?
for(int i = 1; i
A 11 12 21 22
B 12 21
C 11 22
D 12 21 22
Correct Answer:  B. 12 21
EXPLANATION

continue skips when i==j. i=1: prints 12 (skips 11); i=2: prints 21 (skips 22). Output: 12 21

Take Test
Q.746 Easy Control Flow
What value does the ternary operator return?
int result = (5 > 3) ? 10 : 20;
A 5
B 3
C 10
D 20
Correct Answer:  C. 10
EXPLANATION

The condition (5 > 3) is true, so the ternary operator evaluates and returns the true expression value: 10.

Take Test
Q.747 Easy Control Flow
Which statement best describes the difference between break and continue?
A break exits the loop; continue skips the current iteration
B Both terminate the loop
C continue exits; break skips iteration
D They are identical in functionality
Correct Answer:  A. break exits the loop; continue skips the current iteration
EXPLANATION

break completely exits/terminates the loop. continue skips the rest of current iteration and jumps to the next iteration.

Take Test
Q.748 Medium Control Flow
What is the behavior of this code?
int i = 0;
while(1) {
i++;
if(i > 5) break;
}
A Infinite loop
B Loop runs 6 times (i = 1 to 6)
C Loop runs 5 times (i = 1 to 5)
D Syntax error
Correct Answer:  B. Loop runs 6 times (i = 1 to 6)
EXPLANATION

while(1) creates an infinite loop. i increments until i > 5 (i becomes 6), then break exits. Loop runs 6 iterations.

Take Test
Q.749 Medium Control Flow
Predict the output:
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
if(i + j == 1) continue;
printf("Done");
A Done
B No output
C Done is printed 3 times
D Syntax error
Correct Answer:  A. Done
EXPLANATION

continue only affects the inner loop, not the outer. The loops complete normally and 'Done' is printed once after both loops finish.

Take Test
Q.750 Medium Control Flow
What happens with this nested if?
if(1) if(0) printf("A"); else printf("B");
A A
B B
C No output
D Syntax error
Correct Answer:  B. B
EXPLANATION

The else binds to the nearest if (inner if). Outer if(1) is true, inner if(0) is false, so else executes printing 'B'.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips