Cookie policy · You can change your choice at any time on the page „Cookies“.

Accessibility

Text size
Read aloud

Your browser reads the text with the voice it has for this language.

Accessibility statement

Quiz

Computer science I: Selection with two options

10 computer science questions for year 1, following the national curriculum: comparison and logical expressions, if-else, statement block, nesting.

Choose the right answer for each question. When you finish, click Check answers and read the explanations.

1. What does this show: int x = 7; if (x > 5) cout << "YES"; else cout << "NO";

2. Which C++ operator means “is equal to” in a comparison?

3. What does the != operator mean?

4. When is (a > 0 && a < 10) true?

5. When is (x < 0 || x > 100) true?

6. What is !(x > 3) if x = 5?

7. What is a statement block in C++?

8. What does this show: int b = 4; if (b % 2 == 0) cout << "E"; else cout << "O";

9. What does nesting if statements mean?

10. What does this show: int t = 0; if (t > 0) cout << "+"; else if (t < 0) cout << "-"; else cout << "0";