Deck 3: Introduction to Collections - Stacks
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/49
العب
ملء الشاشة (f)
Deck 3: Introduction to Collections - Stacks
1
What is the principle difference in behavior between a stack and a queue?
A) a stack reverses order whereas a queue preserves order
B) a stack does nothing whereas a queue can preserve and reverse order
C) there is no difference
D) a stack preserves order whereas a queue reverses order
A) a stack reverses order whereas a queue preserves order
B) a stack does nothing whereas a queue can preserve and reverse order
C) there is no difference
D) a stack preserves order whereas a queue reverses order
a stack reverses order whereas a queue preserves order
2
Stacks operate as _______________.
A) Last Out, First In
B) First In, First Out
C) Last In, First Out
D) None of the above
A) Last Out, First In
B) First In, First Out
C) Last In, First Out
D) None of the above
Last Out, First In
3
A ______ can be used to reverse the order of a set of data.
A) Queue
B) Stack
C) Software
D) Heaps
A) Queue
B) Stack
C) Software
D) Heaps
Stack
4
A pop operation on a Stack returns a(n)
A) node
B) element
C) variable
D) pointer
A) node
B) element
C) variable
D) pointer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
5
To add an element to a stack you use the method.
A) push
B) pop
C) peek
D) size
A) push
B) pop
C) peek
D) size
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following is the correct way to instantiate an array of 10 generic objects?
A) T[] x = new T[10];
B) T[10] x = new T[];
C) T[] x = (T[])(new object[10]);
D) None of the above
A) T[] x = new T[10];
B) T[10] x = new T[];
C) T[] x = (T[])(new object[10]);
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
7
Elements in a collection are typically organized by
A) the order of their addition to the collection
B) by some inherent relationship among the elements
C) randomly
D) A and B
E) None of the above
A) the order of their addition to the collection
B) by some inherent relationship among the elements
C) randomly
D) A and B
E) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
8
A polymorphic reference uses _______________, not the type of the reference, to determine which version of a method to invoke.
A) the type of the object
B) the type of the reference
C) both A and B
D) none of the above
A) the type of the object
B) the type of the reference
C) both A and B
D) none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
9
In an array implementation of a Stack, the array is ___________ causing the implementation to have to create a new larger array and copy the contents of the stack into the new array in order to expand the capacity of the stack.
A) Dynamic
B) Static
C) Flexible
D) Polymorphic
A) Dynamic
B) Static
C) Flexible
D) Polymorphic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
10
The variable top in the array implementation of a Stack refers to
A) The next available position in the array
B) The item at the top of the Stack
C) The number of items in the stack
D) A and C
E) None of the above
A) The next available position in the array
B) The item at the top of the Stack
C) The number of items in the stack
D) A and C
E) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
11
A ______ is an object that gathers and organizes other objects.If you were to place elements on a collection and then wanted to reverse the order, would it be better to use a Stack or a Queue?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
12
What are the 3 primary methods for a stack?_______
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
13
If an exception occurs during the execution of a java program and is not handled in the method where it occurs, the exception will be ______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
14
A __ is a Java language element used to group related classes under a common name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
15
The term polymorphism refers to a reference variable that can point to different types of objects. This can be accomplished in Java through the use of ____ and ____.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
16
A collection is an ______ where the details of the implementation are hidden.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
17
____ is the process of deriving a new class from an existing one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
18
One purpose of inheritance is to ____ existing software.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
19
______ and ______ represent unusual or invalid processing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
20
The messages printed by a thrown exception indicate the nature of the problem and provide a method _______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
21
Each ______ on a try statement handles a particular kind of exception that may be thrown within the try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
22
A Java interface defines a set of ______ methods and is useful in separating the concept of an abstract data type from its implementation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
23
All Java classes are derived, directly or indirectly, from the ______ class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
24
The toString and equals methods are defined in the Object class and therefore are ______ by every class in every Java program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
25
By using the interface name as a return type, the interface doesn't commit the method to the use of any particular class that implements a stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
26
If an exception is not caught and handled where it occurs, it is propagated to the calling method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
27
The implementation of the collection operations should affect the way users interact with the collection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
28
A well-defined interface masks the implementation of the collection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
29
An array dynamically grows as needed and essentially has no capacity limitations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
30
The pop operation is implemented by returning a reference to the element currently stored at the top of the stack and adjusting the top reference to the new top of the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
31
A data structure is the underlying programming construct used to implement a collection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
32
Stack elements are processed in a FIFO manner-the first element in is the first element out.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
33
Inherited variables and methods can be used in the derived class as if they had been declared locally.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
34
Inheritance creates an is-a relationship between all parent and child classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
35
Common features should be located as low in a class hierarchy as is reasonable, minimizing maintenance efforts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
36
The most efficient way to implement an array-based stack keeps the top of the stack at the position 0 of the array?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
37
What is a collection?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
38
What is a data type?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
39
What is abstraction and what advantage does it provide?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
40
Why is a class an excellent representation of an abstract data type?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
41
What is the characteristic behavior of a stack?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
42
What are some of the other operations that might be implemented for a stack?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
43
Define inheritance.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
44
Define polymorphism.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
45
Given the example in Figure 3.5, list the subclasses of Mammal.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
46
Given the example in Figure 3.5, will the following code compile?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
47
Given the example in Figure 3.5, will the following code compile?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
48
What is the purpose of Generics in the Java language?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
49
What is the advantage of postfix notation?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck