Unit 1: Primitive Types - Test Review

Unit 1: Primitive Types - Test Review

9th Grade

20 Qs

quiz-placeholder

Similar activities

Area and Volume (Calculus)

Area and Volume (Calculus)

9th - 12th Grade

15 Qs

Graphing/Solving for Y

Graphing/Solving for Y

8th - 10th Grade

15 Qs

x and y intercepts

x and y intercepts

9th Grade

15 Qs

Algebra 1 Review

Algebra 1 Review

9th Grade

22 Qs

De todo

De todo

1st Grade - Professional Development

16 Qs

IST P-STEM Unit 1 Hardware and Python Review

IST P-STEM Unit 1 Hardware and Python Review

8th - 12th Grade

20 Qs

Algebra IA:  Solving Systems Using Elimination with + & -

Algebra IA: Solving Systems Using Elimination with + & -

8th - 9th Grade

19 Qs

Distance, Midpoint, Slope, Parallel, & Perpendicular

Distance, Midpoint, Slope, Parallel, & Perpendicular

9th - 10th Grade

20 Qs

Unit 1: Primitive Types - Test Review

Unit 1: Primitive Types - Test Review

Assessment

Quiz

Mathematics

9th Grade

Hard

Created by

Karen Shih

Used 2+ times

FREE Resource

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

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?