Conditional Quiz

Conditional Quiz

3rd - 12th Grade

21 Qs

quiz-placeholder

Similar activities

Arduino Loop

Arduino Loop

2nd Grade - University

20 Qs

QUIZ BAB 4: SISTEM OPERASI

QUIZ BAB 4: SISTEM OPERASI

8th Grade - University

20 Qs

Informatika 1 Kelas 7

Informatika 1 Kelas 7

7th Grade

19 Qs

Input Units and Output Units

Input Units and Output Units

4th Grade

20 Qs

Sains Komputer Tingkatan 5 - 1.3.1 Menerangkan get logik

Sains Komputer Tingkatan 5 - 1.3.1 Menerangkan get logik

1st Grade - Professional Development

20 Qs

HTML Quiz

HTML Quiz

9th Grade

22 Qs

Module 11 - Essential Peripherals 4

Module 11 - Essential Peripherals 4

9th - 12th Grade

18 Qs

vocab review unit 1 term 2

vocab review unit 1 term 2

8th Grade

16 Qs

Conditional Quiz

Conditional Quiz

Assessment

Quiz

Computers

3rd - 12th Grade

Practice Problem

Easy

Created by

Donna Panter

Used 6+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

21 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is output by the code below?

var dogs = 4;

if (dogs > 3) {

write("Boxer");

} else if (dogs <= 2) {

write("Golden Retriever");

}

Boxer

Golden Retriever

True

No output

Answer explanation

4 is greater than 3 so the first if statement evaluates true. Therefore the first write is what is outputted.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?

var cat = 3;

if (cat == 2) {

write("Good kitty");

} else if (cat == 3) {

write("Mean kitty");

} else if (cat == 1) {

write("Ugly kitty");

}

Good kitty

Mean kitty

Ugly kitty

true

Answer explanation

if (cat == 2) {

write("Good kitty");

} else if (cat == 3) {

write("Mean kitty");

} else if (cat == 1) {

write("Ugly kitty");

}

Since cat is assigned the value of 3, the else if statement of cat == 3 is true. So the write of Mean kitty is written.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?

var dog = 9;

if ( (dog > 2) && (dog < 13) ) {

write("I love dogs");

} else if ( dog < 5 ) {

write("I love cats");

}

I love dogs

I love cats

true

no output

Answer explanation

if ( (dog > 2) && (dog < 13) ) {

write("I love dogs");

} else if ( dog < 5 ) {

write("I love cats");

}

Since dog holds the value of 9, the first if statement evaluates to true. So the output is I love dogs. The else if statement will not be evaluated since the if statement is true.

4.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is output?

var song = 3;

if (song > 9) {

write ("My favorite song is ");

} else if (song > 3) {

write("I don't like the song ");

} else if (song < 4) {

write("Sing the song ");

}

write("Chicken Nugget Song");

_____________________

5.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is output ?

var school = 3;

if (school <= 2) {

write("Texans");

} else {

write("Astros");

}

_____________________

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is output?

var school = 3;

if ( school == 5 || 3) {

write("Phillies");

} else if (school > 4){

write("Cardinals");

}

Phillies

Cardinals

true

Phillies, but there is a syntax error

Answer explanation

syntax error because the or in the first if statement should have:

(school == 5) || (school == 3)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is output?

var x = 32;

write( x >= 45 || x < 32 ) ;

true

false

32

45

Create a free account and access millions of resources

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?