COP3252 Final Exam Questions with Verified 100%
Correct Answers
UDP is a connection-oriented protocol - ✔✔False
Which statement is false? - ✔✔A non-generic class cannot be derived from a generic
class
Which statement is false? - ✔✔A List cannot contain duplicate elements
One generic Stack class could be the basis for creating many Stack classes, e.g.,
Stack<Double>, Stack<Integer> and Stack<Employee>. These classes are known as
__________. - ✔✔parameterized classes
When the compiler translates a generic method into Java bytecodes, it uses __________
to replace the type parameters with actual types. - ✔✔erasure
When a generic class is instantiated without specifying a type argument, it is said to
have a __________. - ✔✔raw type
A(n) __________ allows a program to walk through the collection and remove elements
from the collection. - ✔✔Iterator
The collections framework algorithms are __________, i.e., each of these algorithms can
operate on objects that offer given interfaces without concern to the underlying
implementations. - ✔✔polymorphic
, __________ enable programmers to specify, with a single method declaration, a set of
related methods. - ✔✔Generic methods
Collections method sort that accepts a List as an argument sorts the elements of a List,
which must implement the __________ interface. - ✔✔Comparable
The classes and interfaces which comprise the collections framework are members of
package ________. - ✔✔java.util
An uncaught exception: - ✔✔is an exception that occurs for which there are no
matching catch clauses.
When a __________ method or block is running on an object, the object is locked so no
other such method can run on that object at the same time. - ✔✔synchronized
The preferred means of creating multithreaded Java applications is by implementing the
________ interface. An object of a class that implements this interface represents a task
to perform. - ✔✔Runnable
A new thread begins its life cycle by transitioning to the __________ state. - ✔✔new
To catch an exception, the code that might throw the exception must be enclosed in a -
✔✔try block
Which of the following statements about try blocks is true? - ✔✔The try block should
contain statements that may throw an exception
In the catch block below, what is arithmeticException?
Correct Answers
UDP is a connection-oriented protocol - ✔✔False
Which statement is false? - ✔✔A non-generic class cannot be derived from a generic
class
Which statement is false? - ✔✔A List cannot contain duplicate elements
One generic Stack class could be the basis for creating many Stack classes, e.g.,
Stack<Double>, Stack<Integer> and Stack<Employee>. These classes are known as
__________. - ✔✔parameterized classes
When the compiler translates a generic method into Java bytecodes, it uses __________
to replace the type parameters with actual types. - ✔✔erasure
When a generic class is instantiated without specifying a type argument, it is said to
have a __________. - ✔✔raw type
A(n) __________ allows a program to walk through the collection and remove elements
from the collection. - ✔✔Iterator
The collections framework algorithms are __________, i.e., each of these algorithms can
operate on objects that offer given interfaces without concern to the underlying
implementations. - ✔✔polymorphic
, __________ enable programmers to specify, with a single method declaration, a set of
related methods. - ✔✔Generic methods
Collections method sort that accepts a List as an argument sorts the elements of a List,
which must implement the __________ interface. - ✔✔Comparable
The classes and interfaces which comprise the collections framework are members of
package ________. - ✔✔java.util
An uncaught exception: - ✔✔is an exception that occurs for which there are no
matching catch clauses.
When a __________ method or block is running on an object, the object is locked so no
other such method can run on that object at the same time. - ✔✔synchronized
The preferred means of creating multithreaded Java applications is by implementing the
________ interface. An object of a class that implements this interface represents a task
to perform. - ✔✔Runnable
A new thread begins its life cycle by transitioning to the __________ state. - ✔✔new
To catch an exception, the code that might throw the exception must be enclosed in a -
✔✔try block
Which of the following statements about try blocks is true? - ✔✔The try block should
contain statements that may throw an exception
In the catch block below, what is arithmeticException?