C Programming (BSc CSIT, CSC115): the questions likely to come
75 analyzed questions from 7 past papers (2074-2081), grouped by syllabus unit — each with its probability, how often it's been asked, and where to study the answer.
Explain the different types of looping statements with syntax and example. Write a program to check whether a number is an Armstrong number.
Looping Statements in C
A loop repeatedly executes a block of statements as long as a condition remains true. C provides three loop constructs.
1. while loop (entry-controlled)
The condition is tested before the body executes; body may run zero times.
while (condition) {
// body
}
int i = 1;
while (i <= 5) { printf("%d ", i); i++; } // 1 2 3 4 5
2. do...while loop (exit-controlled)
The body executes once first, then the condition is tested; body runs at least once.
do {
// body
} while (condition);
int i = 1;
do { printf("%d ", i); i++; } while (i <= 5); // 1 2 3 4 5
3. for loop (entry-controlled, compact)
Initialization, condition and update are written in one line.
for (init; condition; update) {
// body
}
for (int i = 1; i <= 5; i++) printf("%d ", i); // 1 2 3 4 5
Key difference: while and for test the condition first (may run 0 times); do...while runs at least once.
Program: Check Armstrong Number
An Armstrong number equals the sum of its own digits each raised to the power of the number of digits (e.g. ).
#include <stdio.h>
#include <math.h>
int main() {
int num, temp, rem, sum = 0, digits = 0;
printf("Enter a number: ");
scanf("%d", &num);
temp = num;
while (temp != 0) { digits++; temp /= 10; } // count digits
temp = num;
while (temp != 0) {
rem = temp % 10;
sum += (int)pow(rem, digits);
temp /= 10;
}
if (sum == num)
printf("%d is an Armstrong number\n", num);
else
printf("%d is not an Armstrong number\n", num);
return 0;
}
Sample run: input 153 → output 153 is an Armstrong number.
Control Statements
Explain the different types of looping statements with syntax and example. Write a program to check whether a number is an Armstrong number.
Write a program to display the first 50 prime numbers.
Differentiate between while and do-while loops.
Explain different types of decision-making (branching) statements in C with syntax and examples. Differentiate if-else with switch statement.
What is a loop? Explain different types of looping statements available in C with syntax, flowchart and examples.
Explain the switch-case statement with an example.
Write a program to reverse a given number.
Explain the use of the goto statement with an example.
What is a nested loop? Write a program to print a pyramid pattern of stars.
Write a program to find the sum of digits of a given number.
Write a program to display the Fibonacci series up to n terms.
Differentiate between break and continue statements with examples.
Write a program to check whether a given number is prime or not.
Sit a probable paper
A full mock exam built from the most likely questions, mirroring the real paper's structure. Every slot is a real past question.
Most Probable Paper
Mirrors the real structure · 60 marks · based on 7 past papers
- 1.[10 marks]
List different types of operators available in C and explain any four of them with examples.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Operators and Expressions) appears in 86% of years.
- 2.[10 marks]
Explain the different types of looping statements with syntax and example. Write a program to check whether a number is an Armstrong number.
Asked once (2079); so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
- 3.[10 marks]
Explain different types of decision-making (branching) statements in C with syntax and examples. Differentiate if-else with switch statement.
Asked once (2075); so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
- 1.[5 marks]
Describe different formatted input and output functions in C.
This question has recurred in 3 of 7 years; so far only in internal assessments, not the board; and its topic recurs in 5 of 7 years.
- 2.[5 marks]
Write a program to display the first 50 prime numbers.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
- 3.[5 marks]
Differentiate between while and do-while loops.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
- 4.[5 marks]
Demonstrate the use of a recursive function with a suitable example.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Functions) appears in 100% of years.
- 5.[5 marks]
Explain the use of pointers with arrays.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic recurs in 5 of 7 years.
- 6.[5 marks]
Explain the basic structure of a C program.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Introduction) appears in 86% of years.
- 7.[5 marks]
Write short notes on storage classes in C.
This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic recurs in 5 of 7 years.
- 8.[5 marks]
Explain the switch-case statement with an example.
Asked once (2080); so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
- 9.[5 marks]
Write a program to reverse a given number.
Asked once (2079); so far only in internal assessments, not the board; and its topic (Control Statements) appears in 100% of years.
Behind the numbers
The raw evidence the predictions are computed from: marks per unit per year, syllabus weights, trends, and coverage.
Show the heatmap, topic table and coverage analysis
The receipt: marks per unit, per year
Each row is a syllabus unit, each column an exam year, each cell the marks that unit earned that year. Click any cell to see the actual questions behind it.
| # | Syllabus unit | Probability | Appeared | Avg marks | Syllabus weight | Exam vs syllabus | Trend | Questions |
|---|---|---|---|---|---|---|---|---|
| 1 | U5Control Statements | Very likely100% | 12.9 | 16%7 lecture hrs | Balancedexam 17% · syllabus 16% | Fading | 2 recurring13 total | |
| 2 | U6Arrays and Strings | Very likely100% | 12.1 | 13%6 lecture hrs | Balancedexam 16% · syllabus 13% | Steady | none repeat13 total | |
| 3 | U7Functions | Very likely100% | 10.7 | 13%6 lecture hrs | Balancedexam 14% · syllabus 13% | Steady | 1 recurring11 total | |
| 4 | U4Operators and Expressions | Very likely86% | 10 | 11%5 lecture hrs | Balancedexam 11% · syllabus 11% | Rising | 1 recurring7 total | |
| 5 | U9Structure and Union | Very likely86% | 7.5 | 9%4 lecture hrs | Balancedexam 9% · syllabus 9% | Rising | none repeat7 total | |
| 6 | U8Pointers | Likely71% | 9 | 9%4 lecture hrs | Balancedexam 9% · syllabus 9% | Steady | 1 recurring6 total | |
| 7 | U1Introduction | Very likely86% | 5.8 | 9%4 lecture hrs | Balancedexam 7% · syllabus 9% | Steady | 1 recurring5 total | |
| 8 | U2Elements of C | Likely71% | 8 | 9%4 lecture hrs | Balancedexam 8% · syllabus 9% | Steady | 1 recurring6 total | |
| 9 | U3Input and Output | Likely71% | 5 | 7%3 lecture hrs | Balancedexam 5% · syllabus 7% | Steady | 1 recurring3 total | |
| 10 | U10File Handling | Likely57% | 6.2 | 4%2 lecture hrs | Balancedexam 5% · syllabus 4% | Steady | none repeat4 total |
Study smart, not hard
Drag the slider: studying the top 7 units in priority order covers ~83% of all observed marks.
- ~80% line
Lecture time vs exam marks
Where the exam pays more than the curriculum spends: ● lectures vs ● exam marks, as a share of the whole course. A long teal-leading bar = high-yield unit.