Understanding JavaScript Conditionals

Understanding JavaScript Conditionals

10th Grade

8 Qs

quiz-placeholder

Similar activities

C# 11

C# 11

1st - 10th Grade

10 Qs

ANTARES Workshop - IoT Knowledge

ANTARES Workshop - IoT Knowledge

1st Grade - Professional Development

10 Qs

10° Bimestral informática 3° periodo

10° Bimestral informática 3° periodo

10th Grade

10 Qs

Access

Access

10th Grade - University

11 Qs

Mrs O's Computer Architecture Quiz

Mrs O's Computer Architecture Quiz

KG - University

13 Qs

Robot_Quiz

Robot_Quiz

9th - 12th Grade

12 Qs

KD-3 & 4 Dasar Pemrograman Mikroprosesor dan Mikrokontroler

KD-3 & 4 Dasar Pemrograman Mikroprosesor dan Mikrokontroler

10th Grade

11 Qs

Understanding JavaScript Conditionals

Understanding JavaScript Conditionals

Assessment

Quiz

Computers

10th Grade

Medium

Created by

Radeyyah Hossain

Used 2+ times

FREE Resource

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the boolean value of the expression `5 > 3` in JavaScript?

`true`

`false`

`undefined`

`null`

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is the correct syntax for an if statement in JavaScript?

`if x > 5 then { console.log(x); }`

`if (x > 5) { console.log(x); }`

`if x > 5: { console.log(x); }`

`if (x > 5) then { console.log(x); }`

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code snippet? ```javascript let isRaining = false; if (isRaining) { console.log("Take an umbrella."); } else { console.log("No need for an umbrella."); } ```

`Take an umbrella.`

`No need for an umbrella.`

`undefined`

`isRaining`

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a boolean data type in JavaScript?

`0`

Yes

`true`

`1`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code: ```javascript let temperature = 30; if (temperature > 25) { console.log("It's hot outside."); } else { console.log("It's not that hot."); } ``` What will be printed to the console?

`It's hot outside.`

`It's not that hot.`

`undefined`

`null`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of an else statement in JavaScript?

To execute code when the if condition is true

To execute code when the if condition is false

To declare a variable

To create a loop

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you write an 'if' statement in JavaScript?

if (condition) // code block

if [condition] { // code block }

if (condition) { // code block }

if (condition) { /* code block */ }

Answer explanation

In JavaScript, the correct way to write an 'if' statement is: if (condition) { // code block }

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Greater than or equal to

> or =

> || =

>=

<=