Search Header Logo

JavaScript Conditionals

Authored by Rommel Terante

Computers, Professional Development

8th - 12th Grade

Used 16+ times

JavaScript Conditionals
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

1 min • 1 pt

If isHungry equals true, which of the following expressions evaluates to true?

!isHungry

isHungry === false

!isHungry === true

isHungry !== false

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the code block log to the console?


let needTacos = true;


if (needTacos) {

console.log("Finding tacos");

} else {

console.log("Keep on keeping on!");

}

Keep on Keeping on!

Finding tacos

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the general purpose of a conditional statement?

Conditional statements answer binary (yes-or-no) questions.

Conditional statements evaluate code as either true or false

Conditional statements make all computers capable of thought.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the code block log to the console?


let weather = "spring";

let clothingChoice = "";


if (weather === "spring") {

clothingChoice = "Put on rain boots.";

} else if (weather === "summer") {

clothingChoice = "Make sure to take your sunscreen.";

} else if (weather === "fall") {

clothingChoice = "Wear a light jacket.";

} else if (weather === 'winter') {

clothingChoice = "Wear a heavy coat.";

} else {

console.log('Invalid weather type.');

};

console.log(clothingChoice);

Put on rain boots.

Wear a light jacket.

Make sure to take your sunscreen.

Wear a heavy coat

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the code block log to the console?


let groceryItem = "apple";


switch (groceryItem) {

case "tomato":

console.log("Tomatoes are $0.49");

break;

case "lime":

console.log("Limes are $1.49");

break;

case "papaya":

console.log("Papayas are $1.29");

break;

default:

console.log("Invalid item");

break;

}

Tomatoes are $0.49

Limes are $1.49

Papayas are $1.29

Invalid Item

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the code block log to the console?


let runTime = 35;

let runDistance = 3.5;

if (runTime <= 30 && runDistance > 3.5) {

console.log("You're super fast!");

} else if (runTime >= 30 && runDistance <= 3) {

console.log("You're not making your pace!");

} else if (runTime > 30 || runDistance > 3) {

console.log("Nice workout!");

} else {

console.log("Keep on running!");

}

Keep on running!

You're super fast!

You're not making your pace!

Nice workout!

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following variables contains a truthy value?

let varTwo = false;

let varOne = 'false';

let varThree = 0;

let varFour = '';

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?