Unit 1: Primitive Types - Test Review

Unit 1: Primitive Types - Test Review

9th Grade

20 Qs

quiz-placeholder

Similar activities

PH3 PERS. KUADRAT

PH3 PERS. KUADRAT

9th Grade

20 Qs

Me divierto con las Matemáticas LILEGRE 8° y 9° 2020.

Me divierto con las Matemáticas LILEGRE 8° y 9° 2020.

1st Grade - University

20 Qs

Thử thách Toán Tuần 11

Thử thách Toán Tuần 11

5th Grade - University

20 Qs

add maths (c4)

add maths (c4)

1st - 12th Grade

20 Qs

Ini kuis

Ini kuis

9th - 12th Grade

15 Qs

Indices

Indices

8th - 9th Grade

20 Qs

Matrikulasi

Matrikulasi

7th - 9th Grade

15 Qs

Year 10 Solving Equations

Year 10 Solving Equations

9th - 11th Grade

15 Qs

Unit 1: Primitive Types - Test Review

Unit 1: Primitive Types - Test Review

Assessment

Quiz

Mathematics

9th Grade

Practice Problem

Hard

Created by

Karen Shih

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

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

20 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Consider the following code segment. System.out.print("turtle "); System.out.println("snake "); System.out.println("dog "); System.out.print("cat "); What is printed as a result of executing the code segment?

Media Image

turtle

snake

dog

cat

turtle snake

dog

cat

turtle snake

dog cat

turtle snake

dog cat

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code segment.

int x = 10;

int y = 20;

/* missing code */

System.out..print(top / bottom);

Which of the following can be used as a replacement for /* missing expression */ will cause an ArithmeticException to occur?

I. int top = x - y;

int bottom = y - x;

II. int top = 2 * x;

int bottom = y - top;

III. int top = x + y;

int bottom = 2 * top;

I only

II only

III only

I and II only

II and III only

3.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Which of the following expressions will evaluate to 1?
I. 2 / 5 % 3

II. 2 / (5 % 3)

III. 2 / 5 + 1

I only

II only

III only

I and II only

II and III only

4.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Consider the following code segment:

int a = 10;

double b = 10.7;

double c = a + b;

int d = a + c;

System.out.println(c+" "+d);

20 20

20.0 30

20.7 31

20.7 30.7

Nothing will be printed because of an error

5.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Which of the following statements will not result in a compiler error?

I. int x = (double) 4.5;

II. int x = (int) 4.5;

III. int x = 4.5;

I only

II only

III only

I and II only

I, II, and III are all legal expressions

6.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

What is the output of the following code? int a = 1, b = 2, c = 3; a += b + c; b += a + c; c += a + b; System.out.println(a + " " + b + " " + c);

3 3 4

3 5 6

5 4 3

5 8 13

6 11 20

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What output is produced by the following line of code? int myNumber = 4; System.out.println("myNumber/3 = 1"); System.out.println(myNumber/3);

Compiler Error

1.333333333333 = 1 1.333333333333

1 = 1 1

myNumber/3 = 1 1.333333333333

myNumber/3 = 1 1

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?