250+ TOP MCQs on Publishing Messages to the Cloud and Answers

IOT Questions on “Publishing Messages to the Cloud”.

1. Publishing messages is handled through ________ Class.
a) Client()
b) Server()
c) Publish()
d) Batch()

Answer: a
Clarification: Publishing message is handled through the client class(aliased as google-cloud-pubsub-publisherclient).

2. client() class provides ________ to create topics.
a) Software
b) Classes
c) Methods
d) Batch

Answer: c
Clarification: client() class provides the method to create topics. publish() method publishes messages to pub/sub. Publishing message is handled through the client class.

3. ________ method publishes messages to pub/sub.
a) Client()
b) Publish()
c) Server()
d) Batch()

Answer: b
Clarification: While client() provides method to create topics, publish() method publishes messages to pub/sub.

4. How many arguments are accepted by publish()?
a) 5 arguments
b) 3 arguments
c) 1 argument
d) 2 arguments

Answer: d
Clarification: This method accepts two positional arguments: the topic to publish to, and the body of the message.

5. Does publish() method accepts arbitrary arguments.
a) True
b) False

Answer: a
Clarification: Publish() method also accepts arbitrary keyword arguments, which are passed along as attributes of the message.

6. The topic in the publish method is in which form?
a) Binomial form
b) Canonical form
c) Nominal form
d) Message form

Answer: b
Clarification: The topic is passed along as a string; all topics have the canonical form of projects/{project_name}/topic/{topic_name}.

7. The message in pub/sub is an opaque blob of ________
a) Bits
b) Bytes
c) Word
d) Nibble

Answer: b
Clarification: The message in pub/sub is an opaque blob of bytes, and as such, you must send a bytes object in python 3.

  250+ TOP MCQs on Analog to Digital Converter and Answers

8. ________ error will show if we try to send text string instead of bytes.
a) TypeError
b) Error
c) Linker error
d) Compiler error

Answer: a
Clarification: If we send a text string the method will raise TypeError. TypeError will show if we try to send text string instead of bytes.

9. What do we call string in python 2?
a) Str
b) Unicode
c) Strs
d) Unicades

Answer: b
Clarification: In python 2 the text string is called as str, and in python 2 it is called as unicode.

10. When you publish a message ________ is automatically created?
a) Client
b) Server
c) Batch
d) Server

Answer: c
Clarification: Whenever we publish a message, a batch is automatically created. This way, if you publish a large volume of messages, it reduces the number of requests made to the server.

11. When the batch is created, it begins a countdown that publishes the batch once sufficient time has elapsed.
a) True
b) False

Answer: a
Clarification: When the batch is created, it begins a countdown that publishes the batch once sufficient time has elapsed.

12. What is the time elapsed after a batch is created?
a) 0.5 seconds
b) 0.05 seconds
c) 1.5 seconds
d) 1 second

Answer: b
Clarification: When the batch is created, it begins a countdown that publishes the batch once sufficient time has elapsed by default it is 0.05 seconds.

13. Every call to publish() will return a class that conforms to the __________ interface.
a) Batch
b) Client
c) Server
d) Future

Answer: d
Clarification: Every call to publish() will return a class that conforms to the future interface. You can use this to ensure that the publish.

  250+ TOP MCQs on Scheduling Process and IOT Services Lifecycle and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top