Java认证模考试题(二)
Question: 6
Which are the valid identifiers in Java?
A. fieldname
B. super
C. 3number
D. #number
E. $number
Explanation:
Valid identifiers in Java can start with a letter, underscore (_), or dollar sign ($), but not with digits or other signs. And identifiers can not be keywords.
Correct Answer: A,E 6 of 60
Question: 7
Which are valid Java keywords?
A. const
B. NULL
C. false
D. this
E. native
Explanation:
All the keywords in Java are lowercase. goto and const are keywords that are not used in Java programming language.
Correct Answer: A,C,D,E 7 of 60
Question: 8
WWW.CN-MPA.COM 2005-8-16 3:14:42
Which are valid integral expressions in Java?
A. 22
B. 0x22
C. 022
D. 22H
Explanation:
In Java integral has three forms: decimal, octal and hexadecimal. Octal values start with a zero and hexadecimal values start with 0x.
Correct Answer: A,B,C 8 of 60
Question: 9
Which one of the following ranges of short is correct?
Explanation:
The length of the short data is 16 bits. The range of short is
The length of the short data is 16 bits. The range of short is
Correct Answer: D 9 of 60
Question: 10
Which one of the following ranges of byte is correct?
Correct Answer: B 10 of 60
Question: 11
WWW.CN-MPA.COM 2004-5-27 22:14:08
Given the following fragment of code, what are results of i and j after execution?
int i = 1;
int j;
j = i++;
A. 1, 1
B. 1, 2
C. 2, 1
D. 2, 2
Explanation:
Pay attention to the position of the operator ++. In this question, first j is assigned to 1, then the value of i is added to 2.
Correct Answer: C 11 of 60
Question: 12
Which of the following statements are true?
A. >> is the arithmetic right shift operator.
B. >> is the logical right shift operator.
C. >>> is the arithmetic right shift operator.
D. >>> is the logical right shift operator.
Explanation:
There are two right shift operators in Java. They are >> and >>>. >> is the arithmetic(signed) right shift operator and >>> is the logical(unsigned) right shift operator.
Correct Answer: A,D 12 of 60
Question: 13
Which of the following assignments are legal?
A. float a = 2.0
B. double b = 2.0
C. int c = 2
D. long d = 2
Explanation:
In Java the default data type of floating point is double, not float. The assignment from double to float requires an explicit cast.
Correct Answer: B,C,D 13 of 60