MCQs on Setting Up Kafka | Apache Kafka MCQs Questions

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

  1. 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
  2. What file is primarily used to configure a Kafka broker?
    a) broker.properties
    b) server.config
    c) server.properties
    d) broker.config
  3. Which dependency is required to run Kafka on a machine?
    a) Python
    b) Java
    c) Ruby
    d) Node.js
  4. 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
  5. 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

  1. 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
  2. How many brokers are recommended for a minimum viable Kafka cluster?
    a) 1
    b) 2
    c) 3
    d) 5
  3. 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
  4. What property should be set to enable replication in Kafka?
    a) replication.enable
    b) min.insync.replicas
    c) replication.factor
    d) replication.allow
  5. 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

  1. 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
  2. Which file is used to configure Zookeeper in Kafka?
    a) server.properties
    b) zookeeper.config
    c) zoo.properties
    d) zookeeper.properties
  3. What is a typical default port used by Zookeeper?
    a) 9092
    b) 2181
    c) 7070
    d) 8080
  4. 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
  5. 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

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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

  1. Which protocol is commonly used to secure communication in Kafka?
    a) SSH
    b) TLS/SSL
    c) HTTPS
    d) AES
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. What does enabling SASL in Kafka provide?
    a) Encrypted communication
    b) Authentication and authorization mechanisms
    c) Increased storage capacity
    d) Faster message delivery
  8. Which file format is used for SSL certificates in Kafka?
    a) PEM
    b) JSON
    c) YAML
    d) CSV
  9. 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
  10. 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

QnoAnswer
1a) kafka-server-start.sh
2c) server.properties
3b) Java
4a) Configures broker to connect to a Zookeeper cluster
5b) brew install kafka
6b) Lack of fault tolerance
7c) 3
8a) Leader election among brokers
9c) replication.factor
10c) kafka-server-start.sh
11b) Managing distributed configurations and leader election
12d) zookeeper.properties
13b) 2181
14a) Path for storing Kafka logs
15c) Setting up a Zookeeper quorum
16d) All of the above
17b) Number of I/O threads handling requests
18b) Configuring log retention policies
19c) max.message.bytes
20a) Partition balancing algorithms
21b) TLS/SSL
22b) Configures SSL encryption for broker communication
23b) Using SSL certificates or SASL mechanisms
24b) Setting topic-level ACLs
25d) Not directly supported; use external tools
26b) Zookeeper uses Kerberos or DIGEST-MD5
27b) Authentication and authorization mechanisms
28a) PEM
29a) By granting producer-level ACL permissions
30b) Preventing unauthorized data access

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top