Engineering Questions with Answers - Multiple Choice Questions

MCQs on Sending and Receiving Data in Real Time Through Internet

1 - Question

_________ allows us to control electronic components.
a) RESTful API
b) CoAP API
c) HTTP
d) MQTT

View Answer

Answer: a
Explanation: RESTful API that allows us to control electronic components connected to our Intel Galileo Gen 2 board through HTTP requests.




2 - Question

MQTT stands for _____________
a) MQ Telemetry Things
b) MQ Transport Telemetry
c) MQ Transport Things
d) MQ Telemetry Transport

View Answer

Answer: d
Explanation: MQTT was known as MQ Telemetry Transport protocol. MQTT is a lightweight protocol that runs on top of the TCP/IP protocol.




3 - Question

MQTT is better than HTTP for sending and receiving data.
a) True
b) False

View Answer

Answer: a
Explanation: 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 - Question

MQTT is _________ protocol.
a) Machine to Machine
b) Internet of Things
c) Machine to Machine and Internet of Things
d) Machine Things

View Answer

Answer: c
Explanation: The MQTT protocol is a machine to machine and Internet of thing connectivity protocol.




5 - Question

Which protocol is lightweight?
a) MQTT
b) HTTP
c) CoAP
d) SPI

View Answer

Answer: a
Explanation: MQTT is a lightweight protocol that runs on top of the TCP/IP protocol and works with publish subscribe mechanism.




6 - Question

PubNub publishes and subscribes _________ in order to send and receive messages.
a) Network
b) Account
c) Portal
d) Keys

View Answer

Answer: d
Explanation: It is necessary to generate our PubNub publishes and subscribes keys in order to send and receive messages in the network.




7 - Question

By clicking which key the PubNub will display public, subscribe, and secret keys.
a) Pane
b) Demo Keyset
c) Portal
d) Network

View Answer

Answer: b
Explanation: 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 - Question

The messageChannel class declares the _________ class attribute that defines the key string.
a) command_key
b) command-key
c) commandkey
d) Key_command

View Answer

Answer: a
Explanation: 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 - Question

_________ method saves the received arguments in three attributes.
a) __Init
b) Init__
c) __Init__
d) _init_

View Answer

Answer: c
Explanation: __Init__ method saves the received arguments in three attributes with the same names.




10 - Question

_________ 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

View Answer

Answer: a
Explanation: 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 - Question

_________ 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

View Answer

Answer: d
Explanation: 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 - Question

_________ specifies the function that will be called on an error event.
a) Callback
b) Error
c) Connect
d) Reconnect

View Answer

Answer: b
Explanation: 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 - Question

_________ Specifies the function that will be called when a successful connection with the PubNub cloud.
a) Callback
b) Error
c) Connect
d) Reconnect

View Answer

Answer: c
Explanation: 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 - Question

_________ specifies the function that will be called when a successful re-connection is completed.
a) Callback
b) Error
c) Connect
d) Reconnect

View Answer

Answer: d
Explanation: 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 - Question

___________ specifies the function that will be called when the client disconnects.
a) Callback
b) Error
c) Connect
d) Disconnect

View Answer

Answer: d
Explanation: 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.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners