ssd1卡耐基选择题(6)

2019-01-07 15:01

II. III. Concatenation of two strings

Addition of two floating point variables

(a) II and III only (b) I only

(c) I and III only (d) I, II, and III

13. What is output when the following Java statement is executed?

System.out.println(-5%-2);

(a) 1 (b) –1

(c) 0 (d) 2

14. Consider the following Boolean expression.

!(!(a&&b))

For which of the following values of a and b, respectively, will the expression evaluate to true? (a) false, true (b) true, false

(c) true, true (d) false, false

15. The region of a program where a variable can be referenced is known

as the _____ of the variable.

(a) type

(b) conventional space

(c) scope

(d) storage space

16. Valid Java identifiers include which of the following?

I. II. III.

_$4dollar $_4dollar 4_dollar

(a) I, II, and III (b) None

(c) III only (d) I and II only

17. Which of the following is a method invocation that retrieves the

first element from an instance of class java.util.Vector?

(a) elementAt(0) (b) elementAt(1)

(c) read(1) (d) read(0)

18. Consider the following Java program segment.

String a = \String b = \String c = \String d = \

Vector v = new Vector();

v.add(a); v.add(b); v.add(c); v.add(d);

At the end of execution of the program segment, what value will be returned by v.elementAt(1)?

(a) \(b) \

(c) \(d) \

Take Assessment: Multiple-Choice Quiz 7

1. If class A is a subclass of class B, which of the following

statements is (are) true?

I. II.

All public data and methods of class B are available to class

A. All public data and methods of class A are available to class B.

(a) I and II (b) None

(c) II only (d) I only

2. In the following program segment, the call super(len,wid) invokes

the constructor for which class? public class CustomWindow extends MyWindow implements ActionListener {

public CustomWindow(int len, int wid, Font ft)

{

super(len, wid);

} }

(a) CustomWindow (b) Font

(c) ActionListener (d) MyWindow

3. Consider the following Java program fragment. import java.applet.Applet;

public class Hello extends Applet {

... }

The fragment indicates that (a) Hello is a subclass of Applet (b) Hello is an instance of Applet

(c) Applet is a subclass of Hello (d) Applet is an instance of Hello

4. Which of the following kinds of relationships between classes does inheritance describe?

(a) produces-a (b) has-a

(c) uses-a (d) is-a-kind-of

5. Consider the following Java code fragment where B is a Java class.

Public class A extends B {}

Which of the following is indicated by the code fragment?

(a) Class B must also extend at least one other class. (b) Class A is a subclass of class B.

(c) Class A must also extend class Applet. (d) Class B is a subclass of class A.

6. Which of the following is true concerning the following example

class definition?

public class Hello extends Applet { ... }

Hello is a superclass of Applet Hello inherits from Applet Hello is a subclass of Applet

I. II. III.

(a) II only (b) III only

(c) II and III only (d) I and II only

7. Consider a Java program that contains two classes, Programmer and

Person. The class Programmer is a subclass of the class Person,

and both classes define a method sleep. Which of the following statements will be true about the program?

(a) The method sleep of Person will override that of Programmer when the program is executed.

(b) When the method sleep of Programmer is called, the method sleep

of Person will be called first.

(c) The method sleep of Programmer will override that of Person when the program is executed.

(d) The program will not compile.

8. Which of the following indicates that class Dog is a subclass of class Animal?


ssd1卡耐基选择题(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2011黑龙江省现代预防医学(必备资料)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: