Java基础知识英文选择题1——Basic of Java Programs.

1. Which method must exist in every java application?

A. main

B. paint

C. begin

D. init

Correct Answer : A

2.What's the right way to handle abnormalities in input on java?

A. By handling these problems by providing exception handlers.

B. By writing whileloops to guard against bad input.

C. By using the class FileFilter which gracrfully filters out bad input data.

D. By always specifying the throws clause in every method header where file i/o is performed.

Correct Answer :A

3. The name of a java source file ___?

A. must be the same as the class it defines, respecting case.

B. has no restrictions.

C. must use the extension class.

D. must be the same as the class it defines, ignoring case.

Correct Answer : A

4. A difference between the methods "print" and "println" of the class java.io.printwriter is that __?

A. "print" inserts a new line at the beginning of its output, but "println" does not.

B. "println" appends a new line to the end of its output, but "print" does not.

C. "println" inserts a new line at the beginning of its output, but "print" does not.

D. "print" appends a new line to the end of its output, but println does not.

Correct Answer : B

5. A tool that allows programmers to execute lines of a program one line at a time in order to help locate the source of a program's errors is known as a(n) __?

A. debugger.

B. scope.

C. exception handler.

D. stack trace.

Correct Answer : A

6. Classes from which of the following packages are implicitly imported into every Java program?

A. java.awt

B. java.io

C. java.lang

D. java.util

Correct Answer : C

7. Which of the following statements is(are) true about the use of an asterisk(*) in a java import statement? 

i.It does not incur run-time overhead.

ii. It can be used to import multiple packages with a single statement.

iii. It can be used to import multiple classes with a single statement.

A. i and iii only

B. iii only

C. i only

D. i, ii and iii

Correct Answer : A

8. Which of the follwing is the string concatenation operator in java?

A. +

B. ^

C. &

D. ++

Correct Answer : A

9. What will be output when the following java program segment is executed?

int x = 5;

int y = 2;

System.out.println(x + y);

A. 7

B. 5 2

C. 5 + 2

D. 52

Correct Answer : A

10. What will be output caused by the execution of the following java program segment? 

String name = "elvis";

System.out.print(name + "was here");

A. name + was here

B. elvis was here

C. name was here

D. elviswas here

Correct Answer : D

 (部分题目来源于网络,如有侵权,请联系文章作者删除。)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值