Skip to content

Programming and Problem Solving

CSE · Quiz · Fall 26

Paper 9 of 9Section 72_K · Batch 72 · Ahnaf Tajwar (2)Switch

Section 72_K · Batch 72 · shared by Ahnaf Tajwar

Paper 9 of 9

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 and Engineering Quiz-03(72_K) Course Code: CSE113, Course Title: Programming and Problem solving Time: 30 minutes Marks: 15 1. Solve the problem. 6 i) Find the error line and write the corrected version of the error line 1. #include <stdio.p> 2. int main() 3. { 4. int original[5] = {10, 20, 30, 40, 50, 60}; 5. int reversed[5] = {0}; 6. int size = 5; 7. for (int i = 0; i <= size; i++) 8. { 9. reversed[size - 1 - i] = original[i]; 10. } 11. printf("Reversed array: "); 12. for (int i = 0; i < Size; i++) 13. { 14. printf("%d ", reversed); 15. } 16. printf("\n"); 17. return 0; 18. } ii) Find the output 1. #include <stdio.h> 2. int main() 3. { 4. int grid[3][3] = { 5. {1, 2, 3}, 6. {4, 5, 6}, 7. {7, 8, 9} 8. }; 9. for (int i = 0; i < 3; i++) 10. { 11. grid[i][i] = grid[i][i] * 2; 12. } 13. for (int j = 0; j < 3; j++) 14. { 15. grid[2][j] = grid[2][j] - grid[0][j]; 16. } 17. printf("Final Grid:\n"); 18. for (int r = 0; r < 3; r++) 19. { 20. for (int c = 0; c < 3; c++) 21. { 22. printf("%d ", grid[r][c]); 23. } 24. printf("\n"); 25. } 26. return 0; 27. } 2. Once upon a time in the digital kingdom of Byteville, a massive delivery of numbered packages arrived at the grand warehouse. The Chief Inspector was given a crucial mission: find the lightest package (the minimum) to load onto the drone first, and the heaviest package (the maximum) to make sure it wouldn't break the delivery truck. Instead of opening every package at once, the Inspector lined up all N packages in a row and scanned them one by one, keeping track of the smallest and largest numbers seen so far. By the time the Inspector reached the end of the line, the mystery was solved! 4 Input: 5 12 45 2 91 34 Output: Minimum Element: 2 Maximum Element: 91 3. The Chief Inspector of Byteville faced a new challenge. The grand warehouse was cluttered with duplicate packages. To save space, the Inspector needed to find and print only the unique packages—the ones that appeared exactly once in the entire delivery line. By keeping a tally of how many times each package number appeared, the Inspector quickly filtered out the duplicates. 5 Input: 7 4 5 4 8 5 1 2 Output: Unique Elements: 8 1 2