NEW
Font size
WorksheetsComputer Science: Chapter 2 Test Review
Total questions: 20
Worksheet time: 7mins
When data cannot be changed after a class is compiled, the data is __________.
Constant
Variable
Volatile
Mutable
Which of the following is not a primitive data type in Java?
Boolean
Byte
Int
Sector
Which of the following elements is not required in a variable declaration?
A Type
An Identifier
An Assigned Value
A Semicolon
The assignment operator in Java is __________.
=
==
:=
::
Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statement in Java?
shoeSize = 9;
shoeSize = 9.5;
shoeSize = '9';
shoeSize = "nine";
Which of the following data types can store a value in the least amount of memory?
Short
Long
Int
Byte
A boolean variable can hold __________.
Any Character
Any Whole Number
Any Decimal Number
The Value True Or False
The value 137.68 can be held by a variable of type __________.
Int
Float
Double
Float and Double Are Correct
An escape sequence always begins with a(n) __________.
E
Forward Slash
Backslash
Equal Sign
Which Java statement produces the following output?
w
xyz
System.out.println("waxy");
System.out.println("w" + "xyz");
System.out.println("w\nxyz");
System.out.println("w\nx\ny\nz");
The remainder operator __________.
Is Represented By A Forward Slash
Must Follow A Division Operation
Provides The Quotient Of Integer Division
Is None Of The Above
According to the rules of operator precedence, when division occurs in the same arithmetic statement as __________, the division operation always takes place first.
Multiplication
Remainder
Subtraction
Multiplication & Remainder Are Correct
The "equal to" relational operator is __________.
=
==
!=
!!
When you perform arithmetic with values of diverse types, Java __________.
Issues An Error Message
Implicitly Converts The Values To A Unifying Type
Requires You To Explicitly Convert The Values To A Unifying Type
Implicitly Converts The Values To The Type Of The First Operand
If you attempt to add a float, an int, and a byte, the result will be a(n) __________.
Float
Int
Byte
Error Message
You use a __________ to explicitly override an implicit type.
Mistake
Type Cast
Format
Type Set
In Java, what is the value of 3 + 7 * 4 + 2?
21
33
42
48
Which assignment is correct in Java?
int value = (float) 4.5;
float value = 4 (double);
double value = 2.12;
char value = 5c;
Which assignment is correct in Java?
double money = 12;
double money = 12.0;
double money = 12.0d;
All Of The Above Are Correct
Which assignment is correct in Java?
char aChar = 5.5;
char aChar = "W";
char aChar = '*';
char aChar = "W"; & char aChar = '*'; Are Correct
