R M
Quiz por , criado more than 1 year ago

Quiz sobre Programming in C#: Exam 483, criado por R M em 08-01-2015.

14
1
0
R M
Criado por R M quase 10 anos atrás
Fechar

Programming in C#: Exam 483

Questão 1 de 13

1

What is the mechanism of ensuring that two threads don't execute portions of a program at the same time?

Selecione uma das seguintes:

  • Synchronization

  • Alignment

  • Hazard-Checking

  • Paralellization

Explicação

Questão 2 de 13

1

Can you pass an integer to a thread as a parameter?

Selecione uma das seguintes:

  • Yes, but only as an Object. It must be cast inside the thread.

  • Yes.

  • No.

  • No, unless it is a foreground thread.

Explicação

Questão 3 de 13

1

What does the [Threadstatic] attribute in a variable entail?

Selecione uma das seguintes:

  • Each copy of a spawned thread has its own copy of a field.

  • Each copy of a spawned thread can manipulate the field.

  • The field can only be modified by one thread at a time.

  • The field can be modified by the main thread, or any spawned foreground threads.

Explicação

Questão 4 de 13

1

How would you add a sequence to a Task?

Selecione uma das seguintes:

  • .ContinueWith((FirstTask){
    //Func
    })

  • .NextTask((FirstTask){
    //Func
    })

  • .Continue((FirstTask){
    //Func
    })

  • .Then((FirstTask{
    //Func
    })

Explicação

Questão 5 de 13

1

Which are acceptable overloads of the .ContinueWith function?

Selecione uma ou mais das seguintes:

  • TaskContinueationOptions.OnlyCancelled

  • TaskContinueationOptions.OnlyOnFaulted

  • TaskContinueationOptions.OnlyRanToCompletion

  • TaskContinueationOptions.OnlyBlocked

  • TaskContinueationOptions.OnlyStopped

  • TaskContinueationOptions.OnlyCompleted

  • TaskContinueationOptions.OnlyOnCompletion

Explicação

Questão 6 de 13

1

What does a task object do?

Selecione uma das seguintes:

  • Spawn a new thread.

  • Spawn a new process.

  • Nothing, it's syntactic sugar

  • Provides a method of managing thread resources.

Explicação

Questão 7 de 13

1

What principles should you keep in mind while creating an asynchronous method?

Selecione uma ou mais das seguintes:

  • Always use await statements.

  • Avoid returning void.

  • Be sure to test to ensure a performance increase.

  • Return a Task or Task<T>

Explicação

Questão 8 de 13

1

ConcurrentStacks allow enumeration

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 9 de 13

1

You havve a lot of items that need to be processed. For each item, you need to perform complex arithmetic that takes up moderate CPU time. Which technique should you use?

Selecione uma das seguintes:

  • Create a Task for each item, and wait till all of them are finished

  • Use a Parallel.For to process all items concurrently

  • Use Async/Await to process all items concurrently

  • Add all items to a BlockingCollection and process them on a thread created by the thread class.

Explicação

Questão 10 de 13

1

You are creating a complex query that doesn't require any particular order, and you want to run it as parallel. Which method should you use?

Selecione uma das seguintes:

  • AsParallel

  • AsSequential

  • AsOrdered

  • WithDegreeOfParallelism

Explicação

Questão 11 de 13

1

In an ASP.NET project, your application retrieves data from a remote server and writes the response to a database. Should you use the Async/Await keywords for processing?

Selecione uma das seguintes:

  • Yes, this will free your thread to serve other requests while waiting for a naturally occurring I/O bottleneck.

  • No, both operations depend on external factors. You must wait before they are finished.

  • No, in a server application you don't have to use async/await, as the keywords are primarily used in client applications.

  • Yes, this puts your thread to sleep while waiting for I/O so it uses no CPU time.

Explicação

Questão 12 de 13

1

What does the volatile keyword do?

Selecione uma das seguintes:

  • Ensures that individual copies of a variable are stored in memory

  • Disables compiler optimizations that assume a single-threaded application

  • Ensures a variable is never added to a swap file on a disk

  • Informs the compiler that the variable will be heavily accessed

Explicação

Questão 13 de 13

1

Is var++ an atomic operation?

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação