0% found this document useful (0 votes)
249 views8 pages

Icapachekafkadeveloper

The document provides questions and answers related to Apache Kafka. It tests knowledge about topics such as where Kafka persists messages, broker properties, consumer groups, and more. There are multiple choice questions about concepts like leaders, partitions, replication, and Kafka architecture.

Uploaded by

earnhim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
249 views8 pages

Icapachekafkadeveloper

The document provides questions and answers related to Apache Kafka. It tests knowledge about topics such as where Kafka persists messages, broker properties, consumer groups, and more. There are multiple choice questions about concepts like leaders, partitions, replication, and Kafka architecture.

Uploaded by

earnhim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Infosys Certified Apache Kafka Developer

https://prepflix.in/questions/infosys
Updated on 20 Feb 2024
Do not attempt if it is older than 1 month. Request new Dumps from admin @prepflixadmin (Telegram)

Where do Kafka persists all its messages ?

Option A data.dir
Option B logs.dir
Option C config.dir
Option D topics.dir
Correct Answer b

For some maintenance activity in the cluster,


you are shutting down one of the Kafka
brokers. In which of the following case a
topic partition in the cluster will not be
affected by this activity? (Choose Two)

Option A If the replication factor is 1 and is hosted in the same broker


Option B If the leader of the partition is the same broker
Option C If the replication factor is greater than 1 and at least one of these replicas is alive
Option D All the partitions hosted on the broker have replicas
Correct Answer cd

Which of the following represents the category of messages stored together?

Option A Topic
Option B Message
Option C Offset
Option D Message Broker
Correct Answer a

In which of the below use cases, Kafka component can be used as the best option on streaming data scenarios? (Choose Three)

Option A Geo location data streaming


Option B Click Stream data analysis
Option C Sensor data analysis
Option D Static data analysis
Correct Answer abc

Which of the following statement is TRUE about Kafka? (Choose Two)

Option A Kafka does not store different categories of messages under Topics
Option B Kafka is a highly available, distributed, fault-tolerant messaging system
Option C Kafka is a highly available, non-distributed, fault-tolerant messaging system
Option D Kafka is a distributed, fault-tolerant, messaging but not a storage system
Correct Answer b

Which of the following statement(s) is/are TRUE about Kafka?


Option A Kafka is highly available and works on non-hdfs environment as well
Option B Kafka is likely to be available only on specific durations
Option C Kafka is not fault tolerant by default
Option D Kafka is likely to be available and works on non-hdfs environment as well
Correct Answer a

Which of the following statement is INCORRECT about Kafka broker?

Option A There can be only one Leader partition in a Kafka broker


Option B There can be more than one Leader partition in a Kafka broker
Option C There can be two Leader partition in a Kafka broker
Option D There can be maximum of three Leader partition in a Kafka broker
Correct Answer a

Which of the following statement(s) is/are NOT TRUE about Kafka?

Option A Kafka consumer can not re-wind or re-consume data from the broker
Option B Kafka maintains stable performance even when several TBs of messages are stored.
Option C In Kafka events are not deleted after consumption
Option D Kafka can read data from sockets
Correct Answer c

Which of the following factors are important


while determining the size of a Kafka
cluster?

Option A How much disk capacity is required for retaining messages


Option B Capacity of the cluster to handle requests
Option C How much storage is available on a single broker
Option D All the given factors
Correct Answer d

Sam works on a Kafka streaming application and needs to specify the Kafka broker property in his console producer application while
running it.
Which of the following property can be used by him?

Option A --broker-list
Option B --brokers
Option C --bootstrap-server
Option D --broker-server-start
Correct Answer a

Which of the following parameter is set to


limit the maximum size of a message that
can be produced ?

Option A message.max.bytes
Option B log.segment.bytes
Option C log.retention.bytes
Option D fetch.message.max.bytes
Correct Answer a

A Kafka cluster has 5 nodes and 10 Topics.


A consumer which is at position 5 in a
partition for a topic x indicates which of the
following. (Choose Two)

Option A The consumer has consumed records with offsets 0 through 5


Option B The consumer has consumed records with offsets 0 through 4
Option C The consumer will next receive the record with offset 5
Option D The consumer will next receive the record with offset 6
Correct Answer bc

Which of the following property has a default


value of 0 in Kafka configuration ?

Option A broker.id
Option B port
Option C zookeeper.connect
Option D num.partitions
Correct Answer a

What are the strategies used by Kafka to


clean up its old log segments? (Choose
Two)

Option A log retention period


Option B log retention size
Option C log segment replicas
Option D log caching
Correct Answer ab

Due to some unforeseen technical issues,


you had to forcefully stop (hard kill) your
Kafka broker . What is true in this scenario?
(Choose Two)

Option A Syncing the logs will happen automatically here


Option B Kafka cluster will automatically detect the failure of the broker
Option C Kafka cluster will elect new leaders for the partitions on that machine
Option D Syncing of the logs will not happen automatically
Correct Answer bd

Which of the following statement(s) is/are INCORRECT about Kafka consumers? (Choose Two)

Option A Kafka can have only one consumer per consumer group
Option B Kafka load balances the receiving data across consumers
Option C Kafka does not load balance the receiving data across consumers
Option D Kafka does not have support for Consumer API. Only a default consumer can be used
Correct Answer ac

You are in need of making some


configuration changes to one of the Kafka
brokers in the cluster. You decide to do a
graceful shutdown of the server to make
sure which of the following reasons?
(Choose Two)

Option A the partitions are replicated


Option B It will sync all its logs to disk to avoid any log recovery required when it restarts
Option C It will migrate any partitions to other replicas to minimize the time each partition is unavailable to a few milliseconds
Option D the partitions are transferred to zookeeper
Correct Answer bc

Which of the following node in Kafka is responsible for all read and writes for a given partition?

Option A Leader
Option B ISR
Option C Follower
Option D Replica
Correct Answer a

What are the reasons for high efficiency


messaging in Kafka clusters ? (Choose Two)

Option A Kafka clusters are built on Unix systems


Option B Kafka follows a standardized binary message format that is shared by the producer, the broker, and the consumer
Option C Messages are deleted as soon as they are consumed
Option D Messages are grouped in batches and are sent to the destination
Correct Answer abd

A Kafka cluster has 30 nodes. There are 3 topics created, each with 5 partitions. How many broker processes will run?

Option A 90 processes, one process for each topic on each node.


Option B 15 processes, one process for each topic and partition.
Option C 30 processes, one on each node
Option D 150 processes, one process for each partition on each node
Correct Answer c
Which of the following properties is not relevant to a Kafka topic?

Option A Offset
Option B Partition number
Option C Key
Option D Object
Correct Answer d

Which of the following statement(s) is/are CORRECT regarding data flow in Kafka? (Choose Three)

Option A Producers get the required metadata (Broker, Topic and Partition) from Zookeeper that tells to which Leader partition the messages
need to be published
Option B Messages written to the leader (for e.g., Partition 1 on Broker 1) are passively replicated to zero or more followers
Option C Producers get the required metadata (Broker, Topic and Partition) from LEADER partition and redirects messages accordingly
Option D When the leader goes down, Zookeeper elects any one of the followers holding an In Sync Replica* as the leader
Correct Answer abd

Which of the below statement(s) are TRUE about Kafka architecture? (Choose Three)

Option A Number of partitions in a topic can be configured at the time of topic creation
Option B Data migration from MySQL to Kafka is not possible
Option C Zookeeper keeps track of Consumer message consumption
Option D Zookeeper keeps track of list of topics created in the Kafka cluster
Correct Answer acd

Which of the below component in Kafka architecture facilitates to run multiple consumer instances in parallel, reading data from different
partitions of same topic.

Option A Topic
Option B consumer group
Option C Producers
Option D Replication Factor
Correct Answer b

What kind of delivery guarantee the below consumer offers?

while (true) {
ConsumerRecords<String, String> records = consumer.poll(100);
try {
consumer.commitSync();
} catch (CommitFailedException e) {
log.error("commit failed", e)
}
for (ConsumerRecord<String, String> record : records)
{
System.out.printf("topic = %s, partition = %s, offset =
%d, customer = %s, country = %s\n",
record.topic(), record.partition(),
record.offset(), record.key(), record.value());
}
}

Option A At-most once


Option B Exactly once
Option C At-least once
Option D More-than once
Correct Answer a

Shane has created a custom producer application and needs to specify the broker name with the port number using a Java properties object
called "propsClickStream". Which below statement shall help him perform this?

Option A propsClickStream.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS)


Option B propsClickStream.put(BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS)
Option C propsClickStream.put(ProducerConfig, BOOTSTRAP_SERVERS)
Option D propsClickStream.put(ProducerConfig.BOOTSTRAP_SERVERS)
Correct Answer a
A producer attempts to publish a message
and experiences a network error. Which of
the following is/are TRUE in this situation?
(Choose Two)

Option A Producer cannot be sure if this error happened before or after the message was committed
Option B Producer will resend the message and may result in writing the message again to the log
Option C Consumer will not be able to fetch messages which were sent before the network error
Option D All the consumers should reprocess the messages from the beginning once the error is rectified
Correct Answer ab

Which of the following formats are supported by Confluent Kafka schema registry (Choose
Three)?

Option A Avro
Option B Protobuff
Option C JSON
Option D XML
Correct Answer abc

Which of the following API can push messages to new Kafka topic?

Option A Producer
Option B Connector
Option C Stream
Option D Consumer
Correct Answer c

Which of the following method is used by


consumer to receive the messages ?

Option A commitSync()
Option B commitAsync()
Option C position(partition)
Option D poll(duration)
Correct Answer d

While creating custom Consumer application, which of the below configuration parameter is used to set Consumer Group ID?

Option A ConsumerConfig.GROUP_ID_CONFIG
Option B ConsumerConfig.GROUP_ID
Option C ProducerConfig.GROUP_ID_CONFIG
Option D ConsumerConfig.CONSUMER_GROUP_ID
Correct Answer a

Which of the following Consumer API helps


a consumer to move to a particular offset in
a partition?

Option A consumer.poll(partition, offset)


Option B consumer.seekToBeginning(consumer.assignment())
Option C consumer.seek(Partition,offset)
Option D consumer.pause(offset)
Correct Answer c

Which of the following Kafka API allows


managing and inspecting topics, brokers,
and other Kafka objects ?

Option A Admin API


Option B Connect API
Option C Consumer API
Option D Producer API
Correct Answer a

Shane works on a Kafka streaming application and needs to stream the data using a StreamBuilder object from a topic which has been
configured to be passed as a command line argument args[0]. Which of the following statements can be used?

Option A StreamsBuilder clickStreamBuilder = new StreamsBuilder(); KStream StreamData = clickStreamBuilder.stream(args[0])


Option B KStream StreamData = StreamBuilder.stream(args[0])
Option C StreamsBuilder clickStreamBuilder = new StreamsBuilder(); KStream StreamData = clickStreamBuilder.streamData(args[0])
Option D StreamBuilder clickStreamBuilder = new StreamBuilder(args[0]); KStream StreamData = clickStreamBuilder.stream(args[0])
Correct Answer a

What are the parameters that needs to be specified to read messages randomly from a topic?

Option A Topic, Partition


Option B Partition, Offset
Option C Topic, Offset
Option D Topic, Partition, Offset
Correct Answer d

Sara works on a streaming application and has to write the below command to create Kafka topic ("YouBuyyClickStream") with partition
value as 3, replication factor as 3. She needs to read the data from beginning from the topic.Which below property when replaced in XXXX
and YYYY will enable him to perform the read operation?

Command:
kafka-topics.sh --create --zookeeper localhost:2181 XXXX 3 --partitions 3 --topic YouBuyyClickStream
kafka-console-consumer.sh --zookeeper localhost:2181 --topic YouBuyyClickStream YYYY

Option A XXXX = --replication-factor, YYYY = --from-beginning


Option B XXXX = --replication, YYYY = --from-beginning
Option C XXXX = --replication-factor, YYYY = --from-begin
Option D XXXX = --replicate, YYYY = --from-beginning
Correct Answer a

Which of the following is TRUE when Compaction is enabled for a topic in Kafka by setting log.cleanup.policy=compact?

Option A Each message stored in the topic is compressed


Option B Compaction changes the offset of the message
Option C After Cleanup, only one message per key is retained with the latest value
Option D None of the above
Correct Answer c

You are writing a streaming application in Kafka. Listed below


is a line of code taken from the application written in Scala.

1. Properties props = new Properties();


2.
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG,
"localhost:4033");

In line 2 'localhost:4033' represents

Option A Zookeeper running at localhost on port 4033


Option B Producer application running at localhost on port 4033
Option C Kafka broker running at localhost on port 4033
Option D Stream application running at localhost on port 4033
Correct Answer c

Identify three correct statements from the following :

Option A Once created, it is not possible to delete a partition of a topic


Option B Once data is written into partition, its immutable
Option C A Topic should have more than one partition
Option D Order of messages is not guaranteed within the partition
Correct Answer abe

Shane works on a Kafka streaming application and needs to create a Kafka topic called "KafkaTestStreams". Which of the following syntax
shall be used by him?

Option A kafka-topics.sh --create --broker-list localhost:2181 --replication-factor 1 --partitions 1 --topic KafkaTestStreams


Option B kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic KafkaTestStreams
Option C kafka-topics.sh --create --zookeeper localhost:9092 --replication-factor 1 --partitions 1 --topic KafkaTestStreams
Option D kafka-topics.sh --create --topic KafkaTestStreams --from-beginning
Correct Answer b
When 'auto.create.topics.enable' is set to true in Kafka configuration, what are the cases where Kafka broker automatically creates a topic for
us? (Choose Three)

Option A When Producer send message to the topic


Option B When Consumer reads messages from the topic
Option C When Client request metadata for the topic
Option D When Client alters the number of partitions of a topic
Correct Answer acd

James is required to create a Kafka application to collect, store and consume real time data. Which of the following .sh file will help James to
add messages to a Kafka topic?

Option A kafka-create-message.sh
Option B kafka-add-message.sh
Option C kafka-consumer.sh
Option D kafka-producer.sh
Correct Answer d

What is the default offset setting from which consumer starts to read messages?

Option A Latest
Option B 0
Option C Earliest
Option D 1
Correct Answer a

Andrew works on a Kafka streaming application and has streamed and stored messages under specific Kafka topic called
YouBuyyClickStreamData. A Zookeeper configured to run on default port number 2181. He needs to read data from the beginning and
display messages in console using a default consumer. Which of the following command shall be used?

Option A kafka-console-consumer.sh --zookeeper localhost:2181 --topic YouBuyyClickStreamData


Option B kafka-console-consumer.sh --zookeeper localhost:2181 --topic YouBuyyClickStreamData --from-beginning
Option C kafka-console-consumer.sh --zookeeper localhost --topic YouBuyyClickStreamData --from-beginning
Option D kafka-console-consumer --broker-list localhost:2181 --topic YouBuyyClickStreamData --from-beginning
Correct Answer b

Sam needs to read logs data from multiple application servers and stream them into a Spark Streaming application to find key insights.
Which of the following statement(s) is/are CORRECT regarding this Streaming process? (Choose Two)

Option A Spark Streaming acts as a Consumer application


Option B Spark Streaming acts both as Messaging as well as Consumer system
Option C Spark Steaming needs to be mandatory and to be added in Kafka environment
Option D Spark streaming can get integrated with Kafka for this streaming requirement
Correct Answer ad

Which of the below statement(s) is/are true with respect to Kafka Integration?

Option A We can use Spark Streaming to read data from Kafka for real-time analysis and write the results back to Kafka in TEXT, CSV,
AVRO and JSON formats
Option B KafkaUtils API is used to connect the Kafka cluster to Spark streaming
Option C BrokerHosts, KafkaConfig API and SpoutConfig API are the three main classes to integrate Kafka with Storm
Option D All of the above
Correct Answer d

What is the broker configuration for specifying the log location?

Option A log.dirs
Option B log.location
Option C message.location
Option D message.dirs
Correct Answer a
Can we run Kafka without Zookeeper?

Option A Kafka cannot run without Zookeeper


Option B Kafka can run without Zookeeper through one of its broker acting as Zookeeper node temporarily
Option C Kafka can run without Zookeeper where the leader node acts as a Zookeeper temporarily
Option D Kafka can run without Zookeeper where the leader node manages metadata and Zookeeper not needed
Correct Answer a

Sam works on a streaming application and had written the below command to read streaming data from a Kafka topic
("YouBuyyClickStream") from the beginning. Zookeeper runs on default port. Which below property when replaced in XXXX and YYYY will
enable him to perform the read operation?
Command:
kafka-console-consumer.sh --zookeeper localhost:XXXX --topic YouBuyyClickStream YYYY

Option A XXXX = 2181, YYYY = --from-beginning


Option B XXXX = 2181, YYYY = --from-begin
Option C XXXX = 2181, YYYY = --beginning
Option D XXXX = --from-beginning, YYYY = 2181
Correct Answer a

Zookeeper services need to be running to start the Kafka broker service. TRUE or FALSE

Option A TRUE
Option B FALSE
Option C
Option D
Correct Answer a

You might also like