Conditional Quiz

Conditional Quiz

3rd - 12th Grade

21 Qs

quiz-placeholder

Similar activities

ICT and SST Week Quiz_Grade 6

ICT and SST Week Quiz_Grade 6

6th Grade

20 Qs

CSS - Computer Systems Services

CSS - Computer Systems Services

12th Grade

20 Qs

Yr7- Understanding computers Lessons 1-3

Yr7- Understanding computers Lessons 1-3

7th - 11th Grade

20 Qs

TMK Tahun 4 (i)

TMK Tahun 4 (i)

4th Grade

20 Qs

New Scratch

New Scratch

6th - 8th Grade

20 Qs

Informatika

Informatika

10th Grade

20 Qs

Traffic Light Project Quiz

Traffic Light Project Quiz

9th Grade

17 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

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?