You are on page 1of 11

EAD Presentation

Topic Task Parallel Library


Submitted To Sir. Bilal Shahzad
Submitted By BCSF13A009
BCSF13A021
BCSF13A031
Video Link https://www.youtube.com/watch?v=sdDuM
-Xy394&feature=youtu.be
Degree BS CS
Section Afternoon
Institution Punjab University College of Information
Technology

MCQs
i) Namespaces for TPL is/are
(a) System.Threading
(b) System.Threading.Tasks
(c) System.Tasks
(d) Both a and b
ii) TPL handles the scheduling of threads on which class
(a) ThreadPool
(b) ThreadLocal(T)
(c) Both a and b
(d) None of them
iii) The ____ method provides a convenient way to run any number of
arbitrary statements concurrently.
(a) Parallel.Invoke
(b) Parallel.Execute
(c) None of them

iv) A task that does not return a value is represented by the ___ class.
(a) System.Threading.Tasks.Task
(b) System.Threading.Tasks.Task<TResult>
(c) None of them

v) A task that returns a value is represented by the ___ class.


(a) System.Threading.Tasks.Task
(b) System.Threading.Tasks.Task<TResult>
(c) None of them
vi) System.Threading.Tasks.Task<TResult> class inherits from
(a) Task
(b) Thread
(c) None of them
vii) What does Task.Wait Method () do ?
(a) Wait for other task
(b) calling thread to wait until the current task has completed
(c) None of them
viii) Queues the specified work to run on the thread pool and returns a
Task object that represents that work.
(a) Task.Run Method
(b) Task.Wait Method
(c) None of them

ix) Threadpool is used to ________.


(a) To make easy the process of thread creation
(b) To make easy debugging process
(c) To save time of thread creation
(d) To avoid complexity.

x) Threadpool creates or reduces real threads using a hillclimbing algo to


______.
(a)
To maximize CPU usage
(b)
To reduce the cost of thread creation
(c)
To maximize memory utilization
(d)
To minimize CPU usage
xi) While dealing with "threads" in ".Net", one can avoid performance
bottlenecks and enhance the overall responsiveness of his / her
application by using _____________ programming.
(a)
Multithreading programming
(b)
Synchronous programming
(c)
Asynchronous programming
xii) Which class provides a mechanism for executing a method on a
thread pool thread at specified intervals
(a) Timer Class
(b) Invoker Class
(c) None of them

xiii)
Which of the following is correct way to temporarily stop
execution of a thread object named as "myThread" for 500
millisecond ?
(a) myThread.Sleep(0.05);
(b) myThread.Stop(0.05);
(c) myThread.Sleep(500);
(d) myThread.Stop(500);

xiv) ______________ is more than one thing happening at the same time.
(a)
Cohesion
(b)
Congruence
(c)
Coherence
(d)
Concurrency
xv) Which of the following class supports data parallelism in "Task
Parallel Library"?
(a)
System.Threading.Tasks
(b)
System.Task.Parallel
(c)
System.threading.Task.Parallel
(d)
System.Task.Threading.Parallel
xvi) The "Task Based Asynchronous pattern" method returns either a
"Task" or a "Task<TResult>" based on whether the corresponding
__________ method returns "void" or a type "TResult".
(a) Callback

(b) Return
(c) Asynchronous
(d) Synchronous
xvii) Which of the following is not a part of "cancellation" task?
(a) The calling thread does forcibly end the task
(b) Notice and respond to the cancellation request in your user
delegate

(c) Pass a cancellation token to your user delegate and optionally to


the task instance
(d) Create and start a cancelable task
xviii) Which of the following is not handled by the Task Parallel Library
(TPL)?
(a) Partitioning of the work
(b) Progress report handling
(c) Scheduling of threads
(d) Scales the degree of concurrency
xix) Observe the following piece of code taken out from Main() function:
Thread myThread = new Thread (Go);
myThread.Strat();
myThread.Join();
What will be the effect of instruction myThread.Join()?
(a) Execution of myThread will be joined with existing running
threads

(b) myThread will be executed after Main thread is completed


(c) Main thread execution will be suspended till completion of
myThread
(d) Both Main thread and myThread can now share the data

xx) TPL Support data parallelism through ___ class.


(a) System.Threading.Tasks.Parallel
(b) System.Threading.Task.Invoke
(c) None of them
xxi) The default scheduler for TPL will be the ___
(a) CLR thread pool
(b) Task.Timer
(c) None of them
xxii) What is a thread?
(a) path of execution within a process
(b) function execution within a process
(c) Task execution within a process
xxiii) Problem with multithreading program is/are
(a) Race Condition
(b) Mutual Exclusion

(c) Both
(d) None of them
xxiv) You can execute your LINQ queries in parallel using
(a) Parallel LINQ (PLINQ)
(b) Multithread LINQ (MLINQ)
(c) Both
(d) None of them

xxv) How to get the unique id of currently executing task ?


(a) task.id
(b) task.GetID()
(c) task.CurrentId
(d) None of them
xxvi) How to run the task synchronously on the current TaskScheduler?
(a) Task.run(synchronous)
(b) task.RunSynchronously()
(c) Task.sync()
xxvii)
How to run created task after a particular delay
(a) task.Start(5)
(b) task.Delay(5)
(c) task.Join(5)
xxviii)
How to release all resources used by the particular instance of
the task?

(a) task.Destroy()
(b) Task.Exit()
(c) task.Dispose()
(d) Task.Release()
xxix) In .NET a task represent a/an ___ operation
(a) Synchronous
(b) Asynchronous
(c) Parallel

xxx) In which .NET framework Task Parallel Library was introduced?


(a) 1.0
(b) 2.0
(c) 3.0
(d) 4.0

References
http://www.infoworld.com/article/2888469/microsoft-net/a-deep-dive-insidethe-task-parallel-library-features-in-net-framework.html
http://stackoverflow.com/questions/2521840/multithreading-or-task-parallellibrary
https://msdn.microsoft.com/en-us/library/dd537609%28v=vs.110%29.aspx

10

https://msdn.microsoft.com/en-us/library/dd460717%28v=vs.110%29.aspx
http://vustudents.ning.com/group/cs411-visual-programming/forum/topics/quiz4-february-27-2015-february-27-2015-from-32-to-42lectures?commentId=3783342%3AComment%3A4947917&xg_source=activity
&groupId=3783342%3AGroup%3A4194109

11

You might also like