CS FundamentalsVery hardProduct-company placement

A gRPC API's Protocol Buffers message had field 'int32 discount = 4', which was deleted last year. A developer now adds 'string coupon = 4'. Why is this dangerous, and what is the safe practice?

  1. A. Field numbers must always increase, so the build fails
  2. B. Protobuf fields cannot be strings
  3. C. It is safe, because protobuf ignores type information on the wire
  4. D. Old clients or stored data still using tag 4 as an int32 will be misread as the new string field; deleted numbers should be marked reserved and new fields get fresh numbers

Correct answer: D. Old clients or stored data still using tag 4 as an int32 will be misread as the new string field; deleted numbers should be marked reserved and new fields get fresh numbers

The wire format identifies fields by number and wire type, not name, so reusing 4 makes old producers' data collide with the new field (parse errors or garbage). Adding fields with new numbers and reserving retired ones keeps compatibility both ways.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic