Skip to content

Programming and Problem Solving

CSE · Final · Spring 26

Paper 1 of 2Batch 70 · Shaker AbdullahSwitch

Batch 70

Paper 1 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 Computer Science & Engineering Final Examination, SPRING 2026 Course Code: CSE113, Course Title: Programming and Problem Solving Level: 1 Term: 2 Batch: 70 Time: 02:00 Hrs Marks: 40 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 Identify the errors in the following code? Explain the errors and reasons why you think they are errors. | 03 #include<stdio.h> int add(int *x, int *y) { *x = *x + y; } char string(char a[]) { (a+1)='B'; printf("%c\n", a); } int main() { int a = 7, b = 8; add(b, &a); int result = fact(a+8); printf("The result is %d\n", b**); char s[100] = "Hello"; string(s+1); } 1. b Rewrite the code without any errors. | 03 2. a Generate the output of given codes below (write only the output segment in a box): | 03 #include <stdio.h> void track(int n) { if(n == 5) return; printf("%d ", n); if(n == 0) return; track(n - 1); printf("%d ", ++n); } int main() { track(3); } 2. b | 03 + #include<stdio.h> int spFunction(int N) { int i, space, j; for (i = 1; i <= N; i++) { for (space = 1; space <= N - i; space++) { printf(" "); } for (j = 1; j <= (2 * i - 1); j++) { printf("Z"); } printf("\n"); } } int main() { spFunction(3); } 2. c | 03 #include <stdio.h> void date(int a, int *b) { a = a * 2; *b = a + *b; } void add(int *x, int y) { int temp = *x + 1; *x = y - 1; y = temp; } int main() { int a = 5, b = 3; date(a, &b); printf("%d %d\n", a, b); add(&a, b); printf("%d %d\n", a, b); } 3. a Construct a complete C program based on the following scenario of each problem statement. | 05 Mushfiq and Tanvir have been waiting eagerly to watch the blockbuster movie "Bonolota Express". The theatre authority has designed a smart seating system where each seat is marked with a number: 0 -> Seat is open for sale 1 -> Seat is already booked 2 -> Seat is reserved Since Mushfiq and Tanvir are inseparable best friends, they want to sit side by side in the same row. If they can find two adjacent open seats, they'll cheerfully go for the show. Otherwise, they'll skip this screening and wait for the next one. The theatre hall is square-shaped, meaning the number of rows equals the number of columns. Your task is to determine whether they can sit together. Input: - First line: An integer n representing the number of rows and columns. - Next n lines: Each line contains n integers (0, 1, or 2) representing the seating arrangement. Output: - Print "Letssss Goooo" if Mushfiq and Tanvir can sit together. - Otherwise print "Skip for next show" Sample Input | Sample Output 5 | Letssss Goooo 1 0 1 0 1 | 0 2 1 0 2 | 1 1 1 1 1 | 0 0 1 1 0 | 1 2 2 1 1 | 3. b Before entering the hall to watch Bonolota Express, Mushfiq and Tanvir buy a large bucket of popcorn. Being playful best friends, they decide to toss a coin to decide who eats first: If the toss result is H, Mushfiq wins and eats first. If the toss result is T, Tanvir wins and eats first. After that, they eat alternately, one handful at a time. Your task is to write a recursive function that takes the current turn number and prints who is eating. The process continues for 5 turns. YOU MUST WRITE RECURSIVE FUNCTION TO SOLVE THIS Input: - Only Line containing a character ‘H’ or ‘T’ Output: - In each turn, print who is currently enjoying the popcorn by printing either "Mushfiq eats" or "Tanvir eats" Sample Input | Sample Output T | Tanvir eats | Mushfiq eats | Tanvir eats | Mushfiq eats | Tanvir eats 3. c After the movie ended, a group of journalists gathered outside the cinema hall. They were eager to capture the audience's impressions and asked the expectators to share their favourite character from the film. The choices included: RashidUddin, Chittra, DrAshab, AbulKhayerKhan, Afia, and Nitu. Among the crowd, Mushfiq and Tanvir were interviewed. Your task is to determine whether their preferences align or differ. If both selected the same favourite character, print: "Their taste of choice is the same". If they chose different characters, print: "We believe in diversity". N.B don't use builtin functions like strcmp for string comparison. Input: - The first line contains Mushfiq's favourite character(string), second line contains Tanvir's favourite character(string) Output: - Print "Their taste of choice is same" or "We believe in diversity" according to the condition. Sample Input | Sample Output RashidUddin | We believe in diversity Dr.Ashab | 3. d After finishing the screening of Bonolota Express, the hall authority invited the audience to share their opinions by giving a rating on a scale of 1 to 10. Every person seated in the hall submitted their rating, and the management decided to calculate the average rating to guide their decision: If the average rating is strictly greater than 8.75, they will increase the number of shows for this movie. Otherwise, they will conclude that there is no need for an extra show. Input: - The first line contains two integers representing the number of rows and columns (the seating arrangement). - The next n lines each contain n integers, where each integer represents the rating (from 1 to 10) given by the person sitting in that position. Output: - "Increase a Show" if the average rating is strictly greater than 8.75. "No need for an extra show" otherwise. Sample Input | Sample Output 5 | Increase a Show 7 10 10 10 9 | 10 7 8 8 9 | 10 10 10 10 10 | 10 10 8 10 9 | 10 9 9 10 10 | 3. e After stepping out of the cinema hall, Mushfiq and Tanvir began discussing which movie they would like to watch during the joyous occasion of Eid. Curious about the current lineup, they checked the list of films running in the hall. To organize this information, define an array of 5 structures named movies, where each movie has the following details: ID (integer), Name (string), Duration (integer, in minutes), Language (string). Since Mushfiq and Tanvir are particularly interested in the shortest movie—the one with the minimum duration—your task is to filter the list and print only the names of the movie(s) whose duration is the minimum. Input: - There will be 5 lines of input. - Each line contains: ID Name Duration Language Output: - Print the name of each movie that has the minimum duration, each on a new line. Sample Input | Sample Output 1 Domm 125 Bangla | Rakkhosh . 2 Rakkhosh 120 Bangla | Prince 3 Prince 120 Bangla | 4 PressureCooker 130 Bangla | 5 TheSuperMarioGalaxy 140 English |