C Programming: if-then-else Quiz

C Programming: if-then-else Quiz

12th Grade

8 Qs

quiz-placeholder

Similar activities

Python Beginners Week 6

Python Beginners Week 6

3rd - 12th Grade

13 Qs

C++ Recursion

C++ Recursion

8th - 12th Grade

12 Qs

Artificial Intelligence Quiz Online

Artificial Intelligence Quiz Online

8th Grade - University

10 Qs

CSP-Selection and Iteration

CSP-Selection and Iteration

9th - 12th Grade

10 Qs

U3: [Assess] L14-L17 Code.org

U3: [Assess] L14-L17 Code.org

9th - 12th Grade

9 Qs

Thinking Logically (1)

Thinking Logically (1)

12th Grade

10 Qs

CodeHS Unit 1-6

CodeHS Unit 1-6

9th - 12th Grade

12 Qs

C Programming: if-then-else Quiz

C Programming: if-then-else Quiz

Assessment

Quiz

Computers

12th Grade

Hard

Created by

joel borah

Used 1+ times

FREE Resource

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

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you write an if-else statement with multiple conditions in C?

Separate each condition with a comma in the if-else statement in C.

Use the 'end if' keyword to add multiple conditions in an if-else statement in C.

Use the 'else if' keyword to add multiple conditions in an if-else statement in C.