
ITSC 2214 Data Structures & Algorithms Test 2 Study Guide
Authored by Idk Anymore
Computers
University
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
23 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Assume you are adding an item, ‘F’, to the end of
this list. You’ve already created a linear node called
temp with a pointer to ‘F’. What lines of code update
this list?
back.setNext(temp);
back = temp;
numNodes++;
back.getNext(setNext(temp));
back = temp;
numNodes++;
back = temp;
back.getNext(setNext(temp));
numNodes++;
back = temp;
back.setNext(temp);
numNodes++;
2.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
A queue processes items in what order?
FIFO
LIFO
FILO
LILO
LIFO or FIFO
3.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What are the contents of an ArrayList, myList,
after the following code is run:
myList.add("Ahab");
myList.add("Anitja");
myList.add("Yusef");
myList.add("Kelli");
myList.remove(1);
myList.remove(2);
["Ahab", "Anitja"]
["Ahab", "Kelli"]
["Ahab", "Yusef"]
["Yusef", "Kelli"]
["Anitja", "Kelli"]
4.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What would be the complexity of the size()
method for a linked list if there was no count
variable?
O(1)
O(n)
O(log n)
O(n^2)
5.
MULTIPLE SELECT QUESTION
15 mins • 1 pt
Given the following information, select all the
asserts that would properly test a dequeue
operation if you’ve only added one object to the
queue.
• result is what the dequeue operation returns
• expdRslt is what you think should be returned
• myQueue is the queue of objects
assertEquals(result, expdRslt);
assertEquals(myQueue.size, 0);
assertTrue(myQueue.size == 0);
assertEquals(myQueue.size(),0);
assertTrue(result.equals(expdRslt));
6.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Given the following code, what is returned? Assume that ArrayQueue is a
correctly implemented class, with lots of capacity. Also note that we are
using Java's built-in queue which uses add/remove instead of
enqueue/dequeue, which is just a different vocabulary.
String s;
Queue<String> myQueue = new ArrayQueue<Integer>;
myQueue.add(“a”);
myQueue.add(“b”);
s = myQueue.remove();
s = myQueue.remove();
myQueue.add(“c”);
myQueue.add(“d”);
s = myQueue.remove();
s = myQueue.remove();
return s;
"a"
"b"
"c"
"d"
Nothing, this won't compile.
7.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Given the following code using a queue X of
Integers, what is returned by a call to X.first()?
X.enqueue(new Integer(4));
X.enqueue(new Integer(3));
Integer y = X.dequeue();
X.enqueue(new Integer(7));
X.enqueue(new Integer(2));
X.enqueue(y);
y = X.dequeue();
X.enqueue(new Integer(3));
X.enqueue(new Integer(8));
? = X.first();
4
8
7
3
Nothing, an exception is thrown
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
PYTHON REVISION
Quiz
•
University
20 questions
Banco de Dados
Quiz
•
University - Professi...
20 questions
3°DS _AV2_R2 3TEC_PM_Programação Mobile _12_20 Quizizz
Quiz
•
11th Grade - University
18 questions
DI (EM24) - Diseño de Interfaces (T7.1)
Quiz
•
University - Professi...
20 questions
EXAMEN DE COMANDOS
Quiz
•
University
20 questions
Quiz
Quiz
•
University
19 questions
DSA Quest 1.0
Quiz
•
University
20 questions
Hashing
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade