Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
mcq.docx
Скачиваний:
12
Добавлен:
25.02.2016
Размер:
29.56 Кб
Скачать
  1. Which of the following statements imports the entire package java.util into a Java program?

  • import java.util;

  • import util;

  • import util.*;

  • Import java.Util.*;

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

    • .

    • &

    • |

    • +

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

    • ,

    • _

    • "

      • I only

      • I and II only

      • None

      • I, II, and III

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

    • System.in

    • System.out

    • System.err

      • I, II, and III

      • II only

      • III only

      • II and III only

    • 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?

    • Output of a new line character

    • Flushing of the output buffer

      • I only

      • II only

      • None

      • I and II

    • 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 = stdIn.readLine();

      • int value = Integer.parseInt(stdIn);

      • int value = stdIn.readInteger();

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

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

    • Error

    • Runtime

    • IOException

      • I, II, and III

      • I and III only

      • II only

      • I and II only

    • 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 _____.

      • 1, 3

      • 5, 3

      • 5, 1

      • 3, 5

    • 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 _____.

      • unchecked, header

      • checked, body

      • unchecked, body

      • checked, header

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

      • throw IOException();

      • new IOException();

      • IOException();

      • throw new IOException();

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

    • Stepping through method calls, line by line

    • Examining a stack trace

    • Examining values of variables in the current method

      • I and II only

      • I and III only

      • II only

      • I, II, and III

    • 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 over

      • step return

      • resume

      • step into

    • Which of the following is true regarding Java applications?

      • They are interpreted by a Web browser.

      • They are compiled into machine code.

      • They are platform-dependent.

      • They are run using a Java interpreter.

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

    • Java byte code

    • Machine code

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