exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 29 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 29
Topic #: 1
[All Professional Cloud Developer Questions]

You are parsing a log file that contains three columns: a timestamp, an account number (a string), and a transaction amount (a number). You want to calculate the sum of all transaction amounts for each unique account number efficiently.
Which data structure should you use?

  • A. A linked list
  • B. A hash table
  • C. A two-dimensional array
  • D. A comma-delimited string
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
__rajan__
7 months, 1 week ago
Selected Answer: B
Hash Table will store unique values.
upvoted 1 times
...
telp
1 year, 3 months ago
Selected Answer: B
B. A hash table for the efficient to find a spzcific number.
upvoted 1 times
...
omermahgoub
1 year, 3 months ago
B. A hash table. A hash table allows for fast insertion and lookup of data, which would be useful in this case for quickly looking up the transaction amount for a given account number and adding it to the total. A linked list, two-dimensional array, and comma-delimited string would not be as efficient for this purpose.
upvoted 2 times
...
Andrea_P
1 year, 6 months ago
Selected Answer: C
A and C are obviously wrong. With hash tables, you cannot store multiple values (amounts) in single key (account number), but this is exactly what you need to do. Two dimensional array can be used to store all the couples Account-amount (timestamp is useless). So my selected answer is C.
upvoted 1 times
wanrltw
5 months, 2 weeks ago
The value is not limited to Sting type, though. What about storing unique account as a key, while keeping timestamp and transaction amount in an array as its value? ;)
upvoted 1 times
wanrltw
5 months, 2 weeks ago
The details don't really matter here - the account number has to be unique, so hash table is the only way from the provided options.
upvoted 1 times
...
...
...
tomato123
1 year, 8 months ago
Selected Answer: B
B is correct
upvoted 3 times
...
morenocasado
2 years ago
Selected Answer: B
Hash table with the account number as the key, the timestamp is useless for this question, so we can safely discard it.
upvoted 3 times
...
yuchun
2 years, 10 months ago
in this case, if you use hashtable, the key must be account name+ timestamp, so I think linkedlist is better
upvoted 1 times
ruben82
1 year, 11 months ago
You don't need to use timestamp for this request.
upvoted 1 times
...
...
ralf_cc
2 years, 10 months ago
Hash Table seems right - https://open4tech.com/array-vs-linked-list-vs-hash-table/
upvoted 2 times
syu31svc
2 years, 10 months ago
I agree with you on this one
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago