0
0
Kafkadevops~10 mins

Why schema management prevents data issues in Kafka - Test Your Understanding

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

Complete the code to define a schema for a Kafka message.

Kafka
schema = {"type": [1], "fields": [{"name": "id", "type": "int"}]}
Drag options to blanks, or click blank then click option'
A"record"
B"string"
C"array"
D"map"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'string' or 'array' instead of 'record' causes schema errors.
2fill in blank
medium

Complete the code to register the schema with the Schema Registry.

Kafka
schema_registry_client.[1](schema_str)
Drag options to blanks, or click blank then click option'
Aregister_schema
Bget_schema
Cdelete_schema
Dupdate_schema
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get_schema' does not add a new schema.
3fill in blank
hard

Fix the error in the code to validate a message against the schema.

Kafka
is_valid = schema_validator.[1](message)
Drag options to blanks, or click blank then click option'
Averify_message
Bcheck_schema
Cvalidate_message
Dvalidate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'validate_message' causes method not found errors.
4fill in blank
hard

Fill both blanks to create a schema that requires a string field 'name' and an integer field 'age'.

Kafka
schema = {"type": [1], "fields": [{"name": "name", "type": [2], {"name": "age", "type": "int"}]}
Drag options to blanks, or click blank then click option'
A"record"
B"string"
C"int"
D"array"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'array' or 'int' for the 'name' field causes validation errors.
5fill in blank
hard

Fill all three blanks to create a schema with a required string 'email', an optional int 'phone', and a default value for 'phone'.

Kafka
schema = {"type": [1], "fields": [{"name": "email", "type": [2], {"name": "phone", "type": ["null", [3]], "default": null}]}
Drag options to blanks, or click blank then click option'
A"record"
B"string"
C"int"
D"array"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'array' or wrong types causes schema validation failures.