100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 2221 A Grade Exam | Study Questions Solved 100% Correct $13.24   Add to cart

Exam (elaborations)

CSE 2221 A Grade Exam | Study Questions Solved 100% Correct

 0 view  0 purchase
  • Course
  • CSE 2221
  • Institution
  • CSE 2221

CSE 2221 A Grade Exam | Study Questions Solved 100% Correct

Preview 2 out of 14  pages

  • September 7, 2024
  • 14
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSE 2221
  • CSE 2221
avatar-seller
KenAli
CSE 2221 A Grade Exam | Study
Questions Solved 100% Correct

What does the map function void add(K key, V value)? - ANSWER adds the pair (key, value) to
this
aliases: references key, value
updates this
requires
key is not in domain (this)
ensures
this = #this union {(key, value)}



What is Map.Pair? - ANSWER another interface that is simply an order pair of a key and value,
has only two methods key() and value() which simply return the value of key and value
respectively



What does the map function Map.Pair<K,V> remove (K key) do? - ANSWER Removes form this
the pair whose first component is key and returns it
Updates this
requires key is in domain(this)
ensures
remove.key = key and
remove is in#this and
this = #this \ {remove}

, What does the map function Map.Pair<K,V> removeAny() do? - ANSWER Removes and returns
an arbitrary pair from this
updates this
requires
|this| > 0
ensures
removeAny is in #this and
this = #this \ {removeAny}



What does the map function V value(key) do? - ANSWER Reports the value associated with
key in this
aliases reference returned by value
Requires
key is in Domain(this)
Ensures
(key, value) is in this



What does the map function boolean hasKey(K key) do? - ANSWER Reports whether there is
a pair in this whose first component is key
ensures
hasKey = (key is in domain(this))



What does the map function V replaceValue(K Key, V Value) do? - ANSWER replaces the value
assoicated with key in this by value and returns the old value
aliases reference value
updates this
requires
key is in domain(this)

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller KenAli. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.24. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73243 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.24
  • (0)
  Add to cart