wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CS A Unit 1 Quiz Review

Total questions: 11

Worksheet time: 10mins

Name
Class
Date
1.

Match the following Java terms to their meanings.

a)

A reference (class) data type for character data

1.

String

b)

Send output to the display and advance to the next line

2.

println

c)

Send output to the display and stay on the same line

3.

print

d)

A class used to collect user input

4.

Scanner

e)

A method of the Scanner class used to accept character data input

5.

nextLine

2.

Which of the following java statements correctly declares a variable and sets it to the value 2.87?

a)

int x = 2.87;

b)

decimal x = 2.87;

c)

float x = 2.87

d)

double x = 2.87;

e)

real x = 2.87;

3.

Order the following from smallest to largest memory storage size:

a)

boolean

b)

int

c)

double

d)

String

1)
2)
3)
4)
4.

Which statement correctly inputs an integer using a properly initialized Scanner variable?

a)

int num = nextScan(int);

b)

int num = scan.nextNumber();

c)

int num = scanNextInt();

d)

int num = scan.nextLine();

e)

int num = scan.nextInt();

5.

Which is a valid variable name in Java?

Select ALL that apply.

a)

String

b)

ip.address

c)

address_1

d)

2ndplace

e)

lastName

6.

Which variable assignment is valid in java?

a)

double k = 13;

b)

int b = 2.0;

c)

double r = "3.14";

d)

String f = 0;

e)

String w = 98.6;

7.

System.out.println() accepts which datatype(s) as parameters?

a)

String

b)

double

c)

int

d)

boolean

8.

System.out.println() converts all input parameters to which output type?

a)

Scanner

b)

String

c)

double

d)

int

e)

boolean

9.

Regarding primitive datatypes, select ALL true statements from the options below?

a)

They can hold strings and numbers at the same time

b)

They contain only one piece of data at a time

c)

They can only store numeric data

d)

They have built-in methods (functions)

e)

There are multiple primitive data types

10.

Which of the following are reference (class) data types?

I. String

II. boolean

III. double

a)

I only

b)

I and III only

c)

II only

d)

II and III only

e)

I, II, and III

11.

Organize these datatypes into the right categories.

Categorize the following

int

boolean

double

String

Scanner

primitive
class (reference)