Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Baza_po_SSD-3.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
13.88 Кб
Скачать

1) Which of the following statements imports the entire package java.util into a Java program?

Import java.Util.*;

2) Which of the following operators can be used to concatenate two String objects in Java?

+

3) Delimiters for the class java.util.StringTokenizer can include which of the following?

  1. ,

  2. _

  3. "

I, II, and III

4) Which of the following streams typically correspond(s) to screen output?

  1. System.in

  2. System.out

  3. System.err

II and III only

5) Consider the following Java statement.

private static java.io.PrintWriter stdOut = new java.io.PrintWriter(System.out, true);

At the end of execution of the Java statement, a call to stdOut.println() would result in which of the following?

  1. Output of a new line character

  2. Flushing of the output buffer

I and II

6) Consider an object stdIn instantiated by the Java statement below.

private static java.io.BufferedReader stdIn = new java.io.BufferedReader( new java.io.InputStreamReader(System.in));

Which of the following lines of code can be used to read an integer value from stdIn?

int value = Integer.parseInt(stdIn.readLine());

7) In Java, which of the following classes is (are) unchecked exceptions?

  1. Error

  2. Runtime

  3. IOException

I and II only

8) Consider the following Java program fragment whose lines have been numbered.

1 2 try { 3 4 } catch (Exception e) { 5 6 }

Code that may throw exceptions should appear on line _____, while code that handles exceptions should appear on line _____.

3, 5

9) If a(n) _____ exception can occur in a method that does not have a catch block to handle that exception, then a throws clause that lists this exception must be part of the method _____.

checked, header

10) Which of the following is a Java statement that could be used to throw an IOException?

throw new IOException();

11) After a breakpoint is hit, a debugger is typically used for which of the following tasks?

I, II, and III

12) When using a debugger to step through a program, if the current line contains a method call, which of the following executes the current line and then stops execution before executing the first line in the called method?

step into

13) Which of the following is true regarding Java applications?

They are run using a Java interpreter.

14) Which of the following is (are) architecture neutral?

  1. Java byte code

  2. Machine code

I only

15) Which of the following identifiers follow(s) Sun's naming conventions for Java constants?

  1. START_DATE

  2. Serving_Size

  3. AnnualFee

I only

16) Which of the following identifiers follow(s) Sun's naming conventions for Java variables?

  1. myvalue

  2. myValue

  3. my_value

II only

17) Which of the following follow(s) Sun's naming conventions for Java methods?

  1. getValue();

  2. GetValue();

  3. GET_VALUE();

I only

18) Which of the following lines follow(s) Sun's guidelines for documenting input parameters in a Javadoc comment?

  1. * @param foo the value to be tested

  2. * @param int foo

  3. * @param the value to be tested

I only

19) Which of the following lines follow(s) Sun's guidelines for documenting the return value in a Javadoc comment?

  1. * @return foo the result of the calculations

  2. * @return the result of the calculations

  3. * @return int foo the result of the calculations

II only

20) If a Java class contains a Boolean variable named rhodesScholar, then the name of the associated accessor method should be

isRhodesScholar

21) Which of the following can be represented in a UML class diagram?

  1. Class name

  2. Class attributes

  3. Class methods

I, II, and III

22) Consider the following UML class diagram with numbered compartments.

1

2

3

Following UML specifications, a private method toggle() would be represented by the element _____ in compartment _____.

-toggle(), 3

23) Consider the following UML class diagram.

The diagram describes a(n) _____ association.

binary

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]