
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
CSE316_Unit01_Quiz01

Quiz
•
University
20 questions
DATA STRUCTURES

Quiz
•
University
20 questions
Data Structures

Quiz
•
University - Professi...
20 questions
DSA quiz

Quiz
•
University
26 questions
DSC Chapter-3

Quiz
•
University
20 questions
Hashing

Quiz
•
University
20 questions
Java - Revisão I

Quiz
•
University
20 questions
PROGRAMMING IN C AND DATA STRUCTURES - UNIT V

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University