0
0
IOT Protocolsdevops~10 mins

Protocol Buffers (protobuf) in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a Protocol Buffers message named Person.

IOT Protocols
message Person {
  string name = [1];
}
Drag options to blanks, or click blank then click option'
Astring
Bname
C1
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using the field name instead of a number for the tag.
Using zero or negative numbers for the tag.
2fill in blank
medium

Complete the code to declare an integer field called id in a protobuf message.

IOT Protocols
message User {
  [1] id = 1;
}
Drag options to blanks, or click blank then click option'
Aint32
Bbool
Cstring
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using string type for numeric fields.
Using bool or float for integer fields.
3fill in blank
hard

Fix the error in the protobuf field declaration for a repeated string called tags.

IOT Protocols
message Item {
  [1] string tags = 2;
}
Drag options to blanks, or click blank then click option'
Arequired
Bsingle
Coptional
Drepeated
Attempts:
3 left
💡 Hint
Common Mistakes
Using optional or required for repeated fields.
Using single which is not a protobuf keyword.
4fill in blank
hard

Fill both blanks to define a nested message Address inside Person with a string field city.

IOT Protocols
message Person {
  message [1] {
    [2] city = 1;
  }
}
Drag options to blanks, or click blank then click option'
AAddress
Bstring
Cint32
DLocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using int32 for city which is text.
Using wrong nested message name.
5fill in blank
hard

Fill all three blanks to create a map field from string keys to int32 values named scores.

IOT Protocols
message Game {
  map<[1], [2]> [3] = 1;
}
Drag options to blanks, or click blank then click option'
Astring
Bint32
Cscores
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using float instead of int32 for values.
Using wrong field name.