Skip to content

Structured Programming

SWE · Midterm · Summer 25

Paper 2 of 2Batch 44Switch

Batch 44

Paper 2 of 2

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 Faculty of Science & Information Technology Department of Software Engineering Midterm Examination - Summer 2025 Course Code: SE 121; Course Title: Structured Programming Sections & Teachers: All (MAK, ZNM, MR, JIC, SCS, AHZ, KFH, AF) Time: 1.5 Hours 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) Interpret the output of the program and explain the change of values in each steps. [Marks-4] [CLO-1, Level-2] #include <stdio.h> int main() { int a=10, b=5,c,d; c = a++; d = --b; b = --c; printf("%d\n", a); printf("%d\n", b); printf("%d\n", c); printf("%d\n", d); return 0; } 1. b) Rewrite both programs in a correct and compilable form. [Marks-6] [CLO-1, Level-2] i) | ii) #include<stdio.h> | #include <stdio.h> Include <math.h> | #define PI 3.14 int main { }( | int main(){ DOUBLE X; | int length=10, width = = 5; X = 8.5; | float area; Y = pow(x); | area = length * width; printf("%f %f\n ",X,Y); | printf("The area of rectangle is: %c\n", area); return 0; | return 0; ) | } 2. a) Suppose you are a passionate developer and you have told to design a simple restaurant recommendation system that suggests dishes based on the time of day as follows: • If the time is between 6 AM and 11 AM - Recommendation is “Pancakes and Coffee” • If the time is between 12 PM and 3 PM - Recommendation is “Chicken Salad” • If the time is between 4 PM and 6 PM - Recommendation is “Samosa and Chai” • If the time is between 7 PM and 10 PM - Recommendation is “Grilled Steak” Solve this logic by writing a program using the C programming language. [Marks-4] [CLO-2, Level-3] 2. b) Suppose you are tasked to construct a C program that uses a switch-case to calculate the area of a shape based on user choice: 1 = Circle, 2 = Square, 3 = Rectangle. The program should input the required dimensions and display the area. Handle invalid choices properly. [Marks-6] [CLO-2, Level-3] Sample Input | Sample Output Enter Choice: 1, | Area of Circle: 50.265 Enter Radius: 4 | Enter Choice: 2, | Area of Square: 16 Enter One Side: 4 | Enter Choice: 3 . | Area of Rectangle: 12 Enter Length: 4 | Enter Width: 3 | 2. c) You're helping a friend build a quirky mobile app called "Number Mirror" that shows how numbers would look if they were reflected in a magical mirror. As the backend developer, your task is to write a program that takes any positive integer as input and reverses its digits using only a loop. This reversed version is what the mirror would display. Construct a C program for the logic of the app. [Marks-5] [CLO2, Level-3] Sample Input: | Sample Output: Enter a number: 7081 | Mirror image: 1807