Search Header Logo

Control Statements

Authored by Shivanthana 2909

Information Technology (IT)

University

Used 8+ times

Control Statements
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

A smartwatch needs to alert the user when the battery drops below 20%. Which control statement should be used?

Switch-case

for loop

if-else

do-while

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A game controller must perform different actions when different buttons are pressed (A = Jump, B = Crouch, etc.). What is the best control structure?

if-else

nested loops

switch-case

break

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int x = 5;

if (x > 3)

printf("Hello");

else

printf("Bye");

Hello

Bye

error

No output

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You’re building an automation system for a smart air conditioner. Based on temperature input, it decides to turn the fan ON or OFF. What would you use?

switch-cse

if-else

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

if condition then { } else { }

if (condition) { } else { }

if {condition} then { } else { }

if condition: { } else: { }

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT true about the switch-case statement in C?

It can evaluate expressions like x > 10

It uses case labels for matching values

It can replace lengthy nested if-else structures

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You are designing a coffee machine. It should display different prices based on size (S, M, L). Which control is most appropriate?

if-else with relational operators

for loop with size check

switch-case with character input

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?