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

I and II only

60) Consider the following Java program segment.

class Aircraft { void takeOff() {...} } class Helicopter extends Aircraft { void takeOff() {...} } ... Helicopter h = new Helicopter(); Aircraft a = new Aircraft(); Aircraft ah = new Helicopter();

Execution of which of the following lines would cause the method takeoff of the class Helicopter to be executed?

  1. h.takeOff();

  2. a.takeOff();

  3. ah.takeoff();

I and III only

61) In Java, which of the following can appear in abstract classes but not in interfaces?

  1. Definitions of instance variables

  2. Implementation of methods

  3. Implementation of constructors

I, II, and III

62) In Java, which of the following is (are) true regarding interfaces?

  1. An interface can extend a class.

  2. An interface can extend multiple interfaces.

II only

63) A singleton class typically refers to its instance via a _____ variable.

private static

64) In singleton classes, the constructor is _____ to ensure that instantiation is controlled through a(n) _____ method.

private, static

65) Which of the following is (are) true regarding the strategy design pattern?

  1. A family of algorithms are combined into a large single method.

  2. Polymorphism is used.

II only

66) In a strategy design pattern, the desired algorithm is specified and invoked via a(n)

context class

67) What kinds of abstract classes, if any, can be instantiated?

None

68) In Java, for a subclass of an abstract class not to be abstract, the subclass must override which of the following?

  1. All inherited abstract methods

  2. All inherited methods that are not abstract

I only

69) Consider the following line of Java code.

PrintWriter fileOut = new PrintWriter(new FileWriter("out.txt", true));

Which of the following is (are) true about the result of executing the line of code?

  1. If the file out.txt exists, its contents will be erased.

  2. If the file out.txt does not exist, it will be created.

II only

70) Which of the following is (are) true regarding file input in Java?

  1. FileReader and BufferedReader are defined in the package java.lang.

  2. A BufferedReader object can receive data from a FileReader object.

  3. A BufferedReader object can read entire lines of data.

II and III only

71) In Java, which of the following registers a listener for a radio button click event?

addActionListener

72) Which of the following is a line of code that registers a named inner class as an event listener for a JList object in Java?

addListSelectionListener(new ListListener());

73) In Java, which of the following is (are) true regarding JTextArea objects?

  1. They support background and foreground colors.

  2. They have built-in scrollbar capability.

  3. They can be read-only.

I and III only

74) Which of the following is (are) true regarding event handling in Java?

  1. A single listener object can be registered to handle all button presses in an application.

  2. A different listener object can be registered with each button in an application.

I and II

75) In Java, which of the following terminates a program?

System.exit(0)

76) A user clicking a JButton component in Java generates which of the following events?

  1. Action

  2. Mouse pressed

  3. Mouse clicked

I, II, and III

77) Which of the following is a Java layout manager that automatically wraps components to the next available row if they cannot fit on the current row?

FlowLayout

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