Section 1

Preview this deck

Overriding a method differs from overloading a method because

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (71)

Section 1

(50 cards)

Overriding a method differs from overloading a method because

Front

Overridden methods have the same signature

Back

Which of the following statements is false?

Front

The BigDecimal method format receives a double argument and returns a BigDecimal object that represents the exact value specified.

Back

A string constructor cannot be passed

Front

in Arrays

Back

Which of the following class members should usually be private?

Front

variables or fields

Back

If the superclass contains only abstract method declarations, the superclass is used for

Front

interface inheritance

Back

All of the following methods are implicitly final except:

Front

a method in an abstract class.

Back

Which statement creates the String "JAVA: How to Program"

Front

String 1 = a.concat(b.concat(c))

Back

Assigning a subclass reference to a superclass variable is safe

Front

because the subclass object is an object of its superclass

Back

Which of the following is not a superclass/subclass relationship

Front

Sailboat, Tugboat

Back

Interfaces can have

Front

Any number of methods

Back

Which of the following performs a boxing conversion

Front

Integer x = 7

Back

Superclass methods with this level of access cannot be called

Front

Private

Back

private fields of a superclass can be accessed in a subclass

Front

By calling public or protected methods declared in the superclass

Back

Which class is not a type-wrapper class

Front

Int

Back

Non-abstract classes are called

Front

concrete classes

Back

For String c = "Hello. She sells sea shells"; The Java statements int i = c.indexOf("ll"); int j = c.lastIndexOf("ll"); will result in:

Front

i = 2 and j = 24.

Back

All generic method declarations have a type parameter section delimited by

Front

angle brackets <>

Back

For String c = "Now is the time for all"; The Java statements String i = c.substring(7); String j = c.substring(4, 15); will result in:

Front

i = "the time for all" and j = "is the time "

Back

Interfaces can have ________ methods

Front

Any number of

Back

True or False: The compiler always creates a default constructor for a class

Front

FALSE

Back

All of the following are true for both recursion and iteration except

Front

They both have a base case

Back

Algorithm __________ randomly reorders a list

Front

shuffle

Back

Interface collection contains __________ operations

Front

bulk

Back

Instance variable declared final cannot

Front

be modified after they are initialized

Back

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

Front

String r1 = r.replace('t','T').replace('o', '0').replace('y', 'Y');

Back

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.

Front

containsKey

Back