JavaScript Conditional Statements Flashcard

JavaScript Conditional Statements Flashcard

Assessment

Flashcard

Computers

12th Grade

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

15 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What will the following code output?
```javascript
if (5 > 3) {
console.log("Yes");
} else {
console.log("No");
}
```

Back

Yes

2.

FLASHCARD QUESTION

Front

Consider the code snippet below. What will be the output?
```javascript
let age = 18;
if (age > 18) {
console.log("Adult");
} else if (age == 18) {
console.log("Just turned adult");
} else {
console.log("Not an adult");
}
```

Back

Just turned adult

3.

FLASHCARD QUESTION

Front

What does the following code print?
```javascript
let x = 10;
if (x > 5) {
if (x < 15) {
console.log("Yes");
}
} else {
console.log("No");
}
```

Back

Yes

4.

FLASHCARD QUESTION

Front

Which of the following is true about the `else` statement in JavaScript? Options: It executes a block of code if the condition in the `if` statement is true., It can appear without an `if` statement., It executes a block of code if the condition in the `if` statement is false., It can only be used once in an `if-else` chain.

Back

It executes a block of code if the condition in the `if` statement is false.

5.

FLASHCARD QUESTION

Front

How many times can `else if` statements be used in an `if-else` chain?

Back

As many times as needed

6.

FLASHCARD QUESTION

Front

What will the following code snippet output?
```javascript
let score = 75;
if (score >= 90) {
console.log("A");
} else if (score >= 80) {
console.log("B");
} else if (score >= 70) {
console.log("C");
} else {
console.log("F");
}
```

Back

C

7.

FLASHCARD QUESTION

Front

What is the output of the following code?
```javascript
let num = 20;
if (num > 15) {
console.log("Greater");
} else if (num == 20) {
console.log("Equal");
} else {
console.log("Lesser");
}
```

Back

Greater

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?