Search Header Logo

C Programming: if-then-else Quiz

Authored by joel borah

Computers

12th Grade

Used 1+ times

C Programming: if-then-else Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the use of else if statement in C programming.

It is used to declare a variable in C programming

It is used to end the program in C programming

It is used to repeat a block of code in C programming

It is used to check multiple conditions and execute a different block of code for each condition.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the conditional operator in C?

To make a decision based on a condition

To define functions

To create loops

To perform mathematical calculations

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is my result?
mickey = mouse                                   .
if mickey == mouse:                           .
.            print("Mickey is a mouse")
.else:                                                             .
.         print("Minnie rules")        .


'Mickey is a mouse"

"Minnie Rules"

Nothing is printed

"Mickey is a mouse and Minnie rules"

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is my result?
john = 6                                                                        .
if john != 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
.      print("John is getting grapes")



John is getting ice cream
John is getting grape

John is getting apple juice

John is getting apple juice
John is getting grapes

John is getting ice cream

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is an "ELSE" statement?

Assigns a value to a variable

Adds another command the code will execute


A function that is performed if the "if" statement is not satisfied

Runs the statement coded if anything else in the code does not run as anticipated.


6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the conditional operators used in if-else statements in C programming?

print, scan, loop

+, -, *, /

==, !=, >, <, >=, <=

&&, ||, !

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you use the '==' operator in an if-else statement in C?

To compare two values for equality in a conditional statement.

To check if a variable is initialized in an if-else statement

To perform addition in an if-else statement

To print a message in an if-else statement

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?