Default Exchange — Concept Check
Questions on Default Exchange. Every queue is automatically bound to the default (nameless) exchange with a routing key equal to its name; publishing directly to a queue name uses this exchange implicitly.
Questions in this quiz
8 questions on Default Exchange — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a queue named 'task.queue' in RabbitMQ. What happens if you publish a message with exchange set to an empty string and routing key 'task.queue'?
- AThe message is broadcast to all queues.
- BThe message is discarded.
- CThe message is delivered directly to 'task.queue'.
- DThe message is delivered to a random queue.
2.A developer uses RabbitTemplate.convertAndSend('logs.queue', logEvent) without specifying an exchange. What is the result?
- AThe message is sent to a non-existent exchange.
- BThe message is sent to a default topic exchange.
- CThe message is sent directly to 'logs.queue'.
- DThe message is sent to all queues starting with 'logs'.
3.Why might you choose not to use the default exchange in a production environment with multiple consumers?
- AIt requires manual binding of queues.
- BIt automatically duplicates messages to all queues.
- CIt only supports exact queue-name routing.
- DIt supports wildcard routing, which is inefficient.
4.A new developer believes that the default exchange can fan out messages to multiple queues. What is the reality?
- AThe default exchange only supports direct routing to one queue.
- BThe default exchange supports wildcard routing.
- CThe default exchange automatically applies message TTL.
- DThe default exchange can fan out to multiple queues.
5.In Spring AMQP, what must you do to declare the default exchange?
- ANothing, it always exists.
- BDeclare it in RabbitConfig.
- CUse @RabbitListener annotation.
- DBind it manually to each queue.
6.What is a limitation of using the default exchange in RabbitMQ?
- AIt does not support direct routing.
- BIt cannot route messages to multiple queues.
- CIt supports only fanout routing.
- DIt requires explicit declaration in each vhost.
7.A developer mistakenly believes that publishing to the default exchange requires specifying the exchange name. What should they do instead?
- ASpecify 'default' as the exchange name.
- BUse a wildcard routing key.
- CDeclare a new exchange for each queue.
- DSet the exchange to an empty string.
8.What is the correct way to publish a message to 'order.queue' using the default exchange in Java AMQP client?
- ASet exchange to "default" and routing key to "order.queue".
- BSet exchange to "order.exchange" and routing key to "order.queue".
- CSet exchange to "" and routing key to "order.queue".
- DSet exchange to "" and routing key to "".