Review Game Zone
Flash Cards
(current)
Games
Teachers
Search
Java Module 4
Test Description: Identifiers, Assignment Operators and Numeric Data Type
Instructions: Answer all questions to get your test result.
1) Which of the following is a valid identifier?
A
9x
B
8+9
C
$total
D
class
2) An identifier that cannot be used as a variable name is a ___________________ word
A
long
B
key
C
reserved
D
special
3) Before a variable is used it must be _______________
A
declared
B
defined
C
assigned
D
imported
4) An int variable can hold:
A
120
B
abc
C
120.5
D
'x'
5) In Java, which of the following is not a numerical type?
A
char
B
int
C
double
D
byte
6) Which of the following is a correct name for variables according to Java camel case naming conventions?
A
findarea
B
FindArea
C
FINDAREA
D
findArea
7) To declare a constant MAX_LENGTH inside a method with value 99.98, you write
A
final MAX_LENGTH = 99.98;
B
double MAX_LENGTH = 99.98;
C
none of the above
D
final double MAX_LENGTH = 99.98;
8) Which of the following is the correct way to declare a variable?
A
int length, int width;
B
int length width;
C
int length; width;
D
int length, width
9) What is the result of 45 / 4?
A
10
B
11.25
C
12
D
11
10) Which of the following expression results in a value 1?
A
37 % 6
B
25 % 5
C
2 % 1
D
15 % 4
11) 25 % 1 is _____
A
1
B
0
C
2
D
3
12) To declare an int variable number with initial value 2, you write ___________
A
int number = 2L;
B
int number = 2.0;
C
int number = 2;
D
integer number = 2;
13) The expression 4 + 20 / (3 - 1) * 2 is evaluated to ______________
A
20
B
9
C
24
D
4
14) Suppose x is 1. What is x after x += 2?
A
-1
B
3
C
1
D
4
15) Which of the following contains a valid comment?
A
none of the above
B
int twoPi = 2 * 3.14159; /* holds the value of two times pi */
C
int twoPi = 2 * 3.14159; /*/ *holds the value of two times pi //*
D
int twoPi = 2 * 3.14159; /* holds the value of two times pi //*
16) Which of the following is a valid Java variable?
A
95miles
B
_thisDog
C
numbers#text
D
final
17) How would you assign the integer 5 to a variable named numberFive? Assume the variable is already declared
A
numberFive = 5;
B
numberFive == 5;
C
numberFive := 5;
D
5 = numberFive;
*select an answer for all questions
Check Results & Get Answers
Play Games with the Questions Above
Teachers: Create FREE classroom games with your questions
Click for more info!
©2007-2024
ReviewGameZone.com
|
About
|
Privacy
|
Contact
|
Terms
|
Site Map
WAIT! Find what you needed?
×
Still Looking for the Answers?
Have Another Question?
Play a Review Game with These Questions?
Want to Make Your Own Test Like This One?