Font size
WorksheetsAP CS A Unit 1 Quiz Review
Total questions: 11
Worksheet time: 10mins
Match the following Java terms to their meanings.
A reference (class) data type for character data
String
Send output to the display and advance to the next line
println
Send output to the display and stay on the same line
A class used to collect user input
Scanner
A method of the Scanner class used to accept character data input
nextLine
Which of the following java statements correctly declares a variable and sets it to the value 2.87?
int x = 2.87;
decimal x = 2.87;
float x = 2.87
double x = 2.87;
real x = 2.87;
Order the following from smallest to largest memory storage size:
boolean
int
double
String
Which statement correctly inputs an integer using a properly initialized Scanner variable?
int num = nextScan(int);
int num = scan.nextNumber();
int num = scanNextInt();
int num = scan.nextLine();
int num = scan.nextInt();
Which is a valid variable name in Java?
Select ALL that apply.
String
ip.address
address_1
2ndplace
lastName
Which variable assignment is valid in java?
double k = 13;
int b = 2.0;
double r = "3.14";
String f = 0;
String w = 98.6;
System.out.println() accepts which datatype(s) as parameters?
String
double
int
boolean
System.out.println() converts all input parameters to which output type?
Scanner
String
double
int
boolean
Regarding primitive datatypes, select ALL true statements from the options below?
They can hold strings and numbers at the same time
They contain only one piece of data at a time
They can only store numeric data
They have built-in methods (functions)
There are multiple primitive data types
Which of the following are reference (class) data types?
I. String
II. boolean
III. double
I only
I and III only
II only
II and III only
I, II, and III
Organize these datatypes into the right categories.
int
boolean
double
String
Scanner
