Search Header Logo

If else Statement

Authored by Stephanie Ramocan

Computers

6th Grade

If else Statement
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

What is the main use of booleans in an if statement in JavaScript?

As a loop condition

As a condition to execute code

To define a function

To declare a variable

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What must follow the if keyword in an if statement?

A semicolon

A boolean expression in parentheses

A string

A variable name

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if the condition in an if statement is false?

The program stops

Nothing, the code is not executed

The code inside the curly braces is executed

An error is thrown

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you execute some code if the condition of an if statement is false?

Include an else statement

Declare a new variable

Use a for loop

Use a while loop

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an else statement in an if-else statement do?

Executes code if the condition is true

Executes code if the condition is false

Checks another condition

Repeats the if statement

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the example, what message is printed if the 'is heads' variable is true?

It's tails, you lose

Nothing is printed

It's heads, you win

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What variable is used to determine if a user is logged in or not?

is heads

user status

login

logged in

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?