1. Submitted to
Sir. Bilal Shahzad
Submitted by
BCSF13A024
BCSF13A034
BCSF13A039
Presentation Video
https://youtu.be/kZKPIdLCWUc
Degree
BS (CS)
Punjab University College of Information Technology,
Lahore
2. MCQS
1) Thread pool is used to ________.
Select correct option:
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.
2) Thread pool creates or reduces real threads using a hillclimbing algo to ______.
Select correct option:
A. To maximize CUP usage
B. To reduce the cost of thread creation
C. To maximize memory utilization
D. To minimize CPU usage
3) While dealing with "threads" in ".Net", one can avoid performance bottlenecks and
enhance the overall responsiveness of his / her application by using _____________
programming.
Select correct option:
A. Multithreading programming
B. Synchronous programming
C. Parallel programming
D. Asynchronous programming
4) Which of the following is correct way to temporarily stop execution of a thread object
named as "myThread" for 500 milisec?
A. myThread.Sleep(0.05);
B. myThread.Stop(0.05);
C. myThread.Sleep(500);
D. myThread.Stop(500);
3. 5) ______________ is more than one thing happening at the same time.
Select correct option:
A. Cohesion
B. Congruence
C. Coherence
D. Concurrency
6) Which of the following class supports data parallelism in "Task Parallel Library"?
Select correct option:
A. System.Threading.Tasks
B. System.Task.Parallel
C. System.threading.Task.Parallel
D. System.Task.Threading.Parallel
7) 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
8) 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
4. 9) 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
10) 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
11) The Task Parallel Library introduces the concept of _________
A. Task
B. Thread
C. Files
D. Multithreading
12) Why Task Parallel Library uses tasks instead of threads
A. Threads consists of context switching
B. Thread Creation is costly
C. It uses the Thread Pool under the hood, in order to distribute the work
D. All of the above
5. 13) Which of the following class supports "Task Parallel Library"?
Select correct option:
A. System.Threading.Tasks
B. System.Task.Parallel
C. System.threading.Task.Parallel
D. System.Task.Threading.Parallel
14) How we create a new task?
A. Task t1
B. Task t1 = new Task()
C. Task t1 = new Task(action)
D. None of the above
15) How we can wait for a task to finish?
E. Task.Join(task1)
F. Task.Wait(task1)
G. Task.Exit()
H. None of the above
16) How we can wait for all tasks to finish
A. Task.JoinAll(task1)
B. Task.WaitAll(task1,task2,task3)
C. Task.ExitAll()
D. None of the above
17) In which .NET framework Task Parallel Library was introduced
A. 1.0
B. 2.0
C. 3.0
D. 4.0
6. 18) How to invoke more than one actions in parallel?
A. Invoke(a1,a2,a3)
B. Parallel(a1,a2,a3)
C. Task.Parallel(a1,a2,a3)
D. Parallel.Invoke(a1,a2,a3)
19) What is Parallel.For loop?
A. Parallel.For loop is used for Parallelism, which is taking a certain task and dividing
it into a set of related tasks to be executed concurrently.
B. Same as for loop, which is used for task.
C. Parallel.For loop is used for Parallelism, which is taking a certain threads and dividing it
into a set of related threads to be executed concurrently.
D. Both A and C.
20) What is the parallel implementation of LINQ to Objects?
A. LINQ
B. LINQ to tasks
C. LINQ to Parallel
D. PLINQ
21) In .NET, a task that doesn’t return a value is represented by the ____________
A. System.Threading.Tasks.Task<TResult>
B. System.Threading.Tasks.Task
C. System.Threading.Tasks
D. None of the above.
22) In .NET a Task represents an __________ operation.
A. Synchronous
B. Asynchronous
C. Parallel
D. Callback
23) How to create a continuation that executes asynchronously when the target Task completes?
A. Task(Action<Task>)
B. Task.Continue(Action<Task>)
C. Task.ContinueWith(Action<Task>)
D. Both A and C
7. 24) How to release all resources used by a particular instance of task?
A. task.Destroy()
B. task.Exit()
C. task.Release()
D. task.Dispose()
25) How to run a created task after a particular delay
A. task.Start(10)
B. task.Create(10)
C. task.Delay(10)
D. task.Join(10)
26) The Task Parallel Library (TPL) is a set of public types and APIs in the namespace:
a. System.Threading
b. System.Data
c. System.Resources
d. System.Management
27) A difference between threads and tasks:
a. Time slicing is used for tasks whereas threads run simultaneously
b. Time slicing is used for threads whereas tasks run simultaneously
c. Threads utilize the complete power of multicores whereas tasks don’t
d. Both b and c
28) Which of the following is not a state of the task:
a. Faulted
b. Canceled
c. Completed
d. Zombie
29) How to run the Task synchronously on the current TaskScheduler.
A. task.run(synchrnous)
B. task.sync()
C. task.synchronous()
D. task.RunSynchronously()
8. 30) How to get the unique ID of currently executing task.
A. task.id
B. task.GetID()
C. task.CurrentId
D. None of the above.
REFERENCE
https://msdn.microsoft.com/en-us/library/system.threading.tasks.task%28v=vs.100%29.aspx
https://msdn.microsoft.com/en-us/library/dd537609(v=vs.110).aspx
http://vustudents.ning.com/group/cs411-visual-programming/forum/topics/quiz-4-february-
27-2015-february-27-2015-from-32-to-42-
lectures?commentId=3783342%3AComment%3A4947917&xg_source=activity&groupId=3
783342%3AGroup%3A4194109