Professional Documents
Culture Documents
Part 1: DEBUGGING
Instructions (Total Points: 5)
- Use Dev C++ to identify semantic and logical errors in the given program below and correct them.
- Fill-up the table by writing the incorrect program statement at the first column (A) and the correct one at the
second column (B).
- There will be 5 errors in the given program worth 1 point each.
- If there are more than 1 error in a single statement that is considered as 1 answer.
1. #include <iostream>
2. #include <stdio.h>
3. using std:: ;
4. const char = STAR = '*';
5. const int PRIME = 71;
6. int main {
7. int count, sum;
8. double x;
9. count = 1;
10. sum = count + PRIME;
11. x = 25.67;
12. newNum = count * 3;
13. sum + count = sum;
14. sum++;
15. x = x + sum * count;
16. sum += 3;
17. cout << " count = " << count << ", sum = " << sum;
18. cout << ", PRIME = " << Prime << endl;
19. }
Line
S No. A – Incorrect Program statement B. Correct Program statement
No.
1.
2.
3.
4.
pg. 1
CS120 | Practical Final Exam
5.
Part 2: PROGRAMMING (Total Points: 10)
Instructions
- Paste your code for each programming problem in the first row, and program execution screenshot in the
second column.
Q1) Programming Problem 1 - File Name: Riyal_change.cpp (5 pts.)
Write a C++ program to calculate the number of coins of Riyal, Nus, Rubo, Qirish, Halala
will be required for the assigned amount.
Test your solution with sample output:
pg. 2
CS120 | Practical Final Exam
pg. 3
CS120 | Practical Final Exam
pg. 4