Chapter 20-21 Quiz ?s Flashcards

1
Q

Which statement is false?

A linked list is appropriate when the number of data elements to be shown is unpredictable

By convention, the link reference in the last node of a list is set to null to mark the end

A linked list is a linear collection of self-referential class objects called nodes connected by reference links

A linked list is a fixed-size data structure

A

A linked list is NOT a fixed size data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Java performs automatic ______ of objects that are no longer referenced in a program

A

Garbage collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which is false?

Because a wildcard is a type-parameter name, you can use it as a type name throughout a method’s body

If a wildcard is specified without an upper bound, than only the methods of type Object can be invoked on values of the wildcard type

A wildcard type argument is denoted by ? Which represents unknown type

Wildcard type arguments enable you to specify method parameters, return values, variables and so on, that act as super types of parameterized types

A

You cannot use a wildcard as a type name throughout a method’s body. It enables you to specify the method’s parameters, return values, variables or fields, etc. as supertypes or subtypes of parameterized types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What example is this:

List extends [class name]>

A

Wildcard type argument. It can receive any argument

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

All generic method declarations have a type parameter section delimited by _______

A

Angle brackets (< and >)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Generics provide _____ that allows programmers to catch invalid types at compile time

A

Compile-time type safety

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

False?

Insertions and deletions are made only at one end of a queue-tail

Binary trees facilitate high speed searching and sorting of data

Insertions and deletions are made only at one end of a stack it’s too

Linked lists are collections of data items “lined up in a row” insertions and deletions can be made anywhere in a linked list

A

Insertions are made at the back (tail)

Deletions are made at the front (head)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A queue is a _____ data structure

A

FIFO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Queue nodes are removed only from the ___ of the queue, and are inserted only at the _____ of the queue

A

Head

Tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Usually a ____ _______ in Java code indicates the end of a data structure

A

Null reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Suppose Stack is a generic class that has one type parameter

The assignment is

A

Permitted but unsafe, the compiler issues a warning message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which statement is false?

A nose can be inserted at any point in a binary search tree

The binary search tree facilitates duplicate elimination

The shape of a binary search tree that corresponds to a set of data can vary depending on the order in which the values are inserted into the tree

The process of creating a binary search tree actually sorts the data, and thus this process is called the binary tree sort

A

A node cannot be inserted at any point in a binary tree because it will through off the sorting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

______ is the default upper bound of a type parameter

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A stack is a ______ data structure

A

LIFO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which is not a typical application of queues?

High speed sorting

Routing packets in a computer network

File server handling file access requests from many clients

Print spooling

A

High speed sorting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A package is _______

A directory structure to organize classes and interfaces
A mechanism for software reuse
A group of related classes and interfaces
All of these

A

All