Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

Data Structures and Algorithms

Document preview thumbnail
Preview 2 out of 5 pages

Data Structures and Algorithms

Content preview

COSC 2336 Test 2

Which of the following is NOT an operation that can be performed on a stack: - Correct
Answers-Insert

When working with a stack, peek removes the value from the top of the stack. - Correct
Answers-False

A stack is a first-in, first-out data structure. - Correct Answers-False

Stacks are used by compilers to implement recursion. - Correct Answers-True

Stacks can be implemented only using arrays. - Correct Answers-False

Which of the following would result in an error? - Correct Answers-Popping an empty stack

When implementing a stack as a linked-list, you must make sure the stack isn't full before you
can push a new item onto it. - Correct Answers-False

Which of the following would not be a good use of a stack: - Correct Answers-Keyboard buffer

Which of the following is true of implementing a stack using a linked list: - Correct Answers-The
next reference for the bottom of the stack is null

Which of the following is true of an array-based stack implementation: - Correct Answers-
Requires an IsFull method to check for a full stack

A reference-based stack makes more efficient use of memory. - Correct Answers-True

Queues are FIFO (first in, first out) data structures. - Correct Answers-True

If 5 items are added to a queue, the first item to be removed from the queue is the first item
that was added to the queue. - Correct Answers-True

Operations on a queue can be carried out at ______. - Correct Answers-both its front and back

A reference-based implementation of a queue that uses a linear singly linked list would need at
least ______ external references.

, three - Correct Answers-two

Which of the following is the code to insert a new node, referenced by newNode, into an empty
queue represented by a circular linked list? - Correct Answers-newNode.setNext(newNode);
lastNode = newNode;

Which of the following code fragments is used to delete the item at the front of a queue
represented by a circular array? - Correct Answers-front = (front+1) % MAX_QUEUE;
--count;

Which of the following operations inserts an element at the end of the queue: - Correct
Answers-enqueue

Which of the following is NOT an ADT queue operation: - Correct Answers-push

When implementing a queue using a reference-based approach, the operation dequeueAll is
not needed - Correct Answers-False

When implementing a queue using an array-based approach, it is not necessary to determine if
the queue if full before adding a new item to the queue - Correct Answers-False

A queue can be used as a keyboard buffer. - Correct Answers-True

Queues are rarely used in simulation programs. - Correct Answers-False

Which of the following is NOT a means of implementing a queue: - Correct Answers-Circularly
linked list
linearly linked list
linear array
circular array

All of these can be used to implement a queue

How many external references are necessary when implementing a queue using a circularly-
linked list? - Correct Answers-1

When implementing a queue, a naive array approach is more efficient in terms of memory
when compared to a circular array approach. - Correct Answers-False

A referenced-based queue implementation uses a statically allocated linked-list. - Correct

Document information

Uploaded on
June 13, 2025
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
222
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions