Object Oriented Programming Quiz 2

¡Supera tus tareas y exámenes ahora con Quizwiz!

____________ refers to the process of associating a method definition with a method invocation. (a) Binding (b) Encapsulation (c) Inheritance (d) Polymorphism

(a) Binding

In Java, when you open a text file you should account for a possible: (a) FileNotFoundException (b) FileFullException (c) FileNotReadyException (d) all of the above

(a) FileNotFoundException

All exceptions are descendants of the class: (a) Throwable (b) Catchable (c) Tryable (d) Blockable

(a) Throwable

A class with no abstract methods is called a (a) concrete class (b) encapsulated class (c) abstract class (d) private class

(a) concrete class

Class and method definitions that include parameters for types are called: (a) generics (b) ArrayList (c) Base type (d) None of the above

(a) generics

All of the following are methods of the ArrayList class except: (a) length() (b) size() (c) set() (d) get()

(a) length()

In Java, a derived class can have ________ base class(es). (a) one (b) two (c) three (d) there is no limit

(a) one

An interface and all of its method headings are normally declared to be: (a) public (b) private (c) protected (d) package access

(a) public

A __________ path name gives the path to a file, starting with the directory that the program is in. (a) relative (b) descendant (c) full (d) complete

(a) relative

A/An ____________ can change the length while the program is running. (a) Array (b) ArrayList (c) Type parameter (d) None of the above

(b) ArrayList

When using the Scanner class one should account for a/an: (a) NumberFormatException (b) InputMismatchException (c) ArrayIndexOutOfBoundsException (d) PowerFailureException

(b) InputMismatchException

If a method does not catch an exception, then it must at least warn programmers that any invocation of the method might possibly throw an exception. This warning is called a/an: (a) Exception handler (b) Throws clause (c) Try block (d) Catch block

(b) Throws clause

A Java interface is an example of: (a) encapsulation (b) abstraction (c) polymorphism (d) all of the above

(b) abstraction

A method marked as final means the compiler uses ________ binding. (a) dynamic (b) early (c) late (d) none of the above

(b) early

A _________ block executes regardless of whether an exception occurs. (a) final (b) finally (c) catch (d) none of the above

(b) finally

The method __________ from the File class forces a physical write to the file of any data that is buffered. (a) close() (b) flush() (c) writeUTF() (d) writeObject()

(b) flush()

The scanner class has a series of methods that checks to see if there is any more well-formed input of the appropriate type. These methods are called __________ methods: (a) nextToken (b) hasNext (c) getNext (d) testNext

(b) hasNext

Try blocks contain code that could possibly: (a) handle an exception (b) throw an exception (c) catch an exception (d) display an exception

(b) throw an exception

A runtime exception is a/an: (a) checked exception (b) unchecked exception (c) offending exception (d) none of the above

(b) unchecked exception

There are two common classes used for reading from a text file. They are: (a) PrintWriter and BufferedReader (b) FileInputStream and Scanner (c) BufferedReader and Scanner (d) None of the above

(c) BufferedReader and Scanner

__________ refers to the ability to associate many meanings to one method name by means of the late binding mechanism. (a) Inheritance (b) Encapsulation (c) Polymorphism (d) None of the above

(c) Polymorphism

When defining your own exception class, you extend an existing exception class. This is an example of: (a) polymorphism (b) encapsulation (c) inheritance (d) all of the above

(c) inheritance

To use the Java class ArrayList, you must import the package: (a) java.awt (b) java.io (c) java.util (d) java.container

(c) java.util

ArrayIndexOutOfBoundsException is a descendent of the class RuntimeException. This means: (a) the exception must be caught (b) a finally block must be included (c) the exception does not have to be explicitly caught (d) none of the above

(c) the exception does not have to be explicitly caught

A class that uses an interface must use the keyword: (a) Extends (b) Inherits (c) Super (d) Implements

(d) Implements

You cannot create an object using a/an: (a) superclass constructor (b) subclass constructor (c) ancestor class constructor (d) abstract class constructor

(d) abstract class constructor

Java does not use late binding for methods marked as: (a) final (b) static (c) private (d) all of the above

(d) all of the above

The stream that is automatically available to your Java code is: (a) System.out (b) System.in (c) System.err (d) all of the above

(d) all of the above

Assigning an object of an ancestor class to a descendent class is called: (a) static binding (b) dynamic binding (c) upcasting (d) downcasting

(d) downcasting

Exception handling is an example of a programming methodology known as: (a) structured programming (b) object oriented programming (c) goto programming (d) event-driven programming

(d) event-driven programming

An interface specifies the headings and definitions for methods that must be defined in any class that implements the interface. (T/F)

False

Exceptions that must follow the Catch or Declare Rule are often called unchecked exceptions. (T/F)

False

Inner and outer classes do not have access to each other's private members. (T/F)

False

Java interfaces are a way of simulating multiple inheritance. (T/F)

True

The throw operator causes a change in the flow of control. (T/F)

True


Conjuntos de estudio relacionados

NSG132 Chapter 49 Diabetes Mellitus

View Set

ib business management advantages and disadvantages partnership

View Set

COMM 400 Final Exam Part One ( 8-12)

View Set

Seven Major Functions of Proteins

View Set

Stats midterm chapter 1 study guide

View Set