PROGRAMMING FOR PROBLEM SOLVING
Unit II · Control Statements
Understand decisions and loops through clear answers, traces and tested programs.
Selection
- 01What is a control statement? Name its three main categories.2 marks
- 02Explain the types of control statements in C.5 marks
- 03When does the body of an if statement execute?2 marks
- 04Explain the simple if statement with syntax and an example.5 marks
- 05How does if-else choose a branch?2 marks
- 06Explain if-else with a C program to test whether an integer is even or odd.5 marks
- 07What is a nested if statement?2 marks
- 08Explain nested if statements with an example.5 marks
- 09What is an else-if ladder?2 marks
- 10Explain the else-if ladder with a grade-classification example.5 marks
- 11State two rules for case labels in switch.2 marks
- 12Explain switch with syntax and a menu-based example.5 marks
- 13When is an else-if ladder more suitable than switch?2 marks
- 14Compare an else-if ladder and switch.5 marks
Loops
- 15Why is while called an entry-controlled loop?2 marks
- 16Explain the while loop with syntax and an example.5 marks
- 17List the execution order of the parts of a for loop.2 marks
- 18Explain the for loop with syntax and its execution order.5 marks
- 19Why does a do-while loop execute its body at least once?2 marks
- 20Explain the do-while loop and show why it executes at least once.5 marks
- 21Distinguish entry-controlled and exit-controlled loops.2 marks
- 22Compare while, for and do-while loops.5 marks
- 23What is a nested loop?2 marks
- 24Explain nested loops with a rectangular output example.5 marks
Jump Statements
- 25What does break do inside a loop?2 marks
- 26Explain the break statement with an example.5 marks
- 27How does continue differ from break?2 marks
- 28Explain the continue statement and its behaviour in different loops.5 marks
- 29What is goto? State one limitation.2 marks
- 30Explain goto with its advantages, limitations and an example.5 marks
Loop Applications
- 31How is the sum of the first n natural numbers accumulated in a loop?2 marks
- 32Write a C program to find the sum of the first n natural numbers using a loop.5 marks
- 33Why does a factorial accumulator start at 1?2 marks
- 34Write a C program to calculate factorial using a loop.5 marks
- 35How many iterations print a multiplication table with r rows?2 marks
- 36Write a C program to print a multiplication table for a given number of rows.5 marks
- 37How do % 10 and / 10 help process integer digits?2 marks
- 38Write a C program to find the sum of digits of a non-negative integer.5 marks
- 39How many values appear in row i of the repeated-number triangle?2 marks
- 40Write a C program to print a pattern whose row i contains i copies of i.5 marks
No matching questions. Clear the search or change the marks filter.
The 2- and 5-mark badges are practice allocations. Previous-paper questions retain their printed marks.