Welcome to your C++ Level 3

1. 
What is the error in this code?

int main() {

    int x;

    cout << "The value of x is " << x;

    return 0;

}

2. 
What is the error in this code?

```cpp

int main() {

    int x = 10;

    x++;

    x += 5;

    return 0;

}

3. 
What is the error in this code?

```cpp

int main() {

    int x;

    int y = 0;

    int z = x / y;

    return 0;

}

4. 
What is the error in this code?

```cpp

int main() {

    int arr[5];

    for (int i = 0; i <= 5; i++) {

        arr[i] = i;

    }

    return 0;

}

5. 
What is the error in this code?

```cpp

int main() {

    int* ptr;

    *ptr = 42;

    return 0;

}

6. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    if (x == 5) {

        int x = 10;

    }

    cout << "x is " << x;

    return 0;

}

7. 
What is the error in this code?

```cpp

int main() {

    int x;

    cin >> x;

    if (x < 0)

        cout << "x is negative";

    else if (x > 0)

        cout << "x is positive";

    return 0;

}

8. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int y = 0;

    int z = x / y;

    return 0;

}

9. 
What is the error in this code?

```cpp

int main() {

    int* ptr;

    int x = *ptr;

    return 0;

}

10. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    delete ptr;

    return 0;

}

11. 
What is the error in this code?

```cpp

int main() {

    char str[] = "Hello, world!";

    str[0] = 'h';

    cout << str;

    return 0;

}

12. 
What is the error in this code?

```cpp

int main() {

    int x = 10;

    int& ref = x;

    int y = ref;

    cout << "x is " << x << ", y is " << y;

    return 0;

}

13. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    int* another_ptr = ptr;

    delete ptr;

    cout << *another_ptr;

    return 0;

}

14. 
What is the error in this code?

```cpp

int main() {

    int arr[5];

    arr[5] = 42;

    return 0;

}

15. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    *ptr = 10;

    cout << "x is " << x;

    return 0;

}

16. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int& ref = x;

    int* ptr = &ref;

    *ptr = 42;

    cout << "x is " << x;

    return 0;

}

17. 
What is the error in this code?

```cpp

int main() {

    int x;

    cin >> x;

    if (x < 0) {

        cout << "x is negative" << endl;

    }

    else {

        cout << "x is positive" << endl;

    }

    cout << "x is " << x;

    return 0;

}

18. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int y = 10;

    int z = x / y;

    cout << "z is " << z;

    return 0;

}

19. 
What is the error in this code?

```cpp

int main() {

    int* ptr = new int;

    delete ptr;

    int x = *ptr;

    return 0;

}

20. 
What is the error in this code?

```cpp

int main() {

    int arr[5];

    arr[5] = 42;

    cout << arr[5];

    return 0;

}

21. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    int y = ptr;

    cout << "x is " << x << ", y is " << y;

    return 0;

}

22. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    cout << "x is " << *ptr << ", y is " << *ptr2;

    return 0;

}

23. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int& ref = x;

    int y = ref;

    ref = 10;

    cout << "x is " << x;

    return 0;

}

24. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    *ptr = 10;

    cout << "x is " << x;

    delete ptr;

    return 0;

}

25. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int y = 10;

    int& ref = x;

    ref = y;

    cout << "x is " << x;

    return 0;

}

26. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int& ref = x;

    int* ptr = &ref;

    int y = *ptr;

    cout << "x is " << x << ", y is " << y;

    return 0;

}

27. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int y = 10;

    int* ptr = &x;

    *ptr = y;

    cout << "x is " << x;

    return 0;

}

28. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int& ref = x;

    int* ptr = &x;

    ref = 10;

    cout << "x is " << *ptr;

    return 0;

}

29. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    delete ptr;

    cout << "x is " << x;

    return 0;

}

30. 
What is the error in this code?

```cpp

int main() {

    int x = 5;

    int* ptr = &x;

    int* another_ptr = ptr;

    delete ptr;

    cout << "x is " << *another_ptr;

    return 0;

}