
ITSC 2214 Data Structures & Algorithms Test 2 Study Guide

Quiz
•
Computers
•
University
•
Medium
Idk Anymore
Used 5+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Parallel & Distributed Database

Quiz
•
University
20 questions
list 6th

Quiz
•
7th Grade - University
25 questions
Stack and Queue

Quiz
•
University
23 questions
Data Structures and Algorithms Quiz - BATCH 1

Quiz
•
University
26 questions
221 quiz questions exam 2 prep

Quiz
•
University
20 questions
soal berpikir komputasional kelas 8 gasal

Quiz
•
8th Grade - University
21 questions
OOP - session 2.1 - JVM, Array, Stack

Quiz
•
University
25 questions
CRYPTEC TECHNICAL QUIZ 3RD SEM 2ND ROUND

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University