CCAAK study materials
CCAAK study resources

CCAAK practice questions

One question at a time. Build your CCAAK understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Configure Apache Kafka clusters

In a Kafka cluster, which component is responsible for storing partition replicas and serving fetch requests from consumers?

  1. ZooKeeper
  2. Consumer group coordinator client
  3. Producer
  4. Broker Correct answer.

Explanation

Brokers are the servers that hold partition replicas on disk and serve produce and fetch requests. ZooKeeper (or KRaft controllers) only manages metadata and cluster coordination, not data storage.

Question 2Configure Apache Kafka clusters

Which configuration parameter on a broker determines the default replication factor applied to auto-created topics?

  1. default.replication.factor Correct answer.
  2. num.partitions
  3. replica.lag.time.max.ms
  4. min.insync.replicas

Explanation

default.replication.factor sets the replication factor used when a topic is created without an explicit value. num.partitions sets the default partition count, while the other two control durability and replica liveness.

Question 3Configure Apache Kafka clusters

A broker's log.dirs points to multiple directories on separate disks. How does Kafka distribute partitions across them?

  1. It writes all partitions to the first directory and uses the rest as backup
  2. It stripes each partition's segments across all directories
  3. It places each new partition on the directory with the fewest partitions Correct answer.
  4. It requires log.dirs to contain exactly one directory

Explanation

Kafka assigns each new partition to the log directory currently holding the fewest partitions, which balances load across disks. It does not stripe a single partition across directories.

Question 4Configure Apache Kafka clusters

What is the effect of setting unclean.leader.election.enable=true on a broker?

  1. Producers may write with acks=0 without errors
  2. Consumers may read uncommitted transactional records
  3. A replica that is not in the ISR may become leader, risking data loss Correct answer.
  4. A leader is elected only after all replicas acknowledge

Explanation

Enabling unclean leader election allows an out-of-sync replica to take leadership when no in-sync replica is available, trading availability for potential data loss. It does not affect transaction isolation or producer acks directly.

Question 5Configure Apache Kafka clusters

Which listener configuration must be set so that clients can connect to a broker from outside its host?

  1. advertised.listeners Correct answer.
  2. auto.create.topics.enable
  3. log.retention.hours
  4. zookeeper.connect

Explanation

advertised.listeners defines the host and port that brokers publish to clients; if it points to an internal address, external clients cannot connect. The other settings govern coordination, retention, or topic creation.

Question 6Configure Apache Kafka clusters

A topic has min.insync.replicas=2 and replication factor 3. A producer uses acks=all. What happens when only one replica is in sync?

  1. The producer automatically retries with acks=1
  2. The produce request succeeds and waits for the second replica
  3. The broker elects a new leader immediately
  4. The produce request fails with NotEnoughReplicas Correct answer.

Explanation

With acks=all and min.insync.replicas=2, a write requires at least two in-sync replicas. If only one is in sync, the broker rejects the write with NotEnoughReplicas rather than accepting it.

Question 7Configure Apache Kafka clusters

Which tool is used to increase the number of partitions for an existing topic?

  1. kafka-topics.sh with --alter --partitions Correct answer.
  2. kafka-configs.sh with --alter
  3. kafka-reassign-partitions.sh
  4. kafka-consumer-groups.sh

Explanation

kafka-topics.sh --alter --partitions changes the partition count of an existing topic. kafka-configs.sh alters topic or broker configuration, and kafka-reassign-partitions.sh moves replicas between brokers.

Question 8Configure Apache Kafka clusters

Why should the number of partitions for a topic generally not be decreased in Kafka?

  1. Decreasing partitions forces a full cluster restart
  2. Removing partitions would break key-to-partition mappings and delete data Correct answer.
  3. Decreasing partitions is only allowed with replication factor 1
  4. Kafka only supports decreasing partitions with acks=0

Explanation

Kafka does not support reducing partition count because it would invalidate key-based partitioning and orphan or delete stored data. Partition count increases are supported, but decreases are not.

Question 9Configure Apache Kafka clusters

Which configuration sets the replication factor for topics created automatically by the broker?

  1. offsets.topic.replication.factor
  2. transaction.state.log.replication.factor
  3. replica.fetch.max.bytes
  4. default.replication.factor Correct answer.

Explanation

default.replication.factor applies to auto-created and otherwise unspecified topics. The offsets and transaction state settings apply only to Kafka's internal topics.

Question 10Configure Apache Kafka clusters

What does the broker setting num.network.threads control?

  1. The number of threads handling network requests Correct answer.
  2. The number of threads performing disk I/O
  3. The number of replica fetcher threads
  4. The maximum number of client connections

Explanation

num.network.threads sizes the pool that receives requests and sends responses over the network. Disk I/O is handled by num.io.threads, and replica fetching is controlled by num.replica.fetchers.

Question 11Configure Apache Kafka clusters

A cluster needs to tolerate the loss of two brokers while keeping all data available. What is the minimum replication factor for topics?

  1. 4
  2. 1
  3. 3 Correct answer.
  4. 2

Explanation

A replication factor of 3 allows two replicas to fail while one copy remains available. Replication factor 2 tolerates only one broker failure.

Question 12Configure Apache Kafka clusters

Which Kafka internal topic stores consumer group offsets when group coordination is handled by brokers?

  1. __consumer_offsets Correct answer.
  2. __transaction_state
  3. __schemas
  4. __cluster_metadata

Explanation

Committed consumer offsets are stored in the compacted __consumer_offsets topic. __transaction_state holds transactional metadata, and __cluster_metadata holds KRaft metadata.

Question 13Configure Apache Kafka clusters

In KRaft mode, which role must a node have to participate in the metadata quorum?

  1. connect
  2. controller Correct answer.
  3. mirror
  4. broker

Explanation

KRaft controllers form the metadata quorum that replaces ZooKeeper. Brokers serve client data, while connect and mirror are not quorum roles.

Question 14Configure Apache Kafka clusters

Which setting must match across all nodes in a KRaft cluster to identify the same cluster?

  1. group.initial.rebalance.delay.ms
  2. log.retention.bytes
  3. broker.id
  4. cluster.id Correct answer.

Explanation

The cluster.id must be identical on every node so they recognize each other as part of one cluster. Broker IDs must be unique per node, not shared.

Question 15Configure Apache Kafka clusters

What is the purpose of the replica.lag.time.max.ms broker setting?

  1. It sets the maximum time a producer waits for acks
  2. It controls how long a segment stays in the log
  3. It defines how long a follower may lag before being removed from the ISR Correct answer.
  4. It limits how long a consumer may be idle before being kicked from a group

Explanation

If a follower has not caught up to the leader within replica.lag.time.max.ms, it is dropped from the in-sync replica set. This affects durability guarantees tied to min.insync.replicas.

Question 16Configure Apache Kafka clusters

A broker is added to a running cluster. What must be done for existing topic partitions to use the new broker?

  1. Run a partition reassignment that includes the new broker Correct answer.
  2. Delete and recreate the topics
  3. Increase the replication factor of every topic
  4. Restart all brokers so partitions redistribute automatically

Explanation

New brokers receive no existing replicas automatically; you must run kafka-reassign-partitions.sh to move replicas onto them. Restarting brokers does not trigger redistribution.

Question 17Configure Apache Kafka clusters

Which configuration controls the maximum size of a single log segment before it is rolled?

  1. segment.index.bytes
  2. message.max.bytes
  3. log.segment.bytes Correct answer.
  4. log.retention.bytes

Explanation

log.segment.bytes sets the size at which the active segment is closed and a new one opened. log.retention.bytes limits total log size rather than segment size.

Question 18Configure Apache Kafka clusters

A topic uses log.cleanup.policy=compact. What is retained in the log?

  1. Only records written in the last hour
  2. Only records with null keys
  3. All records for a fixed retention period
  4. At least the latest record for each key Correct answer.

Explanation

Log compaction retains the most recent value for each key and eventually removes older duplicates, so the log acts as a changelog. Time-based retention applies to the delete policy instead.

Question 19Configure Apache Kafka clusters

Which broker setting limits the largest record batch a producer can send?

  1. replica.fetch.max.bytes
  2. socket.send.buffer.bytes
  3. message.max.bytes Correct answer.
  4. num.partitions

Explanation

message.max.bytes caps the size of a record batch the broker will accept. Producers must also raise max.request.size to match, otherwise large batches are rejected.

Question 20Configure Apache Kafka clusters

What does the broker configuration auto.create.topics.enable=true allow?

  1. Topics to be created implicitly when a client produces to or consumes from a missing topic Correct answer.
  2. Consumers to create consumer groups automatically
  3. Brokers to create internal topics only at startup
  4. Producers to create partitions on demand

Explanation

When enabled, the broker creates a topic automatically if a client references a nonexistent topic. Many production clusters disable this to avoid accidental topic creation with unintended defaults.

Question 21Configure Apache Kafka clusters

A cluster has three brokers and a topic with replication factor 3. One broker fails permanently. What is the state of the topic?

  1. The replication factor is automatically reduced to 2
  2. The topic is automatically deleted
  3. All partitions become unavailable until the broker returns
  4. All partitions remain available with two replicas each Correct answer.

Explanation

With replication factor 3, each partition has a copy on every broker, so the remaining two replicas keep the partitions available. The replication factor is not changed automatically.

Question 22Configure Apache Kafka clusters

Which setting determines the directory where KRaft stores its metadata log?

  1. log.dirs
  2. metadata.log.dir Correct answer.
  3. state.dir
  4. zookeeper.data.dir

Explanation

metadata.log.dir specifies the location of the KRaft metadata log. If unset, it defaults to the first entry in log.dirs, but explicit configuration is common in production.

Question 23Configure Apache Kafka clusters

What is the consequence of setting offsets.topic.replication.factor lower than the number of brokers during cluster startup?

  1. Producers cannot write to any topic
  2. Consumer groups cannot be created at all
  3. The internal offsets topic may be under-replicated, risking offset loss on failure Correct answer.
  4. The cluster refuses to start

Explanation

The __consumer_offsets topic is created with offsets.topic.replication.factor, and if that is lower than the broker count it may be under-replicated. A broker loss could then make committed offsets unavailable.

Question 24Configure Apache Kafka clusters

Which mechanism does a broker use to determine whether a follower replica is caught up enough to stay in the ISR?

  1. Checking the follower's configured broker.rack value
  2. Comparing the follower's disk usage to the leader's
  3. Comparing the follower's last fetch time against replica.lag.time.max.ms Correct answer.
  4. Counting the follower's open network connections

Explanation

A follower remains in the ISR as long as it has fetched up to the leader's log end offset within replica.lag.time.max.ms. Rack and connection counts do not determine ISR membership.

Question 25Configure Apache Kafka clusters

Which configuration enables rack-aware replica assignment so replicas of a partition land on different racks?

  1. broker.rack Correct answer.
  2. default.replication.factor
  3. min.insync.replicas
  4. replica.selector.class

Explanation

Setting broker.rack on each broker lets Kafka place replicas across racks for fault tolerance. The replica selector class is a separate mechanism for follower fetching locality.

Question 26Configure Apache Kafka clusters

Which broker configuration parameter defines the directory path where Kafka persists partition log segments?

  1. log.dirs Correct answer.
  2. data.dir
  3. segment.store.path
  4. kafka.log.path

Explanation

The log.dirs property lists one or more directories where the broker stores partition data. Multiple paths can be supplied as a comma-separated list to spread partitions across disks.

Question 27Configure Apache Kafka clusters

A broker must be identified uniquely within a cluster. Which configuration assigns that identity in a ZooKeeper-based deployment?

  1. server.id
  2. instance.id
  3. broker.id Correct answer.
  4. node.name

Explanation

In ZooKeeper-based clusters each broker registers with a unique integer set by broker.id. Duplicate IDs cause registration conflicts and prevent proper cluster membership.

Question 28Configure Apache Kafka clusters

Which broker setting specifies the default number of log partitions per topic when a topic is created without an explicit partition count?

  1. num.partitions Correct answer.
  2. default.partitions
  3. partition.count
  4. topic.partitions

Explanation

num.partitions sets the fallback partition count applied when a topic is created without specifying partitions. It affects both automatic creation and command-line creation that omits the partition argument.

Question 29Configure Apache Kafka clusters

Which configuration on the broker determines how long a log segment is retained under the delete cleanup policy based on time?

  1. log.segment.ms
  2. retention.time.ms
  3. log.roll.hours
  4. log.retention.hours Correct answer.

Explanation

log.retention.hours (or the related minutes/milliseconds variants) controls how long data is kept before eligible segments are deleted. log.roll and log.segment settings govern segment rolling, not retention.

Question 30Configure Apache Kafka clusters

Which property sets the default replication factor applied to topics created automatically by the broker?

  1. auto.replication.factor
  2. default.replication.factor Correct answer.
  3. replication.default
  4. num.replica.fetchers

Explanation

default.replication.factor defines the replication factor used when a topic is auto-created without an explicit value. It does not change the replication of topics that already exist.

Question 31Configure Apache Kafka clusters

Which configuration on the broker caps the largest record batch that will be accepted from producers?

  1. max.request.size
  2. socket.request.max.bytes
  3. replica.fetch.max.bytes
  4. message.max.bytes Correct answer.

Explanation

message.max.bytes limits the size of a single record batch the broker accepts. Producers must keep max.request.size within this limit to avoid rejections.

Question 32Configure Apache Kafka clusters

Which broker configuration controls the number of threads handling network requests?

  1. num.replica.fetchers
  2. num.io.threads
  3. background.threads
  4. num.network.threads Correct answer.

Explanation

num.network.threads sets the pool size for receiving requests and sending responses. num.io.threads separately governs disk I/O processing.

Question 33Configure Apache Kafka clusters

Which tool is used to add partitions to an existing topic in a running cluster?

  1. kafka-configs.sh --alter --partitions
  2. kafka-reassign-partitions.sh --add
  3. kafka-topics.sh --alter --partitions Correct answer.
  4. kafka-partitions.sh --increase

Explanation

kafka-topics.sh with the --alter and --partitions options increases the partition count of an existing topic. Partitions can only be increased, never decreased.

Question 34Configure Apache Kafka clusters

A topic has replication factor 3 and min.insync.replicas=2. A producer uses acks=all. One broker hosting a replica fails, leaving two in-sync replicas. What is the result for a new produce request?

  1. The write succeeds only after the failed broker restarts.
  2. The write fails because three in-sync replicas are required.
  3. The write succeeds because two in-sync replicas satisfy min.insync.replicas. Correct answer.
  4. The write is redirected to the controller broker for completion.

Explanation

With acks=all, the broker requires the number of in-sync replicas to meet min.insync.replicas. Two remaining in-sync replicas meet the threshold of 2, so the write is acknowledged.

Question 35Configure Apache Kafka clusters

Which broker property determines the maximum time a follower replica may lag before it is removed from the in-sync replica set?

  1. replica.socket.timeout.ms
  2. replica.lag.time.max.ms Correct answer.
  3. replica.fetch.wait.max.ms
  4. replica.max.lag.records

Explanation

replica.lag.time.max.ms defines how long a follower may go without catching up to the leader's log end offset. Followers exceeding this window are removed from the ISR.

Question 36Configure Apache Kafka clusters

A cluster spans two data centers. Which broker configuration enables rack-aware replica placement so that replicas of a partition are spread across racks?

  1. broker.rack Correct answer.
  2. cluster.rack
  3. replica.rack
  4. rack.id

Explanation

Setting broker.rack on each broker allows Kafka to assign replicas across distinct racks. This improves fault tolerance when an entire rack becomes unavailable.

Question 37Configure Apache Kafka clusters

Which internal topic stores committed consumer group offsets when group coordination is handled by brokers?

  1. __transaction_state
  2. __consumer_offsets Correct answer.
  3. __group_metadata
  4. __offset_store

Explanation

__consumer_offsets is a compacted internal topic where brokers persist committed offsets for consumer groups. Its replication factor should be at least 3 in production.

Question 38Configure Apache Kafka clusters

In KRaft mode, which process role must a node have to participate in the metadata quorum?

  1. coordinator
  2. controller Correct answer.
  3. zookeeper
  4. broker

Explanation

Nodes configured with the controller role participate in the KRaft metadata quorum and elect a leader among themselves. Brokers serve client traffic but do not vote in the quorum unless they also have the controller role.

Question 39Configure Apache Kafka clusters

Which configuration must be identical across all nodes in a KRaft cluster so they recognize the same cluster?

  1. broker.rack
  2. num.partitions
  3. cluster.id Correct answer.
  4. log.dirs

Explanation

The cluster.id value must match on every node; it identifies the cluster during quorum formation. Mismatched cluster IDs prevent nodes from joining the same metadata quorum.

Question 40Configure Apache Kafka clusters

A broker is added to a running cluster. What must be done for existing partitions to place replicas on the new broker?

  1. Reassign partitions using kafka-reassign-partitions.sh. Correct answer.
  2. Restart all brokers so the controller rebalances automatically.
  3. Delete and recreate the topic with the same name.
  4. Change the topic replication factor to 1 and back to 3.

Explanation

Adding a broker does not automatically move existing replicas. The partition reassignment tool must be used to move replicas onto the new broker.

Question 41Configure Apache Kafka clusters

Which broker configuration controls the maximum size of a single log segment before it is rolled?

  1. log.retention.bytes
  2. segment.max.size
  3. log.file.size
  4. log.segment.bytes Correct answer.

Explanation

log.segment.bytes sets the size threshold at which the active segment is closed and a new one is started. Rolling segments enables retention and compaction to act on closed segments.

Question 42Configure Apache Kafka clusters

Which broker setting allows topics to be created automatically when a producer or consumer references a non-existent topic?

  1. auto.topic.creation
  2. topic.auto.create
  3. auto.create.topics.enable Correct answer.
  4. create.topics.on.demand

Explanation

auto.create.topics.enable, when true, lets the broker create a topic on first reference. Many production clusters disable it to prevent accidental topic creation.

Question 43Configure Apache Kafka clusters

Which directory configuration does a KRaft controller use to store its metadata log?

  1. metadata.log.dir Correct answer.
  2. kraft.log.path
  3. controller.log.dir
  4. log.dirs

Explanation

metadata.log.dir specifies where the KRaft controller persists its metadata log. If unset, the controller may fall back to the first log.dirs entry.

Question 44Configure Apache Kafka clusters

A cluster with three brokers starts up with offsets.topic.replication.factor set to 1. What is the consequence?

  1. The cluster refuses to start until the value is raised to 3.
  2. Consumer groups cannot commit offsets at all.
  3. The offsets topic is created with replication factor 3 anyway.
  4. The offsets topic has a single replica and loses availability if that broker fails. Correct answer.

Explanation

The offsets topic is created with the configured replication factor, so a value of 1 leaves it vulnerable to broker failure. Best practice is to set it to at least 3 in production clusters.

Question 45Configure Apache Kafka clusters

A cluster must survive the loss of two brokers while keeping all data available. What is the minimum replication factor for topics?

  1. 4
  2. 2
  3. 1
  4. 3 Correct answer.

Explanation

With replication factor 3, two replicas can be lost while one copy remains. Replication factor 2 only tolerates a single broker failure.

Question 46Configure Apache Kafka clusters

A broker has num.io.threads=8 and num.network.threads=3. Under heavy produce load with slow disks, which change most directly increases request processing capacity?

  1. Increase socket.send.buffer.bytes.
  2. Increase num.replica.fetchers.
  3. Increase num.io.threads. Correct answer.
  4. Increase num.network.threads.

Explanation

num.io.threads governs the threads that perform request processing including disk I/O. When disks are the bottleneck, raising this value increases processing parallelism.

Question 47Configure Apache Kafka clusters

A topic has min.insync.replicas=2, replication factor 3, and a producer uses acks=all. Two replicas go offline, leaving one in-sync replica. What happens to produce requests?

  1. They succeed because the leader is still available.
  2. They are queued until a second replica returns.
  3. They fail with NotEnoughReplicas because the in-sync count is below the minimum. Correct answer.
  4. They succeed but are written only to the leader without replication.

Explanation

With acks=all, the broker rejects writes when in-sync replicas fall below min.insync.replicas. This protects against data loss by preventing under-replicated writes.

Question 48Configure Apache Kafka clusters

A cluster uses rack-aware assignment with three racks and a topic replication factor 3. What placement does Kafka aim for?

  1. One replica per rack when possible. Correct answer.
  2. All replicas on the same rack to reduce latency.
  3. Replicas placed randomly regardless of rack.
  4. Two replicas on one rack and one on another.

Explanation

With broker.rack configured, Kafka spreads replicas across distinct racks up to the replication factor. This ensures a rack outage does not take down all replicas of a partition.

Question 49Configure Apache Kafka clusters

A broker's log.retention.bytes is set lower than the current log size for a partition. What is the effect on the delete cleanup policy?

  1. Retention is ignored until log.retention.hours elapses.
  2. The broker refuses new writes until the log shrinks.
  3. The active segment is truncated immediately.
  4. Older segments are deleted to bring total size within the limit. Correct answer.

Explanation

log.retention.bytes caps the total size of a partition log, causing older closed segments to be deleted. It works alongside time-based retention, and the stricter limit applies.

Question 50Configure Apache Kafka clusters

A broker in a running cluster has log.dirs configured with two directories. A new topic is created with default settings. How does the broker decide which single log directory receives the new partition's data?

  1. It selects the directory that currently holds the smallest total number of bytes on disk.
  2. It selects a directory using a round-robin counter kept per broker across all creations.
  3. It selects the directory with the fewest partitions currently assigned to it. Correct answer.
  4. It selects the directory listed first in log.dirs unless that directory is on an unmounted volume.

Explanation

Kafka performs a per-broker log directory placement: when a new partition is created, the broker counts how many partitions it already hosts in each configured log directory and places the new one in the directory with the fewest partitions. This balances partition counts rather than disk usage, so directories with larger partitions can still receive new ones. The choice is made independently on each broker, not coordinated cluster-wide.