Quiz
Answer the following questions to test your knowledge of this chapter:
- Which encoding algorithm outputs a variable number of bytes depending on the value encoded?
- ZigZag
- Varint
- Length-delimited
- Which encoding algorithm turns negative numbers into positive ones?
- Length-delimited
- varint
- ZigZag
- What might be a problem with using varint?
- It can use more bytes than the original 32- and 64-bit integers
- It will encode negative numbers into 10 bytes
- All the above
- What might be a problem with using ZigZag?
- It is less efficient at encoding positive numbers than varint
- It will encode negative numbers into 10 bytes
- It can use more bytes than the original 32- and 64-bit integers
- When should you consider using fixed-sized integers?
- Never, always prefer using varints
- When dealing with larger numbers which will be encoded a more than 4 or 8 bytes
- When dealing with negative numbers
- What is the difference between unpacked and packed repeated fields?
- Unpacked has overhead in terms of...