Search Header Logo

Unit 4 - Conditions and Logic

Authored by Terresa Uzzle

Computers

12th Grade

Used 5+ times

Unit 4 - Conditions and Logic
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The Scene class has different versions of the drawText() method.

void drawText(String text, int x, int y)

void drawText(String text, int x, int y, double rotation)

This is an example of

 polymorphism

 inheritance

overloading

subclass

overriding

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Assume dessert1 and dessert2 are object references. The following code segment is run, and returns true.

dessert1 == dessert2

What assumptions can be made about dessert1 and dessert2?

 Either dessert1 or dessert2 must be null.

 Both dessert1 and dessert2 must be null.

dessert1 has an overridden equals method.

dessert1 and dessert2 are aliases.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Consider the method to the left.

What is printed as a result of the call mystery(5, 9, 5)?

XY

XYZ

Y

YY

Z

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Consider the code segment to the left. Assume num is a properly declared and initialized int variable.

Which of the following best describes the result of executing the code segment?

When num is a negative odd integer, "B" is printed; otherwise, "A" is printed.

When num is a negative even integer, "B" is printed; otherwise, nothing is printed.

When num is a positive even integer, "A" is printed; otherwise, "B" is printed.

When num is a positive even integer, "A" is printed; when num is a positive odd integer, "B" is

printed; otherwise, nothing is printed.

When num is a positive odd integer, "A" is printed; when num is a positive even integer, "B" is

printed; otherwise, nothing is printed.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Consider the code segment to the left.

What is printed as a result of executing the code segment?

C

O

D

E

Nothing is printed

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Consider the code to the left.

What is the value of y after the code segment is executed?

11

15

10

13

14

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following best describes the Boolean expression shown below?

A || !(B && C)

The resulting truth value is always true.

The resulting truth value is always false.

There are three instances where the resulting truth value is false.

There is only one instance where the resulting truth value is false.

The resulting truth value is true only when !C is true.

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?