Java 面向对象程序设计 错题整理 chapter 10
2021/11/28 1:10:32
本文主要是介绍Java 面向对象程序设计 错题整理 chapter 10,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
7.
What is the output of the following code?
public class Test {
public static void main(String[] args) {
java.math.BigInteger x = new java.math.BigInteger("3");
java.math.BigInteger y = new java.math.BigInteger("7");
x.add(y);
System.out.println(x);
}
}
单选题 (2 分) 2 分
- A.
4
- B.
10
- C.
3
- D.
11
9.
Which of the following statements convert a double value d into a string s?
回答错误
单选题 (2 分) 0 分
- A.
s = (Double.valueOf(s)).toString();
- B.
s = new Double(d).stringOf();
- C.
s = (new Double(d)).toString();
- D.
s = String.stringOf(d);
10.
__________ returns a string.
多选题 (2 分) 2 分
- A.
String.valueOf(false)
- B.
String.valueOf(new char[]{'a', 'b', 'c'})
- C.
String.valueOf(12.53)
- D.
String.valueOf(123)
11.
What is the output of Integer.parseInt("10", 2)?
单选题 (2 分) 2 分
- A.
1;
- B.
2;
- C.
Invalid statement;
- D.
10;
13.
Suppose s1 and s2 are two strings. Which of the following statements or expressions are incorrect?
多选题 (2 分) 2 分
- A.
int i = s1.length
- B.
s1.charAt(0) = '5'
- C.
String s3 = s1 + s2
- D.
String s = new String("new string");
- E.
s1 >= s2
17.
In JDK 1.5, you may directly assign a primitive data type value to a wrapper object. This is called ______________.
单选题 (2 分) 2 分
- A.
auto boxing
- B.
auto conversion
- C.
auto casting
- D.
auto unboxing
20.
Which of the following is the correct statement to return a string from an array a of characters?
单选题 (2 分) 2 分
- A.
String.toString(a)
- B.
toString(a)
- C.
convertToString(a)
- D.
new String(a)
22.
Which of the following statements will convert a string s into i of int type?
回答错误
多选题 (2 分) 0 分
- A.
i = (new Integer(s)).intValue();
- B.
i = (int)(Double.parseDouble(s));
- C.
i = Integer.valueOf(s);
- D.
i = Integer.parseInt(s);
- E.
i = Integer.valueOf(s).intValue();
28.
___________ is attached to the class of the composing class to denote the aggregation relationship with the composed object.
单选题 (2 分) 2 分
- A.
An empty diamond
- B.
An empty oval
- C.
A solid diamond
- D.
A solid oval
30.
Which of the following is an object?
多选题 (2 分) 2 分
- A.
new String("abc");
- B.
343
- C.
new Date()
- D.
"abc"
38.
What is displayed by the following code?
System.out.print("A,B;C".replaceAll(",;", "#") + " ");
System.out.println("A,B;C".replaceAll("[,;]", "#"));
单选题 (2 分) 2 分
- A.
A#B#C A#B#C
- B.
A B C A#B#C
- C.
A B C A B C
- D.
A,B;C A#B#C
41.
Which of the following statements are correct?
回答错误
多选题 (2 分) 0 分
- A.
new java.math.BigInteger(343);
- B.
new java.math.BigDecimal("343.445");
- C.
new java.math.BigDecimal(343.445);
- D.
new java.math.BigInteger("343");
42.
Assume s is "ABCABC", the method __________ returns an array of characters.
单选题 (2 分) 2 分
- A.
s.toCharArray()
- B.
s.toChars()
- C.
String.toChars()
- D.
String.toCharArray()
- E.
toChars(s)
45.
What is the printout of the following code?
String s1 = "Welcome to Java";
String s2 = "Welcome to Java";
System.out.println("s1 == s2 is " + s1 == s2);
单选题 (2 分) 2 分
- A.
s1 == s2 is true
- B.
true
- C.
false
- D.
s1 == s2 is false
46.
Which of the following statements will convert a string s into a double value d?
单选题 (2 分) 2 分
- A.
d = Double.parseDouble(s);
- B.
All of the above.
- C.
d = Double.valueOf(s).doubleValue();
- D.
d = (new Double(s)).doubleValue();
47.
Which of the following statements is correct?
多选题 (2 分) 2 分
- A.
Integer.parseInt("345", 8);
- B.
Integer.parseInt("12", 2);
- C.
Integer.parseInt(100);
- D.
Integer.parseInt("100");
- E.
Integer.parseInt(100, 16);
48.
What is displayed by the following code?
System.out.print("Hi, ABC, good".matches("ABC ") + " ");
System.out.println("Hi, ABC, good".matches(".*ABC.*"));
单选题 (2 分) 2 分
- A.
false false
- B.
true false
- C.
true true
- D.
false true
50.
Which of the following classes are immutable?
多选题 (2 分) 2 分
- A.
Integer
- B.
BigInteger
- C.
Double
- D.
String
- E.
BigDecimal
这篇关于Java 面向对象程序设计 错题整理 chapter 10的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-24Java中定时任务实现方式及源码剖析
- 2024-11-24Java中定时任务实现方式及源码剖析
- 2024-11-24鸿蒙原生开发手记:03-元服务开发全流程(开发元服务,只需要看这一篇文章)
- 2024-11-24细说敏捷:敏捷四会之每日站会
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解