CodeHS Quiz: Boolean Expressions and if Statements

CodeHS Quiz: Boolean Expressions and if Statements

KG

15 Qs

quiz-placeholder

Similar activities

News Gathering: Research

News Gathering: Research

7th - 8th Grade

18 Qs

Yearbook Terms #2

Yearbook Terms #2

6th - 8th Grade

12 Qs

Review of Related Literature

Review of Related Literature

11th Grade - Professional Development

10 Qs

Crash Course Media Literacy #7-#9

Crash Course Media Literacy #7-#9

8th - 12th Grade

20 Qs

Inverted Pyramid

Inverted Pyramid

University

10 Qs

Digital Media

Digital Media

9th - 12th Grade

14 Qs

Directions

Directions

University

20 Qs

Pandemic and Economy SIP Day 2

Pandemic and Economy SIP Day 2

University

10 Qs

CodeHS Quiz: Boolean Expressions and if Statements

CodeHS Quiz: Boolean Expressions and if Statements

Assessment

Quiz

Journalism

KG

Practice Problem

Easy

Created by

Gracie Rosky

Used 8+ times

FREE Resource

AI

Enhance your content in a minute

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

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

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?