Deck 23: Asynchronous Programming With Async and Await
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/37
العب
ملء الشاشة (f)
Deck 23: Asynchronous Programming With Async and Await
1
________ programming is a technique for writing apps containing tasks that can execute asynchronously,which can improve app performance and GUI responsiveness in apps with long-running or compute-intensive tasks.
A) synchronous
B) object-oriented
C) task-oriented
D) Asynchronous
A) synchronous
B) object-oriented
C) task-oriented
D) Asynchronous
D
Asynchronous programming
Asynchronous programming
2
Class Task is part ofNET's Task Parallel Library (TPL)for asynchronous programming.Task static method Run receives a ________ as an argument and executes a method in a separate thread.The method returns a Task< TResult > where TResult represents the type of value returned by the method being executed.
A) callback
B) Func< TResult > delegate
C) Task
D) thread
A) callback
B) Func< TResult > delegate
C) Task
D) thread
B
Func< TResult > delegate
Func< TResult > delegate
3
The _________ delegate represents any method that takes no arguments and returns a result.
A) Func< TResult >
B) async
C) task
D) TResult
A) Func< TResult >
B) async
C) task
D) TResult
A
Func< TResult >.
Func< TResult >.
4
When an async method encounters an await expression: If the asynchronous task has already completed,________.
A) the async method simply continues executing
B) the async method splits off another thread
C) the await method is called
D) the async method terminates
A) the async method simply continues executing
B) the async method splits off another thread
C) the await method is called
D) the async method terminates
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
5
The async ________ and await _________ greatly simplify asynchronous programming,reduce errors and enable your apps to take advantage of the processing power in today's multicore computers,smartphones and tablets.
A) modifier, operator
B) modifier, modifier
C) operator, operator
D) operator, modifier
A) modifier, operator
B) modifier, modifier
C) operator, operator
D) operator, modifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
6
The async modifier indicates that a method or ________ expression contains at least one await expression.
A) attribute
B) lambda
C) property
D) iterator
A) attribute
B) lambda
C) property
D) iterator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
7
The async and await mechanism does not create new threads.The method that you call to start an asynchronous task on which you ________ the results is responsible for creating any threads that are used to perform the asynchronous task.
A) await
B) process
C) discard
D) save
A) await
B) process
C) discard
D) save
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
8
If a long-running calculation were to be performed synchronously in a GUI app,________.
A) the GUI app would split off the long-running calculation into a separate thread.
B) the GUI would freeze until the calculation completed and the user would not be able to interact with the app
C) the app would terminate
D) the app would deadlock
A) the GUI app would split off the long-running calculation into a separate thread.
B) the GUI would freeze until the calculation completed and the user would not be able to interact with the app
C) the app would terminate
D) the app would deadlock
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
9
Today's ________ computers,smartphones and tablets enable computers to perform tasks truly concurrently.
a) large memory
b) multiscreen
c) soft keyboard
d) multicore
a) large memory
b) multiscreen
c) soft keyboard
d) multicore
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
10
Many classes for web access,file processing,networking,image processing and more contain methods that return ________ objects for use with async and await,so you can take advantage of the asynchronous programming model.
A) threads
B) Task
C) Transient
D) Token
A) threads
B) Task
C) Transient
D) Token
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
11
A method is declared async to indicate to the compiler that the method will ________.
A) wait for a callback
B) perform a synchronous activity
C) create multiple threads
D) await an asynchronous task
A) wait for a callback
B) perform a synchronous activity
C) create multiple threads
D) await an asynchronous task
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
12
When you await a Task,if that Task has already completed,execution simply continues.Otherwise,control returns to ________ until the result of the Task is available.Once the Task completes,the async method continues execution.
A) the async method
B) the await clause
C) the async method's caller
D) the await method's caller
A) the async method
B) the await clause
C) the async method's caller
D) the await method's caller
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
13
Only computers that have ________ can truly execute multiple asynchronous tasks concurrently.
A) a processor
B) multiple processors or cores
C) very large memories
D) two of each type of I/O device
A) a processor
B) multiple processors or cores
C) very large memories
D) two of each type of I/O device
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
14
Visual C# apps can have multiple threads of execution,where each thread has its own ________ stack,allowing it to execute concurrently with other threads while sharing with them application-wide resources such as memory and processors.This capability is called multithreading.
A) method-call
B) attribute
C) memory
D) application
A) method-call
B) attribute
C) memory
D) application
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
15
A Task promises to ________.
A) behave itself
B) run to completion
C) create multiple threads
D) return a result at some point in the future
A) behave itself
B) run to completion
C) create multiple threads
D) return a result at some point in the future
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
16
An async method executes its body in ________.
A) the calling method
B) the called method
C) the main method
D) the same thread as the calling method
A) the calling method
B) the called method
C) the main method
D) the same thread as the calling method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
17
The mechanisms for determining whether to return control to the async method's caller or continue executing the async method,and for continuing the async method's execution when the asynchronous task completes are handled by ________.
A) a .NET library routine
B) a user-defined method
C) a custom interface
D) code that's written for you by the compiler
A) a .NET library routine
B) a user-defined method
C) a custom interface
D) code that's written for you by the compiler
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
18
Tasks that proceed independently of one another are said to execute ________ and are referred to as ________ tasks.
A) synchronously, synchronous
B) independently, independent
C) asynchronously, asynchronous
D) intensively, intensive
A) synchronously, synchronous
B) independently, independent
C) asynchronously, asynchronous
D) intensively, intensive
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
19
Task property ________ returns the value returned by a Task.
A) Result
B) Value
C) TaskReturn
D) TaskValue
A) Result
B) Value
C) TaskReturn
D) TaskValue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
20
In effect,an async method allows you to write code that looks like it executes ________,while the compiler deals with the complicated issues of managing asynchronous execution.
A) efficiently
B) outside any method
C) sequentially
D) repeatedly
A) efficiently
B) outside any method
C) sequentially
D) repeatedly
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
21
Handling short computations in the GUI thread ________.
A) does not cause the GUI to become unresponsive
B) makes the GUI appear choppy.
C) indefinitely potpnes the GUI.
D) deadlocks the GUI.
A) does not cause the GUI to become unresponsive
B) makes the GUI appear choppy.
C) indefinitely potpnes the GUI.
D) deadlocks the GUI.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
22
An async method can perform other statements between those that launch an asynchronous Task and await the Task's results.In such as case,the method continues executing those statements after launching the asynchronous Task until it reaches ________.
A) the await expression
B) the return statement
C) the Task return
D) the async return
A) the await expression
B) the return statement
C) the Task return
D) the async return
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
23
A ListBox's ________ property indicates which property of each item in the data source should be displayed in the ListBox.
A) ShowProperty
B) SelectProperty
C) DisplaySourceItem
D) DisplayMember
A) ShowProperty
B) SelectProperty
C) DisplaySourceItem
D) DisplayMember
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
24
A MethodInvoker (namespace System.Windows.Forms)is a ________.
A) a single-argument constructor
B) Delegate that invokes a method with no arguments and a void return type
C) an interface that must be implemented
D) an indirect proxy caller
A) a single-argument constructor
B) Delegate that invokes a method with no arguments and a void return type
C) an interface that must be implemented
D) an indirect proxy caller
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
25
Because ________,asynchronous Tasks are frequently used in GUI apps that invoke web services (or perform network communication in general)to ensure that the apps remain responsive.
A) there can be unpredictably long delays while awaiting a web-service response
B) synchronous tasks don't work well in GUI apps
C) web services are not designed to work with synchronous Tasks
D) memory is limited in GUI-based web services
A) there can be unpredictably long delays while awaiting a web-service response
B) synchronous tasks don't work well in GUI apps
C) web services are not designed to work with synchronous Tasks
D) memory is limited in GUI-based web services
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
26
Executing asynchronous methods in separate threads on a dual-core computer typically ________ executing the same tasks sequentially.
A) takes more time than
B) takes about the same amount of time as
C) takes less time than
D) takes an unpredictable amount of time compared to
A) takes more time than
B) takes about the same amount of time as
C) takes less time than
D) takes an unpredictable amount of time compared to
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
27
Task static method ________ enables you to wait for any one of several Tasks specified as arguments to complete-the method returns the Task that completes first.
A) FirstToComplete
B) AnyMethod
C) OneOfSeveral
D) WhenAny
A) FirstToComplete
B) AnyMethod
C) OneOfSeveral
D) WhenAny
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following statements is false
A) ProgressBar property Minimum gets or sets a ProgressBar's minimum value.
B) ProgressBar property Maximum gets or sets a ProgressBar's maximum value.
C) ProgressBar property Value gets or sets a ProgressBar's current value. As this number increases, a ProgressBar fills with color.
D) None of the above is false.
A) ProgressBar property Minimum gets or sets a ProgressBar's minimum value.
B) ProgressBar property Maximum gets or sets a ProgressBar's maximum value.
C) ProgressBar property Value gets or sets a ProgressBar's current value. As this number increases, a ProgressBar fills with color.
D) None of the above is false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
29
You can wait for multiple Tasks to complete by awaiting the result of Task static method ________.
A) whenAny
B) WhenAll
C) when
D) whenTask
A) whenAny
B) WhenAll
C) when
D) whenTask
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
30
You cannot bind a LINQ query's result directly to a ListBox.You must first ________.
A) bind the result to a ListItem
B) clear the ListBox
C) convert the results to a List with method ToList
D) cast the result to a ListBoxItem
A) bind the result to a ListItem
B) clear the ListBox
C) convert the results to a List with method ToList
D) cast the result to a ListBoxItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
31
A ListBox's ________ property indicates the source of the data that populates the ListBox's Items collection.
A) DataSource
B) DataOrigin
C) DataCreator
D) DataIssuer
A) DataSource
B) DataOrigin
C) DataCreator
D) DataIssuer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
32
An app that performs synchronous tasks on a single-core computer often takes longer to execute than on a multi-core computer,because ________.
A) it's too costly to convert them to asynchronous tasks
B) the processor is shared between the app and all the others that happen to be executing on the computer at the same time
C) multi-core computers have no overhead
D) single-core compters generally have slower processors
A) it's too costly to convert them to asynchronous tasks
B) the processor is shared between the app and all the others that happen to be executing on the computer at the same time
C) multi-core computers have no overhead
D) single-core compters generally have slower processors
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
33
WebClient's ________ method terminates its executing asynchronous task.
A) TerminatePendingRequests
B) CancelPendingRequests
C) DeletePendingRequests
D) RemovePendingRequests
A) TerminatePendingRequests
B) CancelPendingRequests
C) DeletePendingRequests
D) RemovePendingRequests
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
34
Executing calculations in multiple threads on a single-core processor can actually take ________ compared to simply performing them synchronously,due to the overhead of sharing one processor among the app's threads,all the other apps executing on the computer at the same time and the chores the operating system was performing.
A) less time
B) more time
C) about the same amount of time
D) much less time
A) less time
B) more time
C) about the same amount of time
D) much less time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
35
Class HttpClient's ________ method starts a new Task< string > in a separate thread and uses the URL specified as the method's string argument to request information from a web server.
A) RequestWebStringAsync
B) QueryWebStringAsync
C) StartTaskStringAsync
D) GetStringAsync
A) RequestWebStringAsync
B) QueryWebStringAsync
C) StartTaskStringAsync
D) GetStringAsync
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
36
Enumerable static method ________ creates a list of elements containing the first argument's value.The length of the list is specified by the second argument.
A) Enumerate
B) Repeat
C) Generate
D) None of the above.
A) Enumerate
B) Repeat
C) Generate
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
37
When updating a control from a non-GUI thread,you must ________.
A) launch a separate thread to perform the update
B) notify the GUI thread that you'll be updating it in another thread
C) ensure that the update doesn't corrupt the GUI thread's activities.
D) schedule that update to be performed by the GUI thread
A) launch a separate thread to perform the update
B) notify the GUI thread that you'll be updating it in another thread
C) ensure that the update doesn't corrupt the GUI thread's activities.
D) schedule that update to be performed by the GUI thread
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck