System Design Application Based Questions Flashcards

1
Q

Two methods of shortening URLs

A

Hashing and Counter Based

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you use Hashing to shorten URL ? What about Collision ?

A

Use a hash function like SHA-256 on the original URL and encode the hash using base62 (using characters 0-9, a-z, A-Z) to get a shorter version. To handle collisions (different URLs hashing to the same value), you can append an increasing sequence number to URLs before hashing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you use the Counter Based Approach to shorten URLs ? collision issues ?

A

Use an auto-incrementing counter (globally or per user). The counter value can be encoded using base62 to form a short URL. This method ensures uniqueness without collisions but is predictable and might need additional handling to scale horizontally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which DBs can be used for consistency and structured data ?

A

SQL databases like PostgreSQL or MySQL are good for strong consistency and structured data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which DBs can be used for high availability and sharding ?

A

NoSQL databases like DynamoDB or Cassandra offer high availability and are designed to scale out by using sharding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly