Search Header Logo

Unit 5 : Decision Control in C

Authored by Abhishek Pandey

Computers

University

Used 4+ times

Unit 5 : Decision Control in C
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int x = 2;

if (x > 3)

printf("Hello");

else

printf("World");

Hello

error

World

None

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the else block?

To execute when the if condition is true

To terminate the program

To execute when the if condition is false

None

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int x = 0;

if (x)

printf("True");

else

printf("False");

True

error

None

False

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many else if blocks can you have in an if-else if ladder?

Only one

Two

Any number

None

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a break statement in switch?

It breaks the program

It terminates the current block and exits the switch

It skips to the next case

None

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if a break statement is missing in a switch case?

The program will not compile

Only the default case executes

An infinite loop is created

Fall-through to the next case occurs

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?