IOT Multiple Choice Questions on “Sending and Receiving Data in Real Time Through Internet”.
1. _________ allows us to control electronic components
a) RETful API
b) RESTful API
c) HTTP
d) MQTT
Answer: a
Clarification: RETful API that allows us to control electronic components connected to our Intel Galileo Gen 2 board through HTTP requests.
2. MQTT stands for _____________
a) MQ Telemetry Things
b) MQ Transport Telemetry
c) MQ Transport Things
d) MQ Telemetry Transport
Answer: d
Clarification: MQTT was known as MQ Telemetry Transport protocol. MQTT is a lightweight protocol that runs on top of the TCP/IP protocol.
3. MQTT is better than HTTP for sending and receiving data.
a) True
b) False
Answer: a
Clarification: We want to send and receive data in real time through internet and RESTful API is not the most appropriate option to do this. Instead, we will work on MQTT which is lighter than HTTP.
4. MQTT is _________ protocol.
a) Machine to Machine
b) Internet of Things
c) Machine to Machine and Internet of Things
d) Machine Things
Answer: c
Clarification: The MQTT protocol is a machine to machine and Internet of thing connectivity protocol.
5. Which protocol is lightweight?
a) MQTT
b) HTTP
c) CoAP
d) SPI
Answer: a
Clarification: MQTT is a lightweight protocol that runs on top of the TCP/IP protocol and works with publish subscribe mechanism.
6. PubNub publishes and subscribes _________ in order to send and receive messages.
a) Network
b) Account
c) Portal
d) Keys
Answer: d
Clarification: It is necessary to generate our PubNub publishes and subscribes keys in order to send and receive messages in the network.
7. By clicking which key the PubNub will display public, subscribe, and secret keys.
a) Pane
b) Demo Keyset
c) Portal
d) Network
Answer: b
Clarification: Click on Demo keyset pane and PubNub will display public, subscribe, and secret keys. We must copy and paste each of these keys to use them in our code that will publish messages and subscribe to them.
8. The messageChannel class declares the _________ class attribute that defines the key string.
a) command_key
b) command-key
c) commandkey
d) Key_command
Answer: a
Clarification: The messageChannel class declares the command_key class attribute that defines the key string that defines what the code will understand as the command.
9. _________ method saves the received arguments in three attributes.
a) __Init
b) Init__
c) __Init__
d) _init_
Answer: c
Clarification: __Init__ method saves the received arguments in three attributes with the same names.
10. _________ and _________ saves the publish and subscribe keys that we have generated with the PubNub Admin portal.
a) public_key and subscribe_key
b) Public-key and subscribe-key
c) publickey and subscribekey
d) Key_public and key_subscribe
Answer: a
Clarification: Then, the constructor declares two local variables: public_key and subscribe_key. These local variables save the public and subscribe keys that we had generated with the PubNub Admin portal.
11. _________ specifies the function that will be called when there is a new message received from the channel.
a) Reconnect
b) Error
c) Connect
d) Callback
Answer: d
Clarification: The call to this message specifies many methods declared in the MessageChannel class
Callback: specifies the function that will be called when there is a new message received from the channel.
12. _________ specifies the function that will be called on an error event.
a) Callback
b) Error
c) Connect
d) Reconnect
Answer: b
Clarification: The call to this message specifies many methods declared in the MessageChannel class
Error: specifies the function that will be called on an error event.
13. _________ Specifies the function that will be called when a successful connection with the PubNub cloud.
a) Callback
b) Error
c) Connect
d) Reconnect
Answer: c
Clarification: The call to this message specifies many methods declared in the MessageChannel class
Connect: specifies the function that will be called when a successful connection with the PubNub cloud.
14. _________ specifies the function that will be called when a successful re-connection is completed.
a) Callback
b) Error
c) Connect
d) Reconnect
Answer: d
Clarification: The call to this message specifies many methods declared in the MessageChannel class
Reconnect: specifies the function that will be called when a successful re-connection is completed with the PubNub cloud.
15. ___________ specifies the function that will be called when the client disconnects.
a) Callback
b) Error
c) Connect
d) Disconnect
Answer: d
Clarification: The call to this message specifies many methods declared in the MessageChannel class
Disconnect: specifies the function that will be called when the client disconnects from the PubNub cloud.