Search Header Logo

computer quiz

Authored by PDCS Server

Computers

12th Grade

Used 2+ times

computer quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

37 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of an if statement in C++?

To execute a block of code repeatedly
To make decisions and execute a block of code conditionally
To perform arithmetic operations
To declare variables

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax for an if statement in C++?

if condition {}
if (condition) {}
if: condition {}
if [condition] {}

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How does an if statement determine which code block to execute?

By comparing values
By looping through statements
By evaluating a condition to true or false
By checking data types

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In C++, what will the following code print if x is 5? if (x > 0) cout << "Positive";

Positive
Nothing
Syntax error
Negative

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What keyword is used to specify an alternative block of code in an if statement when the condition is false?

else
elseif
alternative
or

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly checks if x is not equal to 0 in an if statement?

if (x == 0)
if (x != 0)
if (x >= 0)
if (x <= 0)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this code snippet if x is 5 and y is 10? if (x > y) cout << "X"; else cout << "Y";

X
Y
X and Y
Syntax error

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?