Search Header Logo

Butula TVC DICT II Object Oriented programming Quiz

Authored by Andrew Wakoli

Other

University

Used 2+ times

Butula TVC DICT II Object Oriented programming Quiz
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 • 3 pts

What is the purpose of decision-making statements in programming?

To define variables

To create loops in the program

To specify conditions for code execution

To execute code without conditions

2.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

What does the 'if' statement in C++ require?

A boolean expression and a loop

A boolean expression and one or more statements

A boolean expression and a single statement

Only a boolean expression

3.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

What will happen if the boolean expression in an 'if' statement evaluates to false?

The program will terminate

The code inside the 'if' block will execute

The code after the 'if' statement will execute

The 'else' block will execute

4.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

In an 'if...else' statement, what does the 'else' block do?

Is optional and can be omitted

Always executes regardless of the condition

Executes when the 'if' condition is true

Executes when the 'if' condition is false

5.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

What is the output of the following code if the input is -5? 'if (X > 0) { Z = X + 10; } else { Z = 2 * X + 50; }'

Z = 0

Z = 40

Z = -10

Z = 10

6.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

What does the switch statement allow a programmer to do?

Handle exceptions

Define functions

Create loops

Choose between multiple alternatives based on an expression

7.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

In the switch statement, what does the 'default' case represent?

A case that always executes

A case that executes if no other cases match

The last case in the switch

The first case in the switch

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?