Search Header Logo

Java Chapter 4 Quiz

Authored by Alex Zaldivar

Computers

University

Used 94+ times

Java Chapter 4 Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?

str1 == str2

str1 && str2

str1.equals(str2)

str1 + str2

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In an if-else statement, if the boolean expression is false

no statements or blocks are executed.

the statement or block following the else is executed.

the first statement or block is executed.

all statements or blocks are executed.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be displayed when the following code is executed?

double x = 45678.259;

DecimalFormat formatter = new DecimalFormat("#,##0.0"); JOptionPane.showMessageDialog(null,formatter.format(x));

45,678.26

45,678.3

45,678.259

45678.259

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

________ operators are used to determine whether a specific relationship exists between two values.

Assignment

Arithmetic

Logical

Relational

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The boolean expression in an if statement must evaluate to

degrees or radians

true or false

positive or negative

left or right

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following expressions determines whether the char variable chrA is not equal to the letter 'A'?

chrA == 'A'

chrA != 'A'

chrA || 'A'

chrA.notEquals('A')

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Enclosing a group of statements inside a set of braces creates

an expression

a block of statements

a relational operator

an if-else statement

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?