Skip to content

Structured Programming

SWE · Midterm · Spring 25

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

Read the questions as text

Read off the PDF by AI, so it may have mistakes. The PDF is the original.

Daffodil International University Department of Software Engineering Faculty of Science & Information Technology Midterm Examination, Spring 2025 Course Code: SE 121; Course Title: Structured Programming Sections & Teachers: MTK(A, B), SA(C), SCS(D, E), AHZ(F, G) MSA(II), MR(I, J, M), JIC(K, L), MSSS(N), ST(O), MRN(P), NML(Q) 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) Explain the output of the following expressions. | [Marks-5] | CLO-1 Level-2 (i) int x = 5; int y = x++ + 3; printf("%d", y); (ii) x = (5 < 8 && 15 > 8) || 5 = 5; printf("%d", x); b) Observe any errors in the following code and rewrite it with the necessary modifications. | [Marks-5] | CLO-1 Level-2 (i) #include <stdio.h> int main() { int x = 5; float y = 3.14; y = x * y; printf("Multiplication: %.2f\n", y); return 0; } (ii) #include <stdio.h> int main() { int a = 3; a-; printf("%2d\n", result); return 0; } 2. a) Suppose you are tasked with developing a feedback system for a school based on the student's grades. The system will provide feedback for each grade (A-D) as follows: A: Excellent work! B: Good job! C: You passed, but there's room for improvement. D: You need to work harder. Construct a C program based on the above scenario using a switch-case statement. | [Marks-5] | CLO-2 Level-3 b) One of your friends goes Eid shopping and receives money from his father, mother, and brother. He plans to buy clothes and can pay either in cash or through mobile banking. If he chooses cash payment, he pays the full amount with no discount. However, if he pays using mobile banking, he gets a 15% discount on his total purchase. Code a C program that takes input for the amount received from the father, mother, and brother, the purchase amount, and the payment method (1 for Mobile Banking, 0 for Cash). The program should calculate and display the total money available, the final amount after applying the discount (if any), and the remaining money after shopping. Sample Input | Sample Output Enter money from father: 2500 | Total Money Avail of able: 4000 Enter money from mother: 1000 | Final Purchase Amount After 15% Discount: 2550 Enter money from brother: 500 | Remaining Money: 1450 Enter purchase amount: 3000 | Enter payment method (1 for Mobile Banking, 0 for Cash): 1 | [Marks-5] | CLO-2 c) A person is planning to go abroad for higher studies and needs to save money for travel expenses. He decides to save a fixed amount every month and wants to track his savings over time. Given the starting balance (initial savings), the monthly savings amount, and the number of months, Sample Input | Sample Output Enter starting balance: 1000 | Month 1: Total Savings = 1300 Enter monthly savings amount: 300 | Month 2: Total Savings = 1600 Enter the number of months: 4 | Month 3: Total Savings = 1900 | Month 4: Total Savings = 2200 Build a C program to calculate and print the total savings at the end of each month using a for loop. | [Marks-5]