Java基础知识英文选择题2——Types,I/O,Loop

1.In programming,a loop is generally used to achieve__?

A. branching

B. succession

C. repetition

D. selection.

Correct Answer : C

2. Which of the following is the java loop construct typically used when the ramge is clear?

A. do-while-loop

B. switch-loop

C. for-loop

D. while-loop

Correct Answer : C

3. How many lines of output will be producted by the following code fragment?

for (int i = 0; i < 4; ++i){
    for (int j = 1; j < 3; ++j){
        System.out.println(i+j);
    }
}

A. 8

B. 10

C. 6

D. 12

Correct Answer : A

4. Given the following code, what value will be output by the last statement?

StringTokenizer st = new StringTokenizer("this is,a,test of tokens", ",");
String s;
int count = 0;
while (st.hasMoreTokens()) {
    s = st.nextToken();
    ++count;
}
System.out.println(count);

A. 4

B. 1

C. 6

D. 3

Correct Answer : D

5. How many bytes are required to represent a unicode character?

A. Two

B. Three

C. Four

D. One

Correct Answer : A

6. How many lines will be produced by the following code fragment?

for (int i = 0; i < 3; ++i) {
    for(int j = 0; j < i; ++j) {
        System.out.println(i+j);
    }
}

A. 3

B. 5

C. 6

D. 4

Correct Answer : A

7. The term wrapper classes refers to__?

A. a collection of java classes that contain other java classes.

B. a collection of java classes that "wrap" java primitive types.

C. the java classes that contain themselves.

D. the java classes that contain at least two data fields.

Correct Answer : B

8. Consider the following java program segment.

int x = 5;
int y = 2;
System.out.println(x + "1" + y);

which of the following statements is true about the program segment?

A. The code will cause a compilation error.

B. The output caused by the code will be 8.

C. The output caused by the code will be 512.

D. The output caused by the code will be 5 1 2.

Correct Answer : C

 9. Which of the following parts of an if-else-statement is optional?

A. the condition.

B. the parenthesis around the condition.

C. the else part

D. the if part.

Correct Answer : C

10. The primitive floating-point types available in java are __ and  __?

A. real, float

B. single, real

C. float, double

D. real, double

Correct Answer : C

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

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值