0
0
Kafkadevops~10 mins

Avro schema definition in Kafka - 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 the type of the Avro field.

Kafka
{
  "name": "age",
  "type": "[1]"
}
Drag options to blanks, or click blank then click option'
Aint
Bstring
Cboolean
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of int for numeric fields.
Using float when decimals are not needed.
2fill in blank
medium

Complete the code to define a nullable string field in Avro.

Kafka
{
  "name": "nickname",
  "type": ["null", "[1]"]
}
Drag options to blanks, or click blank then click option'
Aboolean
Bfloat
Cstring
Dint
Attempts:
3 left
💡 Hint
Common Mistakes
Using only string without null for nullable fields.
Using int or boolean instead of string for text fields.
3fill in blank
hard

Fix the error in the Avro schema type definition for a boolean field.

Kafka
{
  "name": "isActive",
  "type": "[1]"
}
Drag options to blanks, or click blank then click option'
Aboolean
Bint
Cstring
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using string or int instead of boolean for true/false fields.
Using float for boolean fields.
4fill in blank
hard

Fill both blanks to define an Avro record with two fields: a string name and an int age.

Kafka
{
  "type": "record",
  "name": "Person",
  "fields": [
    {"name": "name", "type": "[1]"},
    {"name": "age", "type": "[2]"}
  ]
}
Drag options to blanks, or click blank then click option'
Astring
Bboolean
Cint
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up types for name and age fields.
Using boolean or float instead of string or int.
5fill in blank
hard

Fill all three blanks to define an Avro schema with a record named Employee having fields: id (int), name (string), and active (boolean).

Kafka
{
  "type": "record",
  "name": "Employee",
  "fields": [
    {"name": "id", "type": "[1]"},
    {"name": "name", "type": "[2]"},
    {"name": "active", "type": "[3]"}
  ]
}
Drag options to blanks, or click blank then click option'
Astring
Bint
Cboolean
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping types between fields.
Using float instead of int for id.