收藏 分享(赏)

ssd3选择题汇总_开始复习吧.pdf

上传人:精品资料 文档编号:8379420 上传时间:2019-06-23 格式:PDF 页数:31 大小:312.40KB
下载 相关 举报
ssd3选择题汇总_开始复习吧.pdf_第1页
第1页 / 共31页
ssd3选择题汇总_开始复习吧.pdf_第2页
第2页 / 共31页
ssd3选择题汇总_开始复习吧.pdf_第3页
第3页 / 共31页
ssd3选择题汇总_开始复习吧.pdf_第4页
第4页 / 共31页
ssd3选择题汇总_开始复习吧.pdf_第5页
第5页 / 共31页
点击查看更多>>
资源描述

1、Multiple-Choice Quiz 1 1. Which method must exist in every Java application? (a) main (b) paint (c) begin (d) init 2. Which of the following is the string concatenation operator in Java? (a) + (b) (c) int y = 2; System.out.println(x + y); (a) 7 (b) 5 2 (c) 5+2 (d) 52 6. What is the right way to hand

2、le abnormalities in input on Java? (a) By handling these problems by providing exception handlers (b) By writing while loops to guard against bad input (c) By using the class FileFilter which gracefully filters out bad input data (d) By always specifying the throws clause in every method header wher

3、e file I/O is performed 7. All Java exception classes are derived from the class (a) java.lang.Throwable (b) java.lang.Error (c) java.io.IOException (d) java.lang.RuntimeException 8. According to Javadoc convention, the first sentence of each Javadoc comment should be (a) an version tag (b) the orde

4、r of lines is not important (c) an author tag (d) a summary sentence of the declared entry 9. According to the document entitled Code Conventions for the Java Programming Language, file suffixes used by Java software include which of the following? I. .obj II. .class III. .h (a) I and III only (b) I

5、I and III only (c) I and II only (d) II only 10. A stack trace is (a) a sequence of method calls (b) only available through a typical debuggers step into feature (c) a fatal error that causes a typical debugger to terminate (d) a list of variables allocated on a programs stack 11 The name of a Java

6、source file 选择一个答案 a. has no restrictions b. must be the same as the class it defines, ignoring case c. must use the extension .class d. must be the same as the class it defines, respecting case 12.A tool that allows programmers to execute lines of a program one line at a time in order to help locat

7、e the source of a programs errors is known as a 选择一个答案 a. exception handler b. stack trace c. scope d. debugger 13.Which of the following statements is true of the conventions outlined by Sun Microsystems in the document entitled Code Conventions for the Java Programming Language?。 I They define a s

8、tandard interface definition language that must be used for all Java classes. II They provide recommendations intended to make source code easier to read and understand. III They describe one mechanism for network communication between Java and C+ programs. 选择一个答案 a. II only b. I, II, and III c. I a

9、nd III only d. III only Multiple-Choice Quiz 2 1. UML class diagrams can describe which of the following? I. The internal structure of classes II. Relationships between classes (a) I and II (b) None (c) II only (d) I only 2. In a UML class diagrams representation of a class, the top, middle, and low

10、er rectangular compartments respectively describe the _ of the class. (a) attributes, methods, and name (b) attributes, methods, and constants (c) name, attributes, and methods (d) name, methods, and constants 3. A collection typically models a _ relationship. (a) one-to-one (b) zero-to-one (c) many

11、-to-many (d) one-to-many 4. A relationship that exists between two specific instances of an object is known as a(n) (a) aggregation (b) specialization (c) association (d) link 5. Consider the following UML class diagram. According to the diagram, which of the following statements is true? (a) ClassA

12、 and ClassB each contain at least one reference to an instance of ClassC. (b) ClassB and ClassC are both subclasses of ClassA. (c) ClassA is composed of one instance of ClassB and one or more instances of ClassC. (d) ClassB has a one-to-one association with ClassA and a one-to-many association with

13、ClassC. 6. Consider the following UML class diagram. The diagram describes a (a) class without methods (b) relationship between a subclass and a superclass (c) one-to-one relationship (d) self-containing class 7. Which of the following is true about association and aggregation in UML class diagrams?

14、 (a) Association and aggregation have no meaningful relationship. (b) Association is a special form of aggregation. (c) Association is the opposite of aggregation. (d) Aggregation is a special form of association. 8. Consider the following UML class diagram. Which of the following is (are) true abou

15、t the system described by the diagram? I. An instance of Picture can contain a collection of instances of the class Shape. II. An instance of Shape can contain a collection of instances of the class Picture. (a) None (b) I only (c) II only (d) I and II 9. The static model of a software system typica

16、lly includes which of the following? I. Attributes of classes II. Actions that occur between classes III. Structural relationships between classes (a) II and III only (b) I and III only (c) I, II, and III (d) I and II only 10. An object model describes which of the following? I. Attributes of classe

17、s II. Methods of classes III. Relationships between classes (a) I, II, and III (b) I and II only (c) II and III only (d) I and III only 11.Which of the following parts of an if-else-statement is optional? 选择一个答案 a. the else part b. the condition c. the if part d. the parenthesis around the condition

18、 12. Which of the following is the Java loop construct typically used when the range is clear? 选择一个答案 a. for-loop b. switch-loop c. while-loop d. do-while-loop 13.The primitive floating-point types available in Java are _ and _. 选择一个答案 a. float , double b. real, double c. single , real d. real , flo

19、at 14.How many bytes are required to represent a Unicode character? 选择一个答案 a. One b. Three c. Four d. Two 15.How many lines of output will be produced by the following code fragment? for (int i = 0; i 4; +i) for (int j = 1; j 3 ; +j) stdOut.println(i + j); 选择一个答案 a. 6 b. 12 c. 8 d. 10 16.How many li

20、nes of output will be produced by the following code fragment? for (int i = 0; i 3; +i) for (int j = 0; j i; +j) stdOut.println(i + j); 选择一个答案 a. 6 b. 3 c. 4 d. 5 17.The term wrapper classes refers to 选择一个答案 a. a collection of Java classes that “wrap“ Java primitive types b. a collection of Java cla

21、sses that contain other Java classes c. the Java classes that contain at least two data fields d. the Java classes that contain themselves 18.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

22、; int count = 0; while (st.hasMoreTokens() s = st.nextToken(); +count; stdOut.println(count); 选择一个答案 a. 3 b. 6 c. 1 d. 4 19.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? 选择一个答案

23、a. The output caused by the code will be 5 1 2. b. The code will cause a compilation error. c. The output caused by the code will be 8. d. The output caused by the code will be 512. 20.In programming, a loop is generally used to achieve 选择一个答案 a. repetition b. branching c. selection d. succession 21

24、.What is the name of the wrapper class for the type int? 选择一个答案 a. integer b. INT c. Int d. Integer Multiple-Choice Quiz 3 1. Which of the following categorizations can be applied to both the data fields and the methods in a Java class? (a) native and non-native (b) default and non-default (c) stati

25、c and non-static (d) abstract and non-abstract 2. Consider the following Java program segment. import java.io.*; public class Test public Test( ) System.out.println(“default“); public Test( int i ) System.out.println(“non-default“); public static void main(String args) Test t = new Test(2); Which of

26、 the following will be output during execution of the program segment? (a) The line of text “non-default“ (b) The line of text “default“ (c) The line of text “non-default“ followed by the line of text “default“ (d) The line of text “default“ followed by the line of text “non-default“ 3. The return t

27、ype for a method that returns nothing to its caller is (a) void (b) false (c) not specified in the method definition (d) null 4. If a class contains a constructor, that constructor will be invoked (a) each time an object of that class is instantiated (b) once the first time an object of that class i

28、s instantiated (c) each time an object of that class goes out of scope (d) once at the beginning of any program that uses that class 5. Which of the following statements about constructors in Java is true? (a) A class must define at least one constructor. (b) A class can define more than one constru

29、ctor. (c) A constructor must be defined as public. (d) A constructor must be defined as static. 6. What is used to indicate that a method does not return a value? (a) the keyword void (b) the name of the class to which it belongs (c) the omission of the return type (d) the keyword static 7. When a s

30、ubclass defines an instance method with the same return type and signature as a method in its parent, the parents method is said to be (a) hidden (b) overridden (c) private (d) overloaded 8. Which is a Java access modifier used to designate that a particular data field will not be inherited by a sub

31、class? (a) final (b) default (c) protected (d) private 9. If the method int sum(int a, int b) is defined in a Java class C, which of the following methods cannot coexist as a different method in class C? (a) int sum(float a, int b) (b) int sum(int x, float y) (c) int sum(int x, int y) (d) float sum(

32、int x, float y) 10. Consider the following Java class definitions. public class Object1 protected String d() return “Hi“; public class Object2 extends Object1 protected String d() return super.d(); Which of the following statements is (are) true regarding the definitions? I. Class Object2 inherits f

33、rom class Object1. II. Class Object2 overrides method d. III. Method d returns equivalent results when executed from either class. (a) I and II only (b) I, II, and III (c) III only (d) I and III only Multiple-Choice Quiz 4 1. Consider the Java program below. public class Arr public static void main(

34、String args) int a = 1, 2, 3; System.out.println(a1); System.out.println(a3); Which of the following is true about the result of executing the program? (a) The number 2 is printed and a run-time exception terminates execution. (b) The number 2 is printed and there is no abnormal termination. (c) The

35、 number 1 is printed and there is no abnormal termination. (d) The number 3 is printed and a run-time exception terminates execution. 2. Regarding the following declaration, what is the index of the element containing 45? int numbers = -1, 45, 6, 132; (a) 2 (b) 0 (c) 1 (d) 45 3. A Java array that co

36、ntains n components will be indexed from _ through _. (a) 0, n-1 (b) 1, n (c) 0, n (d) 1, n-1 4. Consider the following Java program segment. String str = “Three“,“Two“,“One“; for (int i = 0; i str.length; +i) System.out.println(stri+“/“); What will be output upon execution of the program segment? (

37、a) Three/Two/One/ (b) One/Two/Three/ (c) One,Two,Three (d) Three,Two,One 5. Legal Java statements to initialize an array reference include which of the following? I. int aobj = 0, 1, 2; II. int4 aobj = 0, 1, 2; III. int aobj = new int3; (a) I and II only (b) I only (c) III only (d) I and III only 6.

38、 An object that contains methods that traverse a vector linearly from start to finish is known as a(n) (a) loop (b) iterator (c) int (d) Exception 7. The class java.util.Vector implements a collection that (a) cannot be accessed using an integer index (b) can only store instances of the class java.l

39、ang.String (c) can grow to accommodate new items (d) can only store primitive variables such as int or boolean 8. Consider the following method call, where v is an instance of the class java.util.Vector. v.size(); This method call returns the number of (a) bytes used by v (b) times that the method v

40、.add has been called (c) Vector objects that have been instantiated (d) elements in the vector represented by v 9. In which of the following ways can items be added to a collection implemented by java.util.Vector? I. Items can be inserted at the beginning of the collection. II. Items can be inserted

41、 between two existing items in the collection. III. Items can be appended to the end of the collection. (a) III only (b) I and III only (c) I, II, and III (d) I only 10. Array elements may only be retrieved using _, whereas vector elements may also be retrieved using _. (a) indexes, iterators (b) it

42、erators, indexes (c) names, indexes (d) indexes, names Multiple-Choice Quiz 5 1. The subclass of an abstract class must (a) be abstract and implement all of the parents abstract methods (b) implement all of the parents abstract methods (c) be abstract (d) be abstract or implement all of the parents

43、abstract methods 2. Which of the following statements is (are) true about any abstract method in Java? I. It contains no definition. II. It cannot be declared public. (a) None (b) II only (c) I and II (d) I only 3. Which of the following statements about Java classes is (are) accurate? I. A class ma

44、y have only one parent. II. Two or more classes may share a parent. (a) I and II (b) None (c) I only (d) II only 4. Which of the following statements is (are) true in Java? I. All of the methods in an abstract class must be abstract. II. All of the methods in an interface must be abstract. (a) None

45、(b) I and II (c) I only (d) II only 5. Which of the following statements is (are) true about inheritance in Java? I. A class can extend more than one abstract class. II. A class can implement more than one interface. (a) II only (b) None (c) I and II (d) I only 6. Which of the following statements i

46、s (are) true in Java? I. An abstract class may contain data fields. II. Interfaces may contain data fields. (a) I only (b) II only (c) None (d) I and II 7. Which of the following statements is (are) true about interfaces in Java? I. Interfaces can extend other interfaces. II. Interfaces can contain

47、data fields. (a) I only (b) II only (c) None (d) I and II 8. A design pattern is typically used to (a) ensure that code executes at optimal speed during runtime (b) reduce the number of classes in the design of a program (c) allow the use of object-orientated concepts in a language that is not objec

48、t-oriented (d) describe a practical solution to a common design problem 9. Consider the following definition of a Java class. public class C private static C instance = null; private C() public static C getInstance() if (instance = null) instance = new C(); return C; This class is an example of the

49、design pattern (a) Singleton (b) Strategy (c) Adapter (d) Decorator 10. 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) II only (b) None (c) I and II (d) I only Multiple-Choice Quiz 6 1. If a file o

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报