Home
Subjects
Textbook solutions
Create
Study sets, textbooks, questions
Log in
Sign up
Upgrade to remove ads
Only $35.99/year
Data Structures
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Terms in this set (19)
Which of the following is NOT one of the three primary principles of Object-Oriented Programming (OOP)?
1. Inheritance
2. Encapsulation
3. Instantiation
4. Polymorphism
Instantiation
Which of the following is NOT a repetition control statement?
1. while
2. do-while
3. for
4. switch
Switch
Which of the following is NOT one of the three major categories of control structure in Java?
1. Selection
2. Repetition
3. Sequential
4. Infiltration
Infiltration
To specify that a method CANNOT be overridden in a subclass, what keyword is used?
1. abstract
2. static
3. const
4. final
Final
The ADT Bag is also called the ADT ___.
1. List
2. Multi-set
3. Stack
4. Queue
Multi-set
Which of the following complexity categories (Big O) represents the MOST efficient of the options provided?
1. O(log n)
2. O(n)
3. O(n^2)
4. O(2^n)
O(log n)
What is the Big O of the following code segment, given "n" is the size of an array being processed and/or the problem size?
int someNum = 0;
for (int i = 0; i < n; i++) {
someNum += i;
}
1. O(n^2)
2. O(n)
3. O(n log n)
4. O(1)
O(n)
What is the Big O of the following code segment, assuming "n" is an array size and/or the problem size?
for (int i = 0; i < n; i++) {
for (int j = 0; j < n/2; j++) {
System.out.println("i = " + i + " and j = " + j);
}
}
1. O(1)
2. O(2^n)
3. O(n^3)
4. O(n^2)
O(n^2)
The ADT Stack must provide a getBottom() operation, which returns the element at the bottom of the Stack Object
1. True
2. False
False
Consider that there is a superclass SuperC, and its subclass, SubC. Consider that both have an implementation of a method, preparePizza(). Given the following instantiation:
SuperC myVar = new SubC();
Is it true or false that SubC's version of preparePizza will be called when the call myVar.preparePizza() is made?
1. True
2. False
True
Given the following infix expression:
a * b / c + d
Which of the following is the corresponding postfix expression?
1. a b c * / d +
2. d c + b / a *
3. a b * c / d +
4. a b / * d +
a b * c / d +
Given the following infix expression:
a + b * (c - d)
What is the corresponding postfix expression?
1. a b + c d * -
2. a b c - * d +
3. a b * c - d +
4. a b c d - * +
a b c d - * +
An ArrayList is a special type of container class of whose objects can hold various types, depending on the type parameter given when the ArrayList is declared. We call this type of class a ___.
1. generalization
2. type coercion
3. generic
4. casting
generic
The method compareTo is a method of which of the following interfaces?
1. OnClickListener
2. Comparanator
3. Serializable
4. Comparable
Comparable
In order to ensure that a recursive algorithm eventually terminates (stops), the algorithm must have at least one ___.
1. recursive case
2. recurrence relation
3. asymptote
4. base case
base case
Consider the following code segment:
try {
openFridge();
takeOutMilk();
pourMilk();
putBackMilk();
}
catch (FridgeWontOpenException ex) {
handleFWOE();
}
catch (NoMilkException e) {
handleNME();
}
finally {
closeFridge();
}
Which of the following methods is guaranteed to run?
1. pourMilk
2. putBackMilk
3. handleNME
4. closeFridge
closeFridge
Adding an item to an Array-based bag, assuming no resizing is to be done, falls into which complexity category?
1. O(n^3)
2. O(1)
3. O(n log n)
4. O(n)
O(1)
Which of the following is NOT TRUE of the Stack ADT?
1. The top of the stack just be maintained
2. The bottom of the stack must be maintained
3. It should contain methods for pushing and popping data
4. It is more restrictive than the ADT Bag (Multiset)
The bottom of the stack must be maintained
Consider a class declared thusly:
public class MyClass<T> {
//code goes here
}
Which of the following data types could this class NOT be declared to DIRECTLY hold; which of the following type parameters is invalid?
1. Double
2. float
3. String
4. Scanner
float
Sets with similar terms
Java Midterm
95 terms
Java test 2
60 terms
CSC200 Final Exam
119 terms
Java Test 2
42 terms
Other Quizlet sets
BUS 2201
60 terms
STS Chapter 2: Quiz 2
10 terms
Motor Physiology
40 terms
Series 66 - USA
15 terms