Google Cloud Professional Cloud Developer Practice Test

Session length

1 / 20

Which data structure is most efficient for calculating the sum of transaction amounts for unique account numbers?

A linked list

A hash table

Using a hash table is the most efficient choice for calculating the sum of transaction amounts for unique account numbers due to its ability to provide average-case constant time complexity, O(1), for insertions and lookups.

When processing transactions, each account number can be used as a key in the hash table, where the associated value would be the cumulative sum of the transaction amounts for that account. By utilizing this data structure, as transactions are processed, the program can quickly check if the account number already exists in the hash table. If it does, you can simply update the sum; if not, you can create a new entry in the hash table for that account number with the initial transaction amount.

This efficiency is especially beneficial when dealing with a large dataset, as it significantly reduces the time it would take to calculate sums compared to other data structures. For instance, linked lists would require sequential searches through the list to access each account number, making it inefficient for this specific task. Similarly, a two-dimensional array would also involve more complex indexing and potentially wasted space, while a comma-delimited string would require parsing and is less structured for rapid access and updating.

In scenarios where rapid access and modification for unique keys is required, hash tables excel and stand

A two-dimensional array

A comma-delimited string

Next Question

Find the option that is right for you!

All options are one-time payments.

$25.99

30 day premium pass

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
👑$59.99 $171.99 usd

6 month DELUXE pass (most popular)

Everything with the 30 day premium pass FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • Everything included in the premium pass
  • $171.99 usd value for $59.99! You save $106!
  • + Access to the ultimate digital PDF study guide
  • + 6 months of premium pass access
  • + Priority support
$15.99 $24.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy