记几道java期末考试选择题

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

 

A.

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

 

B.

Class variables require the modifier static in the declarations.

 

C.

All objects have their own copy of the class variable defined in the instantiated class.

 

D.

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

1. The constructor of a class that adheres to the Singleton design pattern must have _____ visibility.

 

A.

public


B.

private

 

C.

package

 

D.

protected



1. The subclass of an abstract class must

 

A.

 be abstract or implement all of the parent's abstract methods

 

B.

be abstract


C.

be abstract and implement all of the parent's abstract methods

 

D.

implement all of the parent's abstract methods


1.  The Strategy design pattern is likely to be useful when implementing which of the following?

I. An application that offers several alternate sorting algorithms

II. A simple class to store the address of an organization of which only one instance can be instantiated

 

A.

I and II

 

B.

None

 

C.

II only


D.

I only


1.  The static model of a software system typically includes which of the following?

I. Attributes of classes

II. Actions that occur between classes

III. Structural relationships between classes

 

A.

I, II, and III

 

B.

I and II only


C.

I and III only

 

D.

II and III only


1.  When using noun-phrase analysis to model a software system, which of the following should typically be eliminated from the list of potential classes?

I. References to the software system itself

II. Nouns that imply roles between objects

III. Synonyms to other nouns in the list

 

A.

I and III only

 

B.

III only


C.

 I, II, and III

 

D.

II and III only


1. If a class has an association with itself, then the class contains

 

A.

its own superclass

 

B.

an attribute that references an object of the same class

 

C.

a method that calls itself

 

D.

a method that calls another method within the same class


1. A binary association is said to exist between two classes when

 

A.

one class belongs to the same package as the other class

 

B.

an object of one class is instantiated in the same method as an object of the other class

 

C.

one class is a subtype of the other class

 

D.

an object of one class requires an object of the other class



1. A collection typically models a _____ relationship.

 

A.

many-to-many

 

B.

zero-to-one


C.

one-to-many

 

D.

one-to-one


1. If a class contains a constructor, that constructor will be invoked


A.

each time an object of that class is instantiated

 

B.

each time an object of that class goes out of scope

 

C.

once the first time an object of that class is instantiated

 

D.

once at the beginning of any program that uses that class



  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值