欢迎光临,有需要请联系站长!
想要快速找到正确答案?
立即关注 超新尔雅学习通微信公众号,轻松解决学习难题!
作业辅导
扫码关注
论文指导
轻松解决学习难题!
中国大学MOOC编程设计与开发作业答案
编程设计与开发
学校: 无
平台: 超星学习通
题目如下:
1. Overloading means multiple methods in the same class:(重载是指同一类中的多个方法:)
A. have the same name, but different return types(名称相同,但返回类型不同)
B. have different names, but the same parameter list(名称不同,但参数列表相同)
C. have the same name, but different parameter lists(名称相同,但参数列表不同)
D. perform the same function(执行相同的功能)
答案: have the same name, but different parameter lists(名称相同,但参数列表不同)
2. 构造方法被调用的时间是______。 (
A. 类定义时
B. 创建对象时
C. 调用对象方法时
D. 使用对象的变量时
答案: 创建对象时
3. 用户不能直接调用构造方法,只能通过____关键字自动调用。
答案: new
4. If the this variable is used to call a constructor(如果this变量被用于调用一个构造函数):
A. a compiler error will result, if it is not the first statement of the constructor(如果不是构造函数的第一条语句,则会导致编译器错误)
B. a compiler error will result, if it is the first statement of the constructor(如果是构造函数的第一条语句,则会导致编译器错误)
C. nothing will happen (什么都不会发生)
D. the this variable cannot be used as a constructor call (此变量不能用作构造函数调用)
答案: a compiler error will result, if it is not the first statement of the constructor(如果不是构造函数的第一条语句,则会导致编译器错误)
5. 类和对象之间是 的关系。
A. 一对一
B. 一对多
C. 多对一
D. 多对多
答案: 一对多
6. 当局部变量的名字和类的成员变量的名字相同时,类的成员变量将被隐藏。为了在方法中使用成员变量,并且与局部变量加以区分,必须使用____。
答案: this
7. 类和对象之间是 的关系。
A. 一对一
B. 一对多
C. 多对一
D. 多对多
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
8. 下列方法定义中,正确的是 。
A. void x( int a, b ) { return a-b; }
B. x( int a,int b) { return a-b; }
C. double x { return b; }
D. int x( int a,int b) { return a+b; }
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
9. 下列方法定义中,方法头不正确的是 。
A. public int x( ){ ... }
B. public static int x( double y ){ ... }
C. void x( double d ) { ... }
D. public static x( double a ){ ... }
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
10. 设 A为已定义的类名,下列声明A类的对象a的语句中正确的是 。
A. A a=new A( );
B. A a=A( );
C. A a=new class( );
D. a A;
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
11. 有一个类A,以下为其构造方法的声明,其中正确的是 。
A. void A(int x){...}
B. A(int x){...}
C. a(int x){...}
D. void a(int x){...}
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
12. Java语言中创建一个对象使用的关键字为 。
A. class
B. interface
C. new
D. create
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
13. 现有: class Top { static int x=1; public Top (int y) { x*=3; } } class Middle extends Top { public Middle() {x+=1; } public static void main (String [] args) { Middle m = new Middle(); System. out .println (x); } } 结果为:
A. 1
B. 2
C. 3
D. 编译失败
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
14. 现有: class Passer { static final int X = 5; public static void main(String[] args) { new Passer().go(X); System.out.print(X); } void go(int x) { System.out.print(x++); } } 结果是什么?
A. 55
B. 56
C. 65
D. 66
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
15. 现有: class Wrench { public static void main(String[] args) { Wrench w = new Wrench(); Wrench w2 = new Wrench(); w2 = go(w, w2); System.out.print(w2 == w); } static Wrench go(Wrench wrl, Wrench wr2) { Wrench wr3 = wrl; wrl = wr2; wr2 = wr3; return wr3; } } 结果是什么?
A. false
B. true
C. 编译失败
D. 运行的时候有异常抛出
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
16. 现有: 1. class Wrench2 { 2. int size; 3. public static void main(String[] args) { 4. Wrench2 w = new Wrench2(); 5. w.size = 11; 6. Wrench2 w2 = go(w, w.size); 7. System.out.print(w2.size); 8. } 9. static Wrench2 go(Wrench2 wr, int s) { 10. s = 12; 11. return wr; 12. } 13. } 结果为:
A. 11
B. 12
C. 编译失败。
D. 运行时异常被抛出
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
17. 现有: class Test2 { public static void main(String[] args) { short a, b, c; a = 1; b = 2; c = a + b; a += 2; } } 以上代码中,哪一句是错误的?
A. a = 1;
B. c = a + b;
C. a += 2;
D. short a, b, c;
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
18. 在以下供选择的概念中,不属于面向对象语言概念的是()
A. 模块
B. 继承
C. 封装
D. 多态性
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
19. 以下哪个关键字用来定义成员常量 。
A. finalize
B. final
C. finally
D. const
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
20. 下列关于封装的说法,正确的是______。
A. 封装是一种信息隐蔽技术,是将相关的数据及其操作组织在对象中,构成具有独立意义的构件
B. 封装是一个清晰的边界,将所有对象的内部软件范围限定在这个边界之内
C. 使用封装后,用户或其他对象仍可以直接修改对象内部的数据结构
D. 封装是受保护的内部实现,这个实现给出了软件对象功能的细节,当前对象的类的外面能够访问这些实现细节
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
21. 对属性进行封装使用什么关键字
A. private
B. public
C. default
D. final
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
22. 对属性进行封装使用什么关键字
A. private
B. public
C. default
D. final
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
23. 对属性封装完后,还需要添加的一对封装方法是什么?
A. 抽象方法
B. set方法和get方法
C. 静态方法
D. 没有添加
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
24. Java语言类间的继承关系是_____。
A. 线程的
B. 单重的
C. 多重的
D. 不能继承
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
25. 不能被子类覆盖的方法是()
A. final方法
B. abstract方法
C. public方法
D. 用户自定义的方法
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
26. Java语言中,在类定义时用final关键字修饰,是指这个类()
A. 不能被子类的方法覆盖
B. 不能被继承
C. 能被别的程序自由调用
D. 在子类的方法中不能被调用
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
27. 下列关于Java的多态的说法中,不正确的是()
A. 多态包括方法的覆盖和重载
B. 同一个类内部可以有多个参数不同的同名方法
C. 子类可以覆盖父类的同名方法
D. 返回值可以作为判定重载的条件
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
28. Java编程所必须的默认引用包是 。
A. java.lang包
B. java.utl包
C. java.sys包
D. 以上都不是
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
29. An anonymous inner class must __________. (匿名内部类必须__________。)
A. be a superclass (是一个超类)
B. implement an interface (实现一个接口)
C. extend a superclass (继承一个超类)
D. either b or c. (B或C)
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
30. 下列关于抽象类的说法不正确的是()
A. 抽象类能够被实例化
B. 抽象类中不一定有抽象方法
C. 抽象类也有构造方法
D. 抽象类可以派生出子类
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
31. 在Java语言中,用___________修饰符定义的类为抽象类。
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
32. 在使用interface声明一个接口时,可以使用_____修饰符修饰该接口。 (
A. private protected
B. protected
C. private
D. public
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
33. Which of the following is an example of a lambda expression? (以下哪项是lambda表达式的示例?)
A. int x = x * factor;
B. IntCalculator = new divider(x, 2);
C. IntCalculator multiplier = x -> x * factor;
D. All of the above
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
34. Java中的集合类包括ArrayList、LinkedList、HashMap等类,下列关于集合类描述不正确的是( )。
A. ArrayList和LinkedList均实现了List接口
B. ArrayList的查询速度比LinkedList快
C. 添加和删除元素时,ArrayList的表现更佳
D. HashMap实现Map接口,它允许任何类型的键和值对象,并允许将null用作键或值
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
35. ArrayList类的底层数据结构是( )。
A. 链表结构
B. 哈希表结构
C. 数组结构
D. 红黑树结构
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
36. List集合的遍历方式不包括以下如下哪种 ( )?
A. Iterator迭代器实现
B. 增强for循环实现
C. 普通for循环,get()和size()方法结合实现
D. 普通for循环,get()和length()方法结合实现
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
37. This is the technology that makes it possible for a Java application to communicate with a DBMS.(_____技术使Java应用程序与DBMS进行通信成为可能。)
A. DBMSC
B. JDBC
C. JDBMS
D. JDSQL
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
38. This is a standard language for working with database management systems.(_____是用于数据库管理系统的标准语言。)
A. Java
B. COBOL
C. SQL
D. BASIC
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
39. The data that is stored in a table is organized in __________. (表中存储的数据以__________进行组织。)
A. rows
B. files
C. folders
D. pages
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
40. The data that is stored in a row is divided into __________. (行中存储的数据分为__________。)
A. sections
B. bytes
C. columns
D. tables
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
41. This is a column that holds a unique value for each row, and can be used to identify specific rows. (______列,每一行都有唯一的值,可用于标识特定的行。)
A. ID column
B. public key
C. designator column
D. primary key
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
42. This type of SQL statement is used to retrieve rows from a table. (________类型的SQL语句用于从表中检索行。)
A. RETRIEVE
B. GET
C. SELECT
D. READ
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
43. This contains the results of an SQL SELECT statement. (____包含SQL SELECT语句的结果。)
A. select set
B. ResultSet
C. SQL set
D. collection set
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
44. This clause allows you to specify search criteria with the SELECT statement. (____子句允许您使用SELECT语句指定搜索条件。)
A. SEARCH
B. WHERE
C. AS
D. CRITERIA
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
45. This is a Java class that is designed to communicate with a specific DBMS. (_____是一个Java类,旨在与特定的DBMS通信。)
A. JDBC driver
B. DBMS Superclass
C. DBMS Subclass
D. Stream converter
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
46. This is a string listing the protocol that should be used to access a database, the name of the database, and potentially other items. (___是一个字符串,列出了用于访问数据库的协议,数据库的名称以及可能的其它项目。)
A. JDBC driver
B. JDBC locator
C. Database URL
D. Database specifier
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
47. This method is specified in the Statement interface, and should be used to execute a SELECT statement. (____方法在Statement接口中指定,并且应用于执行SELECT语句。)
A. execute
B. executeUpdate
C. executeQuery
D. executeSelect
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
48. This method is specified in the Statement interface, and should be used to execute an INSERT statement. (___方法在Statement接口中指定,并且应用于执行INSERT语句。)
A. execute
B. executeUpdate
C. executeQuery
D. executeSelect
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
49. This SQL statement is used to insert rows into a table. (___SQL语句用于在表中插入行。)
A. INSERT
B. ADD
C. CREATE
D. UPDATE
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
50. This SQL statement is used to remove rows from a table. (___SQL语句用于从表中删除行。)
A. REMOVE
B. ERASE
C. PURGE
D. DELETE
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
51. This is a column in one table that references a primary key in another table. (___是一个表中的列,该列引用了另一个表中的主键。)
A. secondary key
B. fake key
C. foreign key
D. duplicate key
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
52. 接口Statement中定义的executeQuery方法返回的类型是_____。 ( )
A. void
B. int
C. ResultSet
D. boolean
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
53. 在编写访问数据库的Java程序时,ResultSet对象的作用是____。
A. 用来表示与数据库的连接
B. 在指定的连接中处理SQL语句
C. 存储查询结果
D. 建立新数据库连接
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
54. JDBC是面向____________的。
A. 对象
B. 过程
C. 应用
D. 用户
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
55. 使用DriverManager的getConnection(String url,String user,String password)方法建立到给定数据库 URL 的连接时,需要处理的异常为_______。
A. SQLTruncation
B. SQLError
C. SQLFatal
D. SQLException
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
56. 在使用DriverManager与特定数据库建立连接时,可能产生的异常是__________。
A. ClassNotFoundException
B. IOException
C. SQLException
D. FileNotFoundException
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
57. 以下用来执行预编译的SQL语句并返回执行结果的接口是______________。
A. Statement
B. PreparedStatement
C. CallableStatement
D. Connection
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
58. 在编写访问数据库的Java程序时,Connection对象的作用是_____________________。
A. 用来表示与数据库的连接
B. 存储查询结果
C. 在指定的连接中处理SQL语句
D. 建立新数据库连接
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。
59. DataSource是Factory类型,可以调用DataSource的______方法获得数据库连接。( )
A. Delegate
B. Factory
C. connect
D. getConnection
答案:请关注【九八五题库】微信公众号,发送题目获取正确答案。