IOT Multiple Choice Questions 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
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: d
Clarification: In .NET, an object of type Thread in the namespace System.Threading represents and controls one thread. Its constructor takes a parameter less method as a parameter. The method will be executed once the threads Start method is called.
4. Command to make thread sleep?
a) Thread.Sleep
b) Thread_Sleep
c) ThreadSleep
d) Thread_sleep
Answer: a
Clarification: 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
Answer: b
Clarification: 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.
6. _______ method puts zero into the buffer.
a) HandlePut(object o)
b) HandletGet(object o)
c) HandletGet()
d) HandletPut()
Answer: a
Clarification: 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
Answer: d
Clarification: 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.
8. In HandlePut(object o), o represents?
a) Null
b) Zero
c) Empty
d) Origin
Answer: a
Clarification: 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. Object o may be 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
Answer: b
Clarification: 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.
10. What is the result for HandleGet()?
a) Null
b) Zero
c) Empty
d) Origin
Answer: a
Clarification: 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. 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
Answer: c
Clarification: 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
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: c
Clarification: 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
Answer: b
Clarification: Switching among threads occurs so frequently -50 times per second that all threads appear to run in parallel.