• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 9 pages
Exam (elaborations)

Data Structure Quiz Review With Correct Answers 100% 2026

Document preview thumbnail
Preview 2 out of 9 pages

DATA STRUCTURE QUIZ REVIEW WITH CORRECT ANSWERS 100% 2026 What is an array (or list)? - Correct Answer An ordered collection of items A Facebook group has a group name and a collection of users as its members. The order of the members doesn't really matter, we only care if a member exists in the group or not. If we have the name of a group, we should be able to look up its members. Which data structure would best represent this scenario? - Correct Answer An Object that maps the group name (key) to a Set of members (value) What is the output from the following program? var groceries = { "bananas": 4, "apples": 5, "eggs": 12, "oranges": 1 }; function start(){ mystery("apples", "oranges"); println(s); } function mystery(one, two){ var temp = groceries[one]; groceries[one] = groceries[two]; groceries[two] = temp; } - Correct Answer 1 What is the output of the following program? var arr = [1, 2, 3, 4, 5]; var removed = e(2); println(arr); prinln(removed); - Correct Answer [1, 2, 4, 5] 3 We now want to write a function rowSums that, given a Grid, returns a list of the sums of each row of the Grid. So for example, if we had a Grid grid that looked like this: Then rowSums(grid) should return a list that looks like this: [19, 23, 49] Which of the following is the best implementation of rowSums? //choose the implementation of this function function rowSums(grid){ ... } function rowSum(grid, row){ //code from question 21 ... } - Correct Answer function rowSums(grid){ var sums = []; for(var row = 0; row Rows(); row++){ var sum = rowSum(grid, row); (sum); } return sums; } We are writing a program that needs to store a to-do list. The most important task should be at the beginning of the to-do list, and the least important task should be at the end of the to-do list. Which data structure should we use to store the to-do list? - Correct Answer List / Array We want to write a function isValidLocation(grid, row, col) that returns true if the specified row, col location is a valid location on the Grid grid Which of the following is the best implementation of isValidLocation? - Correct Answer function isValidLocation(grid, row, col){ return (row = 0 && row Rows()) && (col = 0 && col Cols()); } You are watching a basketball game and want to keep track of how many points each player scores. Which data structure should you use to store the name of each player and how many points they score? You want to be able to look up a player's score by their name. - Correct Answer Object/Map that maps strings of text (player names) to numbers (scores) What is a grid? - Correct Answer A co


Document information

Uploaded on
March 26, 2026
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$9.99

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

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.
Wairimumburia
3.5
(2)
Sold
21
Followers
3
Items
2469
Last sold
2 weeks ago




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

Whoops! We can’t load your doc right now. Try again or contact support.