Skip to content

Structured Programming

SWE · Final · Fall 24

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 Final Examination, Fall 2024 Course Code: SE 121; Course Title: Structured Programming Sections & Teachers: (A, I) NAN, (B, C) NT, (D, E, F) MR, (G, H) SCS, (J, K) NAL, (L) AP Time: 2: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) A person who loves to play matrix-based games has designed a new puzzle. In this game, a matrix represents the scores of players in different levels. The player wants to analyze the central elements of the game by focusing on the middle row and the middle column of the matrix. The challenge is to calculate the total score from these two central parts of the matrix, ensuring that the middle element, which is common to both the middle row and column, is not counted twice. To achieve this: - Input the size of the matrix (N x N), where N is an odd number. - Input the elements of the matrix. - Calculate the sum of the elements in the middle row and the middle column and print the result. For Example: 5 4 7 8 9 2 2 5 6 For the above matrix, Summation of the row's elements: 8 + 9 + 2 = 19 and summation of the column's elements: 4 + 9 + 5 = 18. So the output will be: Summation of the row's elements: 19 Summation of the column's elements: 18 Construct a C program based on the above scenario. [Marks-10] 1. b) Solve the problem of concatenating two strings and finding the length of the resulting string using C programming language. [Marks-10] Sample Input | Sample output Hello | Concatenated String: HelloWorld World | Length: 10 2. a) A software developer is working on a number analysis tool and wants to add a feature that calculates the sum of the digits of a given number. The developer decides to implement this feature using a user-defined function. [Marks-5] Sample Input | Sample Output 2887 | Summation of Digits: 25 192 | Summation of Digits: 12 Analyze the above scenario and write a C program to solve the problem. 2. b) Detect the area of a square and its perimeter using a user-defined function using C programming language. [Marks-7] Formula: Area of a square = side × side Perimeter of a square = 4 × side Sample Input | Sample Output 7 | Area: 49 | Perimeter: 28 2. c) Suppose you are making a program to create a simple calculator using user-defined functions for each arithmetic operation: addition, subtraction, multiplication, and division. For the division operation, use typecasting to ensure the result is displayed as a float. [Marks-8] Transform the above scenario into a C program.