好文档 - 专业文书写作范文服务资料分享网站

java单选题版 doc

天下 分享 时间: 加入收藏 我要投稿 点赞

1. How many bytes of storage are required for an integer of type long in Jav

a? (b) (a) Four (b) Eight (c) Two (d) Three

注java中有8种基本类型byte:8位无符号整数 short: 16位有符号整数 臧 廷杰

int32位有符号整数 long:64(8字节)位有符号整数 float:32位单精度浮点数 double:64位单精度浮点数 char:单个字符使用16位Unicode编码 boolean 2.

The two Boolean literals available in Java are _____ and _____. (d) (a) T, F (b) 0, 1

(c) TRUE, FALSE (d) true, false 3.

Consider the following line of Java code. (c) int x = 1+7*2;

What will be the value of x at the end of execution of the line of code? (a) 21 (b) 16 (c) 15 (d) 9 4.

How many lines of output will be produced by the following code fragment? (d)

for (int i = 0; i < 4; ++i) {

for (int j = 1; j < 3 ; ++j) { stdOut.println(i + j); (a) 10 (b) 12 (c) 6 (d) 8 5.

Which is the Java keyword used to denote a class method? (d) (a) class (b) private (c) final

(d) static 6

??? According to Javadoc convention, the first sentence of each Javadoc comment should be (c) (a) an @author tag

(b) the order of lines is not important

(c) a summary sentence of the declared entry (d) an @version tag 7.

The coding system used to represent characters in Java is (c) (a) bytecode (b) ASCII (c) Unicode (d) EBCDIC

8.

Which expression below evaluates to true if and only if x is in the range [0, 9] (inclusive)? (a) (a) !(x < 0 || x > 9) (b) 0 < x < 9 (c) 0 <= x >= 9

(d) x > 0 && x < 9 9.

Which of the following is a valid integer constant declaration? (a) (a) final int SCALE = 10; (b) int final SCALE = 10; (c) final SCALE = 10; (d) int SCALE = 10; 10.

Which of the following is a valid character literal in Java? (注意字符与字符串 的表示) (a) (a) '' (b) \ (c) \ (d) '<=' 11.

Which of the following is not equivalent in value to the following expre

ssion? (b) flag == false (a) flag != true (b) flag (c) !flag

(d) !(flag == true) 臧廷杰

12. Which of the following statements is used to exit from a switch statemen t? (a) (a) break; (b) end; (c) exit;

(d) default;

13.

Which of the following is not a legal identifier in Java? (c) (a) first_index (b) $first_index (c) 1index (d) index1 14.

In Java, what is the identifier for the primitive type used to represent a char acter? (b) (a) Character (b) char

(c) character (d) Char 15.

Which of the following is a valid literal of type float in Java? (c) (a) 10.5sp (b) 10.5fp (c) 10.5f (d) 10.5d 16.

Which of the following statements about constructors in Java is true? (a) (a) A class can define more than one constructor.

(b) A class must define at least one constructor. (c) A constructor must be defined as public. (d) A constructor must be defined as static.

. 17. According to the document entitled

Code Conventions for the Java Programming Language, file suffixes used by Java software include which of the following? (b) I. .obj II. .class III. .h

(a) I and II only (b) II only

(c) II and III only (d) I and III only

18. A stack trace is (c) 臧廷杰 (a) a list of variables allocated on a program's stack

(b) a fatal error that causes a typical debugger to terminate (c) a sequence of method calls

(d) only available through a typical debugger's step into feature

注堆栈轨迹:如果你需要打印出某个时间的调用堆栈状态你将产生一个堆栈轨迹。 stack trace 中包括三部分分别为.bss .text .data bss 表示程序中未初始化的全局变量的一块内存区域 text 表示程序中已初始化的全局变量的一块内存区域 data表示存放程序执行代码的一块内存区域

19.Which method must exist in every Java application? (a) begin (b) paint (c) init (d) main

Correct answer is (d)

20.A Java identifier may begin with all but which of the following? (a) $ (b) if

(c) _ (the underscore) (d) 0

Correct answer is (d)

21.In the context of Java programming, garbage collection refers to (a) automatic balancing of parenthesis performed by some editors (b) removal of Java programs that could cause damage to a system (c) conversion of comments into Javadoc comments

(d) automatic return of memory to the heap for objects no longer required by the program

Correct answer is (d)

22.What will be output when the following Java program segment is executed? int x = 5; int y = 2;

System.out.println(x+y); (a) 5+2 (b) 5 2 (c) 7 (d) 52

Correct answer is (c) 23. Which of the following parts of an if-else-statement is optional? (a) the if part (b) the else part

(c) the parenthesis around the condition (d) the condition Correct answer is (b)

24.Which of the following is the Java loop construct typically used when the range is clear?

(a) while-loop (b) for-loop (c) switch-loop (d) do-while-loop

Correct answer is (b)

25.Consider the following Java program segment. import java.io.*;

public class Test {

public Test( ) {

System.out.println(\ }

public Test( int i ) {

System.out.println(\-default\ }

public static void main(String[] args) {

Test t = new Test(2); } }

Which of the following will be output during execution of the program segment? (a) The line of text \-default\ (b) The line of text \-default\ (c) The line of text \

(d) The line of text \-default\ Correct answer is (d)

26.What is the name of the JDK program that processes Javadoc comments? (a) java (b) javac (c) javacom (d) javadoc

Correct answer is (d)

27.According to the Java code conventions, files longer than _____ lines should be _____.

(a) 100, encouraged (b) 100, avoided (c) 2000, avoided

(d) 2000, encouraged Correct answer is (c)

28.The primitive floating-point types available in Java are _____ and _____. (a) real, double (b) float , double (c) real , float (d) single , real

Correct answer is (b)

29.How many bytes are required to represent a Unicode统一的字符编码标准采用 双字节 character? (a) Four (b) One (c) Three (d) Two

Correct answer is (d)

30.How many lines of output will be produced by the following code fragment? for (int i = 0; i < 3; ++i) { for (int j = 0; j < i; ++j) { stdOut.println(i + j); } } (a) 6 (b) 4 (c) 3 (d) 5

Correct answer is (c)

31.Which of the following statements about class variables in Java is not true?

(a) Class variables require the modifier static in the declarations. (b) All objects have their own copy of the class variable defined in the instantiated class.

(c) Non-static methods in a class can access the class variable defined in the same class.

(d) Class variables do not need the reference to the object of the instantiated class to access them.

Correct answer is (b)

32.The term class variable is a synonym for (a) an instance variable (b) a read-only variable (c) a private data field (d) a static data field Correct answer is (d)

33.Which of the following patterns of characters opens a Javadoc comment block? (a) /** (b) // (c) /* (d) **/

Correct answer is (a)

34.The term wrapper classes refers to

(a) the Java classes that contain at least two data fields (b) the Java classes that contain themselves

(c) a collection of Java classes that \ (d) a collection of Java classes that contain other Java classes Correct answer is (c)

35.Given the following code, what value will be output by the last statement? StringTokenizer st = new StringTokenizer(\ String s;

int count = 0;

while (st.hasMoreTokens()) { s = st.nextToken(); ++count;

} stdOut.println(count); (a) 3 (b) 1 (c) 6 (d) 4

Correct answer is (a) 注好像是根据逗号划分

36.Consider the following Java program segment. int x = 5; int y = 2;

java单选题版 doc

1.HowmanybytesofstoragearerequiredforanintegeroftypelonginJava?(b)(a)Four(b)Eight(c)Two(d)Three注java中有8种基本类型byte:8位无符号整数short:16位有符号整数
推荐度:
点击下载文档文档为doc格式
65iab4jil834ka295j7z7yqpo85slb00d3y
领取福利

微信扫码领取福利

微信扫码分享