Structured Programming
SWE · Midterm · Fall 26
Section E · Batch 48
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Software Engineering
Midterm Examination, Fall 2026
Course Code: SE 121; Course Title: Structured Programming
Sections & Teachers: A, B, C (SCS), D, E (MR), F (MTC), G, H, I (SI), J (AAAS), K (SD), L (MIS), M (RRB), N, O (MHM)
Time: 1 Hour 30 Mins Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. a) Differentiate the inappropriate variable names from the following examples and describe the reason. [Marks-5, CLO-1 Level-2]
num, id_09, auto, _roll_, if_else, student ID, temp, count, return0, id#09, MyName, 23_employeeID, int_a, float_b, register, int_main
2. a) A student wants to plan a dream vacation and has four destinations to choose from. The following table shows the estimated cost per day for each destination.
Choice | Destination | Cost per Day(BDT)
1 | Sajek, Bangladesh | 3,000
2 | Niagara Falls, Canada | 15,000
3 | Glass Bridge of China | 10,000
4 | Light Museum of Tokyo, Japan | 12,000
Build a C program using a switch-case that takes the student's destination choice and the total number of tour days as input. The program should calculate and display the total tour expense based on the selected destination and number of days. If the student enters an invalid choice, display an appropriate error message. [Marks-5, CLO-2 Level-3]
b) A user enters a single character. The program should perform the following tasks using conditional statements: [Marks-5]
1. Identify whether the entered character is an alphabet, a digit or a special character.
2. If the character is an alphabet, determine whether it is an uppercase or lowercase letter.
3. If the character is a digit, determine whether it is even or odd.
Construct a character classification program by writing a C program using if-else conditional statements. Display the appropriate classification information for the entered character.
Sample Input | Sample Output
Enter a character: A | The character is an Alphabet. It is an Uppercase letter.
Enter a character: 8 | The character is a Digit. It is an Even digit.
3. a) A student wants to keep track of the assignments completed over several academic semesters. The student completes 5 assignments in every even-numbered semester and 3 assignments in every odd-numbered semester. The student will input the total number of semesters.
Build a C program using a loop to calculate and display the total number of assignments completed after each semester. [Marks-5]
Sample Input | Sample Output
Enter number of semesters: 4 | Total Assignments in Semester 1 = 3
Total Assignments in Semester 2 = 8
Total Assignments in Semester 3 = 11
Total Assignments in Semester 4 = 16
b) [Marks-5, CLO-3 Level-3]
#include<stdio.h>
int main() {
int i, j, result;
for (i = 1; i <= 3; i++) {
for (j = 1; j <= 3; j++) {
if (i + j <= 4){
result = i * 2;}
else{
result = i + j;}
printf("%d ", result);
}
printf("\n");
}
return 0;
}
Trace the nested loop and write down the values of i, j and result at each iteration.