Deck 4: Data Abstraction: The Walls
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/60
Play
Full screen (f)
Deck 4: Data Abstraction: The Walls
1
The ADT sorted list inserts and deletes items by their ______.
A)name
B)value
C)position name
D)position number
A)name
B)value
C)position name
D)position number
B
2
Which of the following operations of the ADT list changes the list?
A)remove
B)isEmpty
C)size
D)get
A)remove
B)isEmpty
C)size
D)get
A
3
The items in the ADT list are referenced by ______.
A)name
B)value
C)position number
D)position name
A)name
B)value
C)position number
D)position name
C
4
A(n)______ can be used to precisely specify the behavior of each of the operations of an ADT.
A)exception
B)data structure
C)axiom
D)client
A)exception
B)data structure
C)axiom
D)client
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
5
A method's contract includes the method's ______.
A)code
B)algorithm(s)
C)implementation
D)specifications
A)code
B)algorithm(s)
C)implementation
D)specifications
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
6
A(n)______ is a Java construct that enables a programmer to define a new data type.
A)class
B)method
C)data field
D)object
A)class
B)method
C)data field
D)object
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
7
Encapsulation combines an ADT's data with its operations to form a(n)______.
A)exception
B)method
C)object
D)variable
A)exception
B)method
C)object
D)variable
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
8
Data structures are part of an ADT's ______.
A)definition
B)implementation
C)specifications
D)usage
A)definition
B)implementation
C)specifications
D)usage
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
9
An ADT's ______ govern(s)what its operations are and what they do.
A)specifications
B)implementation
C)documentation
D)data structure
A)specifications
B)implementation
C)documentation
D)data structure
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
10
Object-oriented programming views a program as ______.
A)a sequence of actions
B)a sequence of statements
C)a group of methods
D)a collection of objects
A)a sequence of actions
B)a sequence of statements
C)a group of methods
D)a collection of objects
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
11
An ADT's operations are known as its ______.
A)axioms
B)methods
C)variables
D)interfaces
A)axioms
B)methods
C)variables
D)interfaces
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
12
In the following list: John,Kate,Fred,Mark,Jon,Adam,Drew
Which element does not have a predecessor?
A)John
B)Mark
C)Drew
D)Kate
Which element does not have a predecessor?
A)John
B)Mark
C)Drew
D)Kate
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
13
In the ADT list,when an item is deleted from position i of the list,______.
A)the position of all items is decreased by 1
B)the position of each item that was at a position smaller than i is decreased by 1
C)the position of each item that was at a position greater than i is decreased by 1
D)the position of each item that was at a position smaller than i is increased by 1 while the position of each item that was at a position greater than i is decreased by 1
A)the position of all items is decreased by 1
B)the position of each item that was at a position smaller than i is decreased by 1
C)the position of each item that was at a position greater than i is decreased by 1
D)the position of each item that was at a position smaller than i is increased by 1 while the position of each item that was at a position greater than i is decreased by 1
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
14
A program that uses an ADT is called a(n)______.
A)data structure
B)interface
C)axiom
D)client
A)data structure
B)interface
C)axiom
D)client
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
15
The specifications of an ADT's operations indicate ______.
A)what the operations do
B)how to implement the operations
C)how to store the data in the ADT
D)how to carry out the operations
A)what the operations do
B)how to implement the operations
C)how to store the data in the ADT
D)how to carry out the operations
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
16
In the following list: John,Kate,Fred,Mark,Jon,Adam,Drew
Which element is the head of the list?
A)John
B)Mark
C)Drew
D)Adam
Which element is the head of the list?
A)John
B)Mark
C)Drew
D)Adam
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
17
A(n)______ allows two modules to communicate with each other.
A)data structure
B)axiom
C)interface
D)client
A)data structure
B)axiom
C)interface
D)client
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
18
The insertion operation of the ADT list can insert new items ______.
A)only at the front of the list
B)only at the end of the list
C)only in the middle of the list
D)into any position of the list
A)only at the front of the list
B)only at the end of the list
C)only in the middle of the list
D)into any position of the list
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
19
In the ADT list,when an item is inserted into position i of the list,______.
A)the position of all items is increased by 1
B)the position of each item that was at a position smaller than i is increased by 1
C)the position of each item that was at a position greater than i is increased by 1
D)the position of each item that was at a position smaller than i is decreased by 1 while the position of each item that was at a position greater than i is increased by 1
A)the position of all items is increased by 1
B)the position of each item that was at a position smaller than i is increased by 1
C)the position of each item that was at a position greater than i is increased by 1
D)the position of each item that was at a position smaller than i is decreased by 1 while the position of each item that was at a position greater than i is increased by 1
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
20
In the following list: John,Kate,Fred,Mark,Jon,Adam,Drew
Which element is the tail of the list?
A)John
B)Mark
C)Drew
D)Adam
Which element is the tail of the list?
A)John
B)Mark
C)Drew
D)Adam
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
21
A(n)______ is an instance of a class.
A)method
B)data field
C)interface
D)object
A)method
B)data field
C)interface
D)object
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is true about runtime exceptions?
A)they must be handled locally
B)they must be explicitly thrown from the method
C)they are used in situations where the method has encountered a serious problem
D)they can often be prevented by fail-safe programming
A)they must be handled locally
B)they must be explicitly thrown from the method
C)they are used in situations where the method has encountered a serious problem
D)they can often be prevented by fail-safe programming
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
23
All the items in a list must be of the same data type.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
24
A default Java constructor has a single parameter.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
25
Data structures are part of an ADT's implementation.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
26
A class contains methods and ______.
A)clients
B)interfaces
C)data fields
D)data structures
A)clients
B)interfaces
C)data fields
D)data structures
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
27
To ______ an exception means to deal with the error condition.
A)throw
B)catch
C)implement
D)declare
A)throw
B)catch
C)implement
D)declare
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
28
A method indicates that an error has occurred by ______ an exception.
A)throwing
B)catching
C)implementing
D)declaring
A)throwing
B)catching
C)implementing
D)declaring
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
29
In Java,a class can extend ______.
A)at most 1 class
B)at most 16 classes
C)at most 32 classes
D)as many classes as required
A)at most 1 class
B)at most 16 classes
C)at most 32 classes
D)as many classes as required
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
30
According to the principle of information hiding,a module should be completely isolated from other modules.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
31
An abstract data type is another name for a data structure.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
32
The ______ keyword is used to call the constructor of the superclass.
A)extends
B)super
C)this
D)implements
A)extends
B)super
C)this
D)implements
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
33
By default,all members in a class are public.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
34
The head of a list does not have a successor.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
35
Any instance of a subclass can be used in a program anywhere that an instance of the superclass can be used.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
36
The definition of a subclass includes a(n)______ clause to indicate its superclass.
A)extends
B)super
C)this
D)implements
A)extends
B)super
C)this
D)implements
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
37
All constructors in Java have a return type of void.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
38
A(n)______ is a class that inherits the members of another class.
A)base class
B)superclass
C)abstract class
D)subclass
A)base class
B)superclass
C)abstract class
D)subclass
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following is true about a constructor in Java?
A)all constructors have a return type of void
B)a constructor cannot have parameters
C)a constructor has the same name as the class
D)a class can only have a single constructor
A)all constructors have a return type of void
B)a constructor cannot have parameters
C)a constructor has the same name as the class
D)a class can only have a single constructor
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
40
An application can use the operations of an ADT without knowing how the ADT is implemented.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
41
What is a data structure?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
42
Define the client of a class?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
43
Give three examples of ADT operations that ask questions about the data in a collection.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
44
What is information hiding?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
45
How do checked exceptions and runtime exceptions differ in the way that they are handled?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
46
What are the three types of operations on data?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
47
What is procedural abstraction?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
48
What feature of Java allows you to enforce information hiding when you define a class such as an ADT?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
49
What is a constructor?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
50
What is an abstract data type (ADT)?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
51
Do all Java source files define classes? Explain.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
52
What is a superclass?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
53
What is the difference between the physical size and the logical size of an array?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
54
What is data abstraction?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
55
When is a compiler-generated default constructor created?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
56
What does it mean for a class to "implement an interface" ?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
57
What are exceptions used for?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
58
If an ADT list is implemented as an array,why would it be necessary for the ADT operations to "shift" elements?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
59
What are some of the benefits of modularity?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
60
What is an axiom?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck