CSE 2221 Final Exam 80 Questions

EXAM ELABORATIONS Aug 28, 2025
Loading...

Loading document viewer...

Page 0 of 0

Document Text

CSE 2221 Final Exam | 80 Questions with 100% Correct Answers | Verified | Latest Update 2024

Why is the container class called Stack? - ✔✔It follows the same sort of organization and manipulation type that a stack in the program execution would perform LIFO (last-in-first-out)

LIFO - ✔✔last in first out

How is a Stack different than the queue? - ✔✔it is like a "dual" A queue is first in first out, while stack is last in first out

What are the three methods of StackKernel? - ✔✔ push pop length

What are the three methods of the Stack Interface? - ✔✔ top replaceTop flip

What mathematical model is Stack modeled by? - ✔✔Modeled by mathematical string of T

How many constructors for Stack? - ✔✔only 1, which is empty, creates an empty stack

What does the Stack method void push(T x) do? - ✔✔ adds x to the top (left end) of this aliases reference x 1 / 2

updates this ensures this = * #this

What does the stack method T pop() do? - ✔✔Removes and retursn the entry at the top (left end of this) updates this requires this /= <> ensures #this = * this

What does the stack method int length() do? - ✔✔Reports the length of this ensures length = |this|

What does the stack method T top() do? - ✔✔Returns the entry at the top (left end) of this

Aliases: reference returned by top

requires:

this /= <> ensures is prefix of this

What does the stack method T replaceTop(T x) do? - ✔✔replaces top of this with x, and returns the old top aliases reference x updates this requires this /= <>

ensures:

is prefix of #this and

  • / 2

Download Document

Buy This Document

$30.00 One-time purchase
Buy Now
  • Full access to this document
  • Download anytime
  • No expiration

Document Information

Category: EXAM ELABORATIONS
Added: Aug 28, 2025
Description:

CSE 2221 Final Exam | 80 Questions with 100% Correct Answers | Verified | Latest Update 2024 Why is the container class called Stack? - ✔✔It follows the same sort of organization and manipulati...

Get this document $30.00