IOT Questions and Answers – Multithreading

This set of IOT Multiple Choice Questions & Answers (MCQs) focuses on “Multithreading”.

1. _______ makes it possible for two or more activities to execute in parallel on a single processor.
a) Multithreading
b) Threading
c) SingleThreading
d) Both Multithreading and SingleThreading
View Answer

Answer: a
Explanation: MultiThreading makes it possible for two or more activities to execute in parallel on a single processor.

2. In ______ an object of type Thread in the namespace System.Threading represents and controls one thread.
a) . PY
b) .SAP
c) .NET
d) .EXE
View Answer

Answer: c
Explanation: In .NET, an object of type Thread in the namespace System.Threading represents and controls one thread. Its constructor takes a parameterless method as a parameter.

3. The method will be executed once the thread’s ______ method is called.
a) EventBegin
b) EventStart
c) Begin
d) Start
View Answer

Answer: d
Explanation: In .NET, an object of type Thread is in the namespace System. Threading represents and controls one’s thread. Its constructor takes a parameter less method as a parameter. The method will be executed once the thread’s Start method is called.
advertisement
advertisement

4. Command to make thread sleep?
a) Thread.Sleep
b) Thread_Sleep
c) ThreadSleep
d) Thread_sleep
View Answer

Answer: a
Explanation: A particular thread of the application can be blocked forever by calling Thread.Sleep(Timeout.Infinite).

5. An instance of class Buffer provides a threadsafe way of communication between ________
a) Actors
b) Objects
c) Locking
d) Buffer
View Answer

Answer: a
Explanation: An instance of class Buffer provides a threadsafe way of communication between actors. A buffer instance basically acts as a variable whose current value can be read and written.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. _______ method puts zero into the buffer.
a) HandlePut(object o)
b) HandletGet(object o)
c) HandletGet()
d) HandletPut()
View Answer

Answer: a
Explanation: void HandlePut(object o) method puts 0 into buffer. The new value in the buffer replaces the old one.

7. HandlePut(object o) performs what?
a) Fixing values
b) Locking
c) Changing values
d) Unlocking
View Answer

Answer: b
Explanation: void HandlePut(object o) method puts 0 into buffer. The new value in the buffer replaces the old one. The method performs the necessary locking to enable safe use of the buffer from multi threads.
advertisement

8. In HandlePut(object o), o represents?
a) Null
b) Zero
c) Empty
d) Origin
View Answer

Answer: a
Explanation: void HandlePut(object o) method puts 0 into buffer. The new value in the buffer replaces the old one. The method performs the necessary locking to enable safe use of the buffer from multi threads. In HandlePut (object o) method, o represents Null.

9. What is HandleGet() method function?
a) Current buffer state, with changing
b) Current buffer state, without changing
c) Previous buffer state, with changing
d) Previous buffer state, without changing
View Answer

Answer: b
Explanation: This method gets the current buffer state, without changing it. The method performs the necessary locking to enable safe of the buffer from multiple threads.
advertisement

10. What is the result for HandleGet()?
a) Null
b) Zero
c) Empty
d) Origin
View Answer

Answer: a
Explanation: The HandleGet() method gets the current buffer state, without changing it. The method performs the necessary locking to enable safe of the buffer from multiple threads. The result may be null.

11. Multithreading is a mechanism for splitting up a program into several parallel activities called _________
a) Methods
b) Objects
c) Classes
d) Threads
View Answer

Answer: d
Explanation: Multithreading is a mechanism for splitting up a program into several parallel activities called threads. Multithreading makes it possible for two or more activities to execute in parallel on a single processor.

12. Each thread is a single stream of execution.
a) False
b) True
View Answer

Answer: a
Explanation: Multithreading is a mechanism for splitting up a program into several parallel activities called threads. Each thread is a single stream of execution, yet they all share the same resources.

13. Multithreading on a single processor is possible with the help of _________
a) Threader
b) Scheduler
c) Method
d) Divider
View Answer

Answer: b
Explanation: Multithreading on a single processor is possible with the help of scheduler, which briefly stops the currently execution thread of an application after each time slice.

14. Scheduler switch threads in ________
a) Multilevel queue scheduling
b) Priority Scheduling
c) Round robin fashion
d) Multilevel feedback queue scheduling
View Answer

Answer: c
Explanation: It switches among threads in a round robin fashion so that every thread gets its fair share of processing time.

15. What is the switching speed?
a) 60 times per second
b) 50 times per second
c) 55 times per second
d) 66 times per second
View Answer

Answer: b
Explanation: Switching among threads occurs so frequently -50 times per second that all threads appear to run in parallel.

Sanfoundry Global Education & Learning Series – IOT.

To practice all areas of IOT, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.