Deck 23: Asynchronous Programming With Async and Await

ملء الشاشة (f)
exit full mode
سؤال
The async modifier indicates that a method or ________ expression contains at least one await expression.

A)attribute
B)lambda
C)property
D)iterator
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The _________ delegate represents any method that takes no arguments and returns a result.

A)Func
B)async
C)task
D)TResult
سؤال
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
سؤال
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
سؤال
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
سؤال
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
سؤال
Class Task is part of .NET'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 where TResult represents the type of value returned by the method being executed.

A)callback
B)Func delegate
C)Task
D)thread
سؤال
Visual Basic 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
سؤال
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
سؤال
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
سؤال
________ 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
سؤال
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
سؤال
Visual Basic 2012 introduces the async ________ and await _________ to 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
سؤال
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 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
سؤال
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
سؤال
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
سؤال
Task property ________ returns the value returned by a Task.

A)Result
B)Value
C)TaskReturn
D)TaskValue
سؤال
In .NET 4.5,many classes for web access,file processing,networking,image processing and more have been updated with new methods that return ________ objects for use with async and await,so you can take advantage of this new asynchronous programming model.

A)threads
B)Task
C)Transient
D)Token
سؤال
Today's ________ computers,smartphones and tablets enable computers to perform tasks truly concurrently.

A)large memory
B)multiscreen
C)soft keyboard
D)multicore
سؤال
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 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
سؤال
Class WebClient's ________ method starts a new Task 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)DownloadStringTaskAsync
سؤال
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.
سؤال
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
سؤال
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
سؤال
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
سؤال
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
سؤال
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
سؤال
WebClient's ________ method terminates its executing asynchronous task.

A)TerminateAsync
B)CancelAsync
C)DeleteAsync
D)RemoveAsync
سؤال
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
سؤال
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 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
سؤال
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 ListBox's ________ property indicates the source of the data that populates the ListBox's Items collection.

A)DataSource
B)DataOrigin
C)DataCreator
D)DataIssuer
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/35
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 23: Asynchronous Programming With Async and Await
1
The async modifier indicates that a method or ________ expression contains at least one await expression.

A)attribute
B)lambda
C)property
D)iterator
B
2
The _________ delegate represents any method that takes no arguments and returns a result.

A)Func
B)async
C)task
D)TResult
A
3
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
D
4
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
5
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
6
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
7
Class Task is part of .NET'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 where TResult represents the type of value returned by the method being executed.

A)callback
B)Func delegate
C)Task
D)thread
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
8
Visual Basic 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
9
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
10
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
11
________ 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
12
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
13
Visual Basic 2012 introduces the async ________ and await _________ to 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
14
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
15
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
16
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
18
Task property ________ returns the value returned by a Task.

A)Result
B)Value
C)TaskReturn
D)TaskValue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
19
In .NET 4.5,many classes for web access,file processing,networking,image processing and more have been updated with new methods that return ________ objects for use with async and await,so you can take advantage of this new asynchronous programming model.

A)threads
B)Task
C)Transient
D)Token
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
20
Today's ________ computers,smartphones and tablets enable computers to perform tasks truly concurrently.

A)large memory
B)multiscreen
C)soft keyboard
D)multicore
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
21
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
22
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
23
Class WebClient's ________ method starts a new Task 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)DownloadStringTaskAsync
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
24
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
25
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
26
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
27
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
28
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
29
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
30
WebClient's ________ method terminates its executing asynchronous task.

A)TerminateAsync
B)CancelAsync
C)DeleteAsync
D)RemoveAsync
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
31
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
32
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
33
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
34
You can wait for multiple Tasks to complete by awaiting the result of Task static method ________.

A)whenAny
B)WhenAll
C)when
D)whenTask
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
35
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.