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
Exam (elaborations)

COMP.1020 Computing II UMASS - Lowell Exam 1 Spring

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
21-02-2026
Written in
2025/2026

1. Stacks (10 points) Draw a sequence of diagrams, one for each problem segment, that represent the current state of the stack after each labeled set of operations. If an operation or instruction produces output then indicate what that output is. hStack is the handle of a stack opaque object that can hold characters. There is no diagram for init or destroy. hStack = stack_init_default(); i. stack_push(hStack, ’a’); i. stack_push(hStack, ’b’); iii. printf("%c ", stack_top(hStack)); stack_pop(hStack); iv. printf("%c ", stack_top(hStack)); stack_push(hStack, ’c’); v. stack_push(hStack, ’d’); stack_push(hStack, ’e’); vi. printf("%c ", stack_top(hStack)); stack_push(hStack, ’f’); vii. stack_pop(hStack); stack_push(hStack, ’g’); stack_destroy(&hStack); This study source was downloaded by from CourseH on :53:14 GMT -06:00 COMP.1020 Computing II UMASS - Lowell Exam 1 Spring 2023 2 2. Queues (10 points) Draw a sequence of diagrams, one for each problem segment, that represent the current state of the queue after each labeled set of operations. If an operation or instruction produces output then indicate what that output is. We will use the function enqueue to add to the queue and serve to remove from the queue. hQueue is the handle of a queue opaque object that can hold characters. There is no diagram for init or destroy. hQueue = queue_init_default(); i. queue_enqueue(hQueue, ’a’); ii. queue_enqueue(hQueue, ’b’); iii. printf("%c, " queue_front(hQueue)); queue_enqueue(hQueue, ’c’); iv. printf("%c ", queue_front(hQueue)); queue_enqueue(hQueue, ’d’); v. queue_serve(hQueue); queue_serve(hQueue); vi. printf("%c ", queue_front(hQueue)); queue_enqueue(hQueue, ’e’); vii. queue_serve(hQueue); queue_serve(hQueue); hQueue-destroy(&hQueue);

Show more Read less
Institution
Revision
Course
Revision

Content preview

COMP.1020 Computing II UMASS - Lowell Exam 1 Spring 2023 1


1. Stacks (10 points)
Draw a sequence of diagrams, one for each problem segment, that represent the current state of the
stack after each labeled set of operations. If an operation or instruction produces output then indicate
what that output is. hStack is the handle of a stack opaque object that can hold characters. There is
no diagram for init or destroy.

hStack = stack_init_default();

i. stack_push(hStack, ’a’);
i. stack_push(hStack, ’b’);
iii. printf("%c ", stack_top(hStack)); stack_pop(hStack);
iv. printf("%c ", stack_top(hStack)); stack_push(hStack, ’c’);
v. stack_push(hStack, ’d’); stack_push(hStack, ’e’);
vi. printf("%c ", stack_top(hStack)); stack_push(hStack, ’f’);
vii. stack_pop(hStack); stack_push(hStack, ’g’);

stack_destroy(&hStack);




This study source was downloaded by 100000899606070 from CourseHero.com on 02-20-2026 22:53:14 GMT -06:00


https://www.coursehero.com/file/192612150/COMP1020-Exam11pdf/

, COMP.1020 Computing II UMASS - Lowell Exam 1 Spring 2023 2


2. Queues (10 points)
Draw a sequence of diagrams, one for each problem segment, that represent the current state of the
queue after each labeled set of operations. If an operation or instruction produces output then indicate
what that output is. We will use the function enqueue to add to the queue and serve to remove from the
queue. hQueue is the handle of a queue opaque object that can hold characters. There is no diagram
for init or destroy. hQueue = queue_init_default();

i. queue_enqueue(hQueue, ’a’);
ii. queue_enqueue(hQueue, ’b’);
iii. printf("%c, " queue_front(hQueue)); queue_enqueue(hQueue, ’c’);
iv. printf("%c ", queue_front(hQueue)); queue_enqueue(hQueue, ’d’);
v. queue_serve(hQueue); queue_serve(hQueue);
vi. printf("%c ", queue_front(hQueue)); queue_enqueue(hQueue, ’e’);
vii. queue_serve(hQueue); queue_serve(hQueue);

hQueue->destroy(&hQueue);




This study source was downloaded by 100000899606070 from CourseHero.com on 02-20-2026 22:53:14 GMT -06:00


https://www.coursehero.com/file/192612150/COMP1020-Exam11pdf/

Written for

Institution
Revision
Course
Revision

Document information

Uploaded on
February 21, 2026
Number of pages
8
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$8.49
Get access to the full document:

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

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Abbyy01 Exam Questions
Follow You need to be logged in order to follow users or courses
Sold
96
Member since
4 year
Number of followers
33
Documents
1337
Last sold
3 days ago

3.5

13 reviews

5
5
4
2
3
3
2
1
1
2

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