This comprehensive set of Apache Kafka MCQs Question focuses on setting up and configuring Kafka for real-world scenarios. These questions cover key topics like installation, single-node versus multi-node clusters, configuring Zookeeper and brokers, managing cluster resources, and security basics such as authentication and encryption. Perfect for students, developers, and professionals, this guide ensures mastery of Apache Kafka’s foundational setup. Use these MCQs to excel in exams, interviews, or real-world implementations of Kafka in distributed systems.
Chapter 3: Setting Up Kafka – MCQs
Topic 1: Kafka Installation and Configuration
Which command is used to start a Kafka broker? a) kafka-server-start.sh b) kafka-broker-init.sh c) kafka-broker-start.sh d) kafka-init.sh
What file is primarily used to configure a Kafka broker? a) broker.properties b) server.config c) server.properties d) broker.config
Which dependency is required to run Kafka on a machine? a) Python b) Java c) Ruby d) Node.js
What is the purpose of the zookeeper.connect property in Kafka? a) Configures broker to connect to a Zookeeper cluster b) Specifies the port for broker communication c) Enables data replication d) Sets up the Kafka log directory
Which command is used to install Apache Kafka using a package manager? a) apt install kafka b) brew install kafka c) yum kafka setup d) install-kafka.sh
Topic 2: Single-Node vs Multi-Node Cluster Setup
What is the main drawback of a single-node Kafka cluster? a) High latency b) Lack of fault tolerance c) Expensive setup cost d) Difficult to configure
How many brokers are recommended for a minimum viable Kafka cluster? a) 1 b) 2 c) 3 d) 5
In a multi-node cluster, what ensures fault tolerance? a) Leader election among brokers b) Single partition for all topics c) Reduced replication factor d) Kafka Connect
What property should be set to enable replication in Kafka? a) replication.enable b) min.insync.replicas c) replication.factor d) replication.allow
Which command is used to start Kafka in a multi-node setup? a) kafka-cluster-start.sh b) kafka-multi-node.sh c) kafka-server-start.sh d) start-multi-cluster.sh
Topic 3: Configuring Zookeeper and Kafka Brokers
What is the primary role of Zookeeper in a Kafka cluster? a) Storing application data b) Managing distributed configurations and leader election c) Handling consumer offsets d) Encrypting messages
Which file is used to configure Zookeeper in Kafka? a) server.properties b) zookeeper.config c) zoo.properties d) zookeeper.properties
What is a typical default port used by Zookeeper? a) 9092 b) 2181 c) 7070 d) 8080
What does the log.dirs property in a Kafka broker configuration specify? a) Path for storing Kafka logs b) Location of Zookeeper logs c) Temporary files for producers d) Backup location for consumers
How can Zookeeper be scaled in a Kafka cluster? a) Adding more brokers b) Increasing the replication factor c) Setting up a Zookeeper quorum d) Adding more partitions
Topic 4: Managing Cluster Resources
Which of the following helps manage resources in a Kafka cluster? a) Partitioning and replication b) Using consumer groups c) Leader election d) All of the above
What does the num.network.threads property configure in Kafka? a) Maximum number of partitions per broker b) Number of I/O threads handling requests c) Maximum log size d) Number of producers allowed
How can Kafka storage usage be optimized? a) Decreasing the number of partitions b) Configuring log retention policies c) Using a single topic d) Disabling replication
Which property controls the maximum size of a message in Kafka? a) message.size.max b) log.retention.max.size c) max.message.bytes d) message.max.size
What does Kafka use to distribute partitions across brokers? a) Partition balancing algorithms b) Consumer offsets c) Zookeeper replication d) Broker IDs
Topic 5: Security Basics: Authentication, Authorization, and Encryption
Which protocol is commonly used to secure communication in Kafka? a) SSH b) TLS/SSL c) HTTPS d) AES
What is the purpose of the ssl.keystore.location property in Kafka? a) Specifies the path to Kafka logs b) Configures SSL encryption for broker communication c) Manages log retention policies d) Specifies the path for consumer offsets
How does Kafka handle client authentication? a) Through OAuth tokens b) Using SSL certificates or SASL mechanisms c) By verifying IP addresses d) Through Zookeeper
What is a recommended practice for securing Kafka topics? a) Disabling producer authentication b) Setting topic-level ACLs c) Avoiding encryption d) Keeping default configurations
Which Kafka property enables topic encryption at rest? a) topic.security.encryption b) log.dirs c) ssl.enable d) Not directly supported; use external tools
How does Zookeeper authentication differ from Kafka authentication? a) Zookeeper only uses SSL b) Zookeeper uses Kerberos or DIGEST-MD5 c) Kafka uses certificates only d) Zookeeper does not support authentication
What does enabling SASL in Kafka provide? a) Encrypted communication b) Authentication and authorization mechanisms c) Increased storage capacity d) Faster message delivery
Which file format is used for SSL certificates in Kafka? a) PEM b) JSON c) YAML d) CSV
How can you authorize a producer to publish to a Kafka topic? a) By granting producer-level ACL permissions b) By configuring Zookeeper settings c) By using Kerberos authentication only d) By disabling consumer offsets
What is the primary advantage of securing Kafka communication? a) Faster partition replication b) Preventing unauthorized data access c) Improved log retention policies d) Automatic scaling of clusters
Answer Key
Qno
Answer
1
a) kafka-server-start.sh
2
c) server.properties
3
b) Java
4
a) Configures broker to connect to a Zookeeper cluster
5
b) brew install kafka
6
b) Lack of fault tolerance
7
c) 3
8
a) Leader election among brokers
9
c) replication.factor
10
c) kafka-server-start.sh
11
b) Managing distributed configurations and leader election
12
d) zookeeper.properties
13
b) 2181
14
a) Path for storing Kafka logs
15
c) Setting up a Zookeeper quorum
16
d) All of the above
17
b) Number of I/O threads handling requests
18
b) Configuring log retention policies
19
c) max.message.bytes
20
a) Partition balancing algorithms
21
b) TLS/SSL
22
b) Configures SSL encryption for broker communication