Search Header Logo

Selection Statement

Authored by Maznah Ahmad

Computers

Vocational training

Used 1+ times

Selection Statement
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is used to execute a block of code only if a condition is true?

for

while

if

do-while

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? int mark = 75; if (mark >= 50) cout << "Pass"; else cout << "Fail";

Fail

Pass

75

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which selection statement is suitable when selecting one option from many choices based on a variable value?

if

nested if

switch

while

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for an if...else statement?

if (condition) statement; else statement;

if condition statement;

if {condition} statement;

if condition then statement;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? int x = 10; if (x > 5) cout << "A"; if (x > 8) cout << "B";

A

B

AB

Nothing

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is TRUE about nested if statements?

It is not allowed in C++

It can only have two levels

An if statement inside another if statement

It is the same as switch

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the break statement in a switch-case?

To stop the program

To skip the case

To exit the switch block

To repeat the case

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?