MINIA UNIVERSITY

Faculty of Science - Computer Science Dept.

Computer (1) Final Exam | 2024/2025

👋 Welcome, Eng. Ahmed Anwar (ABO ANWER)
Progress 0 / 25
Score 0%

Part I: Multiple Choice Questions

Part II: Code Correction & Analysis

Written
Analyze the following C++ code snippet. It contains multiple syntax and logic errors. Rewrite the correct version of the code in the box below.
int x=10.2 y=z0,    // Line 1
int x=x+y           // Line 2
if(z=f)             // Line 3
Cout <<"Zero";      // Line 4
int s-20+10;        // Line 5

Model Answer:

int x = 10;
int y = 0; // Assuming value
x = x + y; 
if (x == 0) {
    cout << "Zero";
}
int s = 20 + 10;