70-483 Flashcards

1
Q

Usage of the volatile keyword

A

Can be used to indicate that operations involving a particular variable will not be optimized, and the value will be fetched from the copy in memory, rather than being cached in the processor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the Parallel.Invoke method do?

A

Accepts a number of Action delegates and creates a Task for each of them. The method can start a large number of tasks at once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When does the Parllel.Invoke returns?

A

When all of the tasks have completed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Do we have control over the order in which tasks are started when using Parallel.Invoke method?

A

No, we don’t have control over the order nor the processor assigned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do we use the Parallel.ForEach method?

A

In the first parameter we add a IEnumerable collection to iterate over. The second parameter provides an Action method to perform on each item in the list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s the difference between struct and class?

A
  1. It is not possible to have a parameterless constructor within the structure.
  2. The struct is used to create value types, the class is used to create reference types.
  3. The constructor of a structure must initialize all the data members in the structure.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the signature of a method?

A

The signature defines the type and number of parameters that the method will accept

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the sequence that is performed when a new instance of a class is created?

A
  1. The code that implements the class is loaded into memory, if it is not already present.
  2. Any static members of the class are initialized(if is the first time that the class has been referenced) and the static constructor is called.
  3. The constructor in the class is called.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Overload vs overridden methods

A

Overload means providing a method with the same name but different signatures in any given type and overridden is used when we want that child class can change the behavior of a method from a parent class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Boxing vs unboxing

A

Boxing refers to the process of converting a value type into a reference type and unboxing refers to the process of converting a reference type into a value type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Difference between implicit and explicit conversions

A

TBD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Difference between “is” and “as” operators

A

The is operator determines whether a given object is in a particular class hierarchy or implements a specified interface, whereas the as operator takes a reference and a type, and returns a reference of the given type, or null if the reference cannot be made to refer to the object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why do we would use “as” operator instead of casting the object?

A

When casting an object to a specific type or instance, if the object is not possible to cast it’ll throw an exception, whereas if the as operator fails it returns a null reference and the program keeps running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does a sealed class means?

A

A sealed class means, that this class can not be extended, so it cannot be used as the basis for another class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Abstract classes

A

TBD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Yield keyword

A

TBD

17
Q

Which types does the System.Reflection namespaces contains?

A
  1. Assembly
  2. Method Info
  3. Property Info
  4. Type
18
Q

What allow us to control the iteration process in Parallel.For and Parallel.ForEach?

A

ParallelLoopState parameter added in the lambda expression that executes each iteration

19
Q

What is the return type of Parallel.For and Parallel.ForEach?

A

ParallelLoopResult, and can be used to determine whether or not a parallel loop has successfully completed

20
Q

What are the methods available to end the loop on Parallel.For and Parallel.ForEach with ParallelLoopState?

A
  1. Stop()

2. Break()

21
Q

What are the methods available in PLINQ to in parallellism?

A
  1. AsParallel()
  2. AsSequential()
  3. AsOrdered()
  4. AsUnordered()
  5. ForAll()
22
Q

How do we force parallelism when using PLINQ AsParallel method?

A

using the method:

WithExecutionMode(ParalllelExecutionMode.ForceParallelism)

23
Q

How does the AsOrdered method work in PLINQ?

A

It organizes the output in the same order as the original data, but it doesn’t prevent the parallelization of the query

24
Q

How does the AsSequential method work in PLINQ?

A

All the subsequent operators in the query run sequentially

25
Q

numbers.AsParallel.Select (“query”).AsSequential (). Where (“filter”). OrderBy (“sorting”) .AsParallel.GroupBy (“grouping”)

A

SELECT AsParallel
| | |
v v v
—————————————————-
WHERE AsSecuential
|
v
—————————————————-
ORDER BY
|
v
—————————————————-
GROUP BY AsParallel
| | |
v v v

26
Q

Differences between the three ways of converting values

A
  1. “Parse” will throw an exception if the supplied argument is null or if a string does not contain text that represents a valid value.
  2. “TryParse” will return false if the supplied argument is null or if a string does not contain text that represents a valid value.
  3. “Convert” throws an exception if the supplied string does not contain text that represents a valid value, not throws exception if value is null, instead returns the default value for that type
27
Q

Cryptography vs cryptoanalysis

A

Cryptography is the business of rending a message unreadable to anyone except for the proper recipient of the message, cryptoanalysis is the business of code breaking.

28
Q

Symmetric vs asymmetric encryption

A

Symmetric encryption requires that both the sender and the receiver have the same key to encrypt and decrypt the message, asymmetric encryption does not requires to have the same key, however asymmetric keys requires more computer process and long messages

29
Q

Symmetric encryptions on .NET

A

AES => Advanced Encryption Standard
DES => Data Encryption Standard (Insecure)
RC2 => Insecure
Rijndael => AES was made based on this one
TripleDES => Used by the electronic payment industry, improves the DES standard by encrypting the incoming data three times