70-483 Flashcards
Usage of the volatile keyword
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
What does the Parallel.Invoke method do?
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
When does the Parllel.Invoke returns?
When all of the tasks have completed
Do we have control over the order in which tasks are started when using Parallel.Invoke method?
No, we don’t have control over the order nor the processor assigned.
How do we use the Parallel.ForEach method?
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.
What’s the difference between struct and class?
- It is not possible to have a parameterless constructor within the structure.
- The struct is used to create value types, the class is used to create reference types.
- The constructor of a structure must initialize all the data members in the structure.
What’s the signature of a method?
The signature defines the type and number of parameters that the method will accept
What is the sequence that is performed when a new instance of a class is created?
- The code that implements the class is loaded into memory, if it is not already present.
- 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.
- The constructor in the class is called.
Overload vs overridden methods
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
Boxing vs unboxing
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.
Difference between implicit and explicit conversions
TBD
Difference between “is” and “as” operators
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
Why do we would use “as” operator instead of casting the object?
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.
What does a sealed class means?
A sealed class means, that this class can not be extended, so it cannot be used as the basis for another class.
Abstract classes
TBD
Yield keyword
TBD
Which types does the System.Reflection namespaces contains?
- Assembly
- Method Info
- Property Info
- Type
What allow us to control the iteration process in Parallel.For and Parallel.ForEach?
ParallelLoopState parameter added in the lambda expression that executes each iteration
What is the return type of Parallel.For and Parallel.ForEach?
ParallelLoopResult, and can be used to determine whether or not a parallel loop has successfully completed
What are the methods available to end the loop on Parallel.For and Parallel.ForEach with ParallelLoopState?
- Stop()
2. Break()
What are the methods available in PLINQ to in parallellism?
- AsParallel()
- AsSequential()
- AsOrdered()
- AsUnordered()
- ForAll()
How do we force parallelism when using PLINQ AsParallel method?
using the method:
WithExecutionMode(ParalllelExecutionMode.ForceParallelism)
How does the AsOrdered method work in PLINQ?
It organizes the output in the same order as the original data, but it doesn’t prevent the parallelization of the query
How does the AsSequential method work in PLINQ?
All the subsequent operators in the query run sequentially
numbers.AsParallel.Select (“query”).AsSequential (). Where (“filter”). OrderBy (“sorting”) .AsParallel.GroupBy (“grouping”)
SELECT AsParallel
| | |
v v v
—————————————————-
WHERE AsSecuential
|
v
—————————————————-
ORDER BY
|
v
—————————————————-
GROUP BY AsParallel
| | |
v v v
Differences between the three ways of converting values
- “Parse” will throw an exception if the supplied argument is null or if a string does not contain text that represents a valid value.
- “TryParse” will return false if the supplied argument is null or if a string does not contain text that represents a valid value.
- “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
Cryptography vs cryptoanalysis
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.
Symmetric vs asymmetric encryption
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
Symmetric encryptions on .NET
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