该文档为JAVAssd3选择题答案完整版,包含了相关课程或测试的选择题答案解析,有助于学生检查和巩固学习成果。不过请注意学术诚信。
Multiple-Choice Quiz 1 aaaba aadda
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) &
(d) ++
3. Which of the following statements about using an asterisk (*) in a Java import statement are true?
I. It does not incur run-time overhead.
II. It can be used to import multiple packages with one statement.
III. It can be used to import multiple classes from a single package with one statement.
(a) I and III only
(b) III only
(c) I only
(d) I, II, and III
4. A difference between the methods print and println of class java.io.PrintWriter is that:
(a) print inserts a new line at the beginning of its output, but println does not.
(b) println appends a new line to the end of its output, while print does not.
(c) println inserts a new line at the beginning of its output, while print does not.
(d) print appends a new line to the end of its output, but println does not.
5. What will be printed when executing this Java program segment?
int x = 5;
int y = 2;
System.out.println(x + y); // The operations are performed in sequence.
(a) 7
(b) 5 2
(c) 5+2
(d) 52
6. What is the correct way to handle input abnormalities in Java?
(a) By providing exception handlers for these problems.
(b) By using while loops to prevent bad inputs.
(c) Through class FileFilter which filters out problematic data gracefully.
(d) Always specifying throws clause in every method header where file I/O is performed.
7. All Java exceptions are derived from the class:
(a) java.lang.Throwable
(b) java.lang.Error
(c) java.io.IOException
(d) java.lang.RuntimeException