1、SSD3单选1.1.11. The name of a Java source file (d) (a) must be the same as the class it defines, ignoring case (b) must use the extension .class (c) has no restrictions (d) must be the same as the class it defines, respecting case 2. Which method must exist in every Java application? (a)(a) main (b) p
2、aint (c) init (d) begin 1.1.31. Given the following code, how many tokens will be output? (b)StringTokenizer st = new StringTokenizer(this is a test);while (st.hasMoreTokens() stdOut.println(st.nextToken() ); (a) 1 (b) 4 (c) 0 (d) 3 2. Classes from which of the following packages are implicitly impo
3、rted into every Java program? (d) (a)java.awt (b) java.io (c) java.util (d) java.lang 3. What is the name of the wrapper class for the type int? (d) (a) integer (b) Int (c) INT (d) Integer 4. Classes from which of the following packages are implicitly imported into every Java program? (c) (a) java.u
4、til (b) java.awt (c) java.lang (d) java.io 5. The term wrapper classes refers to (a) (a) a collection of Java classes that wrap Java primitive types (b) the Java classes that contain at least two data fields (c) the Java classes that contain themselves (d) a collection of Java classes that contain o
5、ther Java classes 6. What will be output caused by the execution of the following Java program segment? (c)String name = Elvis;System.out.print(name + was here); (a) name + was here (b) Elvis was here (c) Elviswas here (d) name was here 1.1.41. What will be output when the following Java program seg
6、ment is executed? (c) int x = 5; int y = 2; System.out.println(x + y); (a) 5 2 (b) 5+2 (c) 7 (d) 52 2. A difference between the methods print and println of the class java.io.PrintWriter is that (a) (a) println appends a new line to the end of its output, but print does not (b) print appends a new l
7、ine to the end of its output, but println does not (c) println inserts a new line at the beginning of its output, but print does not (d) print inserts a new line at the beginning of its output, but println does not 3. Consider the following Java program segment. (c) int x = 5; int y = 2; System.out.
8、println(x + 1 + y);Which of the following statements is true about the program segment? (a) The output caused by the code will be 8. (b) The output caused by the code will be 5 1 2. (c) The output caused by the code will be 512. (d) The code will cause a compilation error. 1.1.51. All Java exception
9、 classes are derived from the class (a) (a) java.lang.Throwable (b) java.lang.Error (c) java.lang.RuntimeException (d) java.io.IOException 2. In Java, exceptions that are not handled are passed up the (b) (a) exception ladder (b) call stack (c) block hierarchy (d) catch blocks 3. What is the right w
10、ay to handle abnormalities in input on Java? (d) (a) By writing while loops to guard against bad input (b) By always specifying the throws clause in every method header where file I/O is performed (c) By using the class FileFilter which gracefully filters out bad input data (d) By handling these pro
11、blems by providing exception handlers 4. Consider the following Java program segment. import java.io.*;public class SomeClass public void x() throw new RuntimeException(Exception from x); public void y() throw new IOException(Exception from y); Which of the following is true concerning the definitio
12、ns for the methods x and y? (a)(a) x has a legal definition, but y has an illegal definition. (b) x has an illegal definition, but y has a legal definition. (c) Neither x nor y has a legal definition. (d) Both x and y have legal definitions. 1.1.61. Which of the following statements is true of the c
13、onventions outlined by Sun Microsystems in the document entitled Code Conventions for the Java Programming Language? (d) They define a standard interface definition language that must be used for all Java classes. They provide recommendations intended to make source code easier to read and understan
14、d. They describe one mechanism for network communication between Java and C+ programs. (a) III only (b) I and III only (c) I, II, and III (d) II only Feedback: See section 1.1.6, subsection CodeConvTOC and section 1.1, subsection Why Have Code Conventions, in the course notes.2. According to the Jav
15、a code conventions, files that contain Java source code have the suffix _, and compiled bytecode files have the suffix _. (d) (a) .class, .javac (b) .javac, .class (c) .class, .java (d) .java, .class Feedback: See section 1.1.6, subsection CodeConvTOC and section 2.1, subsection File Suffixes, in th
16、e course notes.3. According to the document entitled Code Conventions for the Java Programming Language, file suffixes used by Java software include which of the following? (b).obj .class .h (a) I and III only (b) II only (c) I and II only (d) II and III only 1.1.71. Which of the following patterns
17、of characters opens a Javadoc comment block? (b) (a) /* (b) /* (c) */ (d) / 1.1.81. After a typical debugger encounters a breakpoint, the programmer using the debugger may perform which of the following actions? (a)Examine the values of variables in the halted program Execute the current line Resume
18、 execution of the halted program (a) I, II, and III (b) I and II only (c) I only (d) III only 2. In a typical source-code debugger, a programmer can set a _ to cause a program to stop executing at a particular line of code. (c) (a) test case (b) stack trace (c) breakpoint (d) print statement 3. A st
19、ack trace is (b) (a) a list of variables allocated on a programs stack (b) a sequence of method calls (c) only available through a typical debuggers step into feature (d) a fatal error that causes a typical debugger to terminate 4. A tool that allows programmers to execute lines of a program one lin
20、e at a time in order to help locate the source of a programs errors is known as a(n) (b)(a) stack trace (b) debugger (c) scope (d) exception handler 1.1. 1According to Javadoc convention, the first sentence of each Javadoc comment should be (c) (a) an author tag (b) an version tag (c) a summary sent
21、ence of the declared entry (d) the order of lines is not important Feedback: See for more information. 1.2.11. In a UML class diagrams representation of a class, the top, middle, and lower rectangular compartments respectively describe the _ of the class. (c) (a) attributes, methods, and name (b) at
22、tributes, methods, and constants (c) name, attributes, and methods (d) name, methods, and constants 2. UML class diagrams can describe which of the following? (b)The internal structure of classes Relationships between classes (a) I only (b) I and II (c) None (d) II only 1.2.21. Consider the followin
23、g UML class diagram.According to the diagram, instances of the class named _ have references to instances of the class named _. (a) (a) A, B (b) A, C (c) B, A (d) B, C 2. Consider the following UML class diagram.According to the diagram, which of the following statements is true? (a) (a) ClassA is c
24、omposed of one instance of ClassB and one or more instances of ClassC. (b) ClassB and ClassC are both subclasses of ClassA. (c) ClassB has a one-to-one association with ClassA and a one-to-many association with ClassC. (d) ClassA and ClassB each contain at least one reference to an instance of Class
25、C. 3. A binary association is said to exist between two classes when (a) (a) an object of one class requires an object of the other class (b) one class is a subtype of the other class (c) an object of one class is instantiated in the same method as an object of the other class (d) one class belongs
26、to the same package as the other class 4. The multiplicity of an association between two classes indicates the number of (a) (a) instances of one class that can be associated with an instance of the other class (b) methods of one class that are called by the other class (c) methods and variables com
27、mon to both classes (d) times that one classs methods are called by the other class 5. Which of the following is true about association and aggregation in UML class diagrams? (c) (a) Association is a special form of aggregation. (b) Association is the opposite of aggregation. (c) Aggregation is a sp
28、ecial form of association. (d) Association and aggregation have no meaningful relationship. 1.2.31. A collection typically models a _ relationship. (b) (a) many-to-many (b) one-to-many (c) zero-to-one (d) one-to-one 2. Consider the following UML class diagram. (c)The diagram describes a (a) relation
29、ship between a subclass and a superclass (b) one-to-one relationship (c) self-containing class (d) class without methods 3. Consider the class described by the following diagram:If the class represents an employee and the boss attribute refers to the employees boss, which of the following statements
30、 is (are) true? (c)Many employees can have the same boss. One employee can have many bosses. (a) II only (b) None (c) I only (d) I and II 4. Consider the following UML class diagram. Which of the following is (are) true about the system described by the diagram? (d) An instance of Picture can contai
31、n a collection of instances of the class Shape. An instance of Shape can contain a collection of instances of the class Picture. (a) II only (b) I and II (c) None (d) I only 5. If a class has an association with itself, then the class contains (b) (a) a method that calls itself (b) an attribute that references an object of the same class (
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1