CodeHS Quiz: Boolean Expressions and if Statements

CodeHS Quiz: Boolean Expressions and if Statements

KG

15 Qs

quiz-placeholder

Similar activities

Newsworthy Quiz

Newsworthy Quiz

7th Grade

20 Qs

Broadcast Media Quiz #11 - 2021-22 - News & Podcast Writing

Broadcast Media Quiz #11 - 2021-22 - News & Podcast Writing

8th Grade

10 Qs

Is it Imperative?

Is it Imperative?

7th - 12th Grade

10 Qs

Bible Quiz

Bible Quiz

University

12 Qs

Henry danger

Henry danger

7th Grade

10 Qs

Copyright

Copyright

7th - 8th Grade

20 Qs

Syllabus Quiz

Syllabus Quiz

11th - 12th Grade

13 Qs

Pollyanna Quiz Chapters 6 and 7

Pollyanna Quiz Chapters 6 and 7

5th Grade

20 Qs

CodeHS Quiz: Boolean Expressions and if Statements

CodeHS Quiz: Boolean Expressions and if Statements

Assessment

Quiz

Journalism

KG

Easy

Created by

Gracie Rosky

Used 7+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a relational operator?


<

?

==

>=

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this Java expression evaluate to?

80 >= 80


"true"

true

false

This expression will error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the code snippet below.

String name = "Karel"; String checkName = new String("Karel"); boolean nameMatches = name == checkName;

true

false

Cannot be determined

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between == and =?

== is used for assignment, while = is used to check for equality

= is used for assignment, while == is used to check for equality.

== assigns values to objects while = assigns values to primitives.

There is no difference. These symbols can be used interchangeably.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following symbols is the “not equal” symbol?

==

not =

!=

<>

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why do we use if statements in Java?

To break out of some block of code

  1. To do something only if a condition is true

  1. To do something while a condition is true

To repeat something for a fixed number of times

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which if statement is written properly?

if (boolean expression): // code to execute // code to execute

  1. if boolean expression { // code to execute // code to execute }


  1. if(boolean expression) { // code to execute // code to execute }

  1. if boolean expression [ // code to execute // code to execute ]

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?