Which of the following could be used to declare abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)?
Front
public abstract int method1();
Back
The UML distinguishes interface from other classes by placing the word interface in what above the interface name
Front
guillemets
Back
A _______ class can't be instantiated
Front
abstract
Back
Which statement about hashing is false
Front
A load factor of 1.0 usually results in good hashing performance but less utilization of memory
Back
Given the following declarations:
StringBuilder buffer = new StringBuilder("Testing Testing");
buffer.setLength(7);
buffer.ensureCapacity(5);
Which of the following is true?
Front
buffer has capacity 31
Back
Which of the following is not a word character?
Front
&
Back
Polymorphism enables you to
Front
Program in the general
Back
True or False: Clients are usually involve in a class's implementation
Front
FALSE
Back
Generics provide __________ that allows programmers to catch invalid type
Front
compile type safety
Back
An advantage of inheritance is that
Front
Objects of a subclass can be treated like objects of their superclass
Back
Recursion is often preferable to iteration because
Front
It follows more logically
Back
True or False: References to interface types do not have access to method toString.
Front
FALSE
Back
The statement
s1.startsWith("art")
has the same result as which of the following?
Front
all of the above
Back
A __________ allows a program to walk through the collection and remove elements from it
Front
Iterator
Back
Which interface is specifically intended to be implemented by classes that can be used with the try-with-resources statement
Front
Auto closable
Back
Consider the String below:
String r = "a toyota";
Which of the following will create the String r1 = "a TOYOTa"?
A programmer defined constructor that has no arguments is called a
Front
No argument constructor
Back
When implementing a method, use the class's set and get methods to access the class's ________ data.
Front
private
Back
A recursive method
Front
All of the above
Back
An anonymous String ____
Front
is a string literal
Back
A constructor cannot
Front
Have the same name as its class
Back
To find the character at a certain index position within a string, use the method
Front
charAt with the index
Back
Collections method sort that accepts List as an argument. It sorts the List elements which must implement the ___________ interfaces
Front
comparable
Back
Which of the following statements is true
Front
Both A and A+ will match AAA but only A will match an empty string
Back
When no access modifier is specified for a method or variable, the method or variable:
Front
Has package access
Back
A final field should also be declared ________ if it is initialized in its declaration.
Front
Static
Back
Section 2
(21 cards)
Class Number is ________ of both Integer and Double.
Front
the superclass
Back
When the compiler translates a generic method into Java bytecodes, it uses __________ to replace the type parameters with actual types.
Front
erasure
Back
Comparator method compare should return ________ if the first argument is greater than the second argument.
Front
a positive int value.
Back
Which of the following is not a method of class String?
Front
toCharacterArray
Back
Which statement is false?
Front
The only operation permitted on the view returned by Arrays method asList is delete, which deletes the value from the view and the backing array.
Back
Which of the following is not an abstract implementation provided by the collections framework?
Front
AbstractTree
Back
The number of calls to recursively calculate the Fibonacci value of 7 is:
Front
41
Back
Suppose Stack is a generic class that has one type parameter. The assignment
Stack<Integer> integerStack = new Stack(10);
Front
is permitted but unsafe, the compiler issues a warning message.
Back
Can a list contain duplicate elements?
Front
YES
Back
Which statement is false?
Front
The methods for primitive types correspond to the methods for the corresponding type-wrapper classes.
Back
Which of the following statements about recursion are true?
Front
recursion can occur infinitely and uses a termination test
Back
Which of these is not an example of a "real-life" collection?
Front
The number of pages in a book.
Back
When a generic class is instantiated without specifying a type argument, it is said to have a __________.
Front
raw type
Back
If no elements are in the Stack, method pop throws an __________.
Front
EmptyStackException.
Back
Consider the statement below:
StringBuilder sb1 = new StringBuilder("a toyota");
Which of the following creates a String object with the value "toy"?
Front
Both A and B
Back
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 __________.
Front
parametrized classes
Back
Are built in collections synchronized
Front
NO
Back
Generics provide __________ that allows programmers to catch invalid types at compile time.
Front
compile-time type safety
Back
Recursion is often less efficient than iteration because ________.
Front
it can cause an explosion of method calls
Back
After a fractal's pattern is applied several times, the shape of the fractal will generally become ________.
Front
Stablized and more detailed
Back
Map method ________ is used to determine whether a map contains a mapping for the specified key.