Term
C# uses two type of concepts? |
|
Definition
Simple statements exampe string text ;
complex statement exampl statement.({static} ;
note some complex statement don't end with ;
such as if()
{
} |
|
|
Term
What is a placeholders in c sharp? |
|
Definition
example of a placeholders is textbox.text({});
the {} is your placeholders |
|
|
Term
name Conditional Instructions in C Sharp? |
|
Definition
- Relational operators
- Boolean expressions
- Logical operators
- A conditional operator
|
|
|
Term
|
Definition
A variable is a named location in memory that enables you to store a value for later use. |
|
|
Term
What is a Constant variable? |
|
Definition
A constant is like variable at will. It accepts a value when you declare it and keeps that value throughout the life of your program's execution time. |
|
|
Term
Constructors: Constructors are special class methods that are executed when a new instance of a class is created.
Constructors: are used to initialize the data members of the object
Constructors: Must have exactly the same name as the class and they do not have a return type.
Multiple constructors: , each with a unique signature can be defined for a class. |
|
Definition
Class Rectangle
{
private double length;
private double width;
public Rectangle( double 1, double w )
{
length = 1;
width = w;
}
} |
|
|
Term
Properties: are class members that can be accessed like data files but contain code like a method.
A property has two accessors get and set. |
|
Definition
class Rectangle
{
private double length;
public double Length
{
get
{
return length;
}
set
{
if ( value > 0.0)
length = value;
}
}
} |
|
|
Term
this keyword is a reference to the current instance of the class.
you can use the this keyword to refer to any member of the current object. |
|
Definition
class Rectangle
{
private double length;
private double width ;
public Rectangle(double 1, double w)
{
this.lenght = 1;
this.width = w;
}
} |
|
|
Term
Delegates: are special objects that can hold a reference to a method with a specific signature. |
|
Definition
example:
public delegate void RectangleHandler(Rectangle rect);
* reference can be changed at runtime
* Delegates are especially used for implementing events and call-back methods
* all delegates are implicitly derived from the System. Delegate class
delegates have the following properties:
-
Delegates are like C++ function pointers but are type safe.
-
Delegates allow methods to be passed as parameters.
-
Delegates can be used to define callback methods.
-
Delegates can be chained together; for example, multiple methods can be called on a single event.
|
|
|
Term
How do you Instantiating Delegates? |
|
Definition
once declared a delegate object must be created with the keyword new and be associated with particular method. |
|
|
Term
|
Definition
Properties specify the data represented by an object
- Properties are class members that can be accessed like data fields but contain code like a method.
- A property has two accessors get and set. The get accessor is used to return the property value, and the set accessor is used to assign a new value to the property.
|
|
|
Term
|
Definition
Methods: Specify an object's behavior
- a block of code containing a series of statements.
- method define by specifying the access level , the return type , the name of the method and an optional list of parameters in parentheses followed by a block of code enclosed in braces.
|
|
|
Term
|
Definition
Events: provide communication between objects |
|
|
Term
|
Definition
Class define a blueprint for an object
Class define how the objects should be built / behave
an object is also know as an instance of a class. |
|
|
Term
|
Definition
- Static keyword is used to declare members that do not belong to individual object but to a class itself.
- Static member cannot be reference through an instance object instead , a static member is referenced through the class name.
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the newkeyword to create a variable of the class type. |
|
|
Term
Define Encapsulation?
Encapsulation is a mechanism to restrict access to a class or class members in order to hide design decisions that are likely to change.
Access modifiers control where a type or type member can be used. |
|
Definition
|
|
Term
|
Definition
- Inheritance is an OOP feature that allows you to develop a class one , and then reuse that code over and over as the basis of new classes.
- Class whose functionality is inherited is called a base class.
- Class that inherits the functionality is called a derived class
- A derived class can also define additional features that make it different from the base class.
- Unlike classes , the structs do not support inheritance.
|
|
|
Term
|
Definition
- Abstract classes provide a common definition of a base class that can be shared by multiple derived classes.
- Abstract class often provides incomplete implementation.
- Instantiate an abstract class you must inherit from it and complete its implementation.
|
|
|
Term
|
Definition
- Sealed classes provide complete functionality but cannot be used as base classes.
- Use the sealed keyword when your implementation is complete and you do not want a class or its member to be inherited.
|
|
|
Term
|
Definition
- In C# you can cast an object to any of its base types.
- Assigning a derived class object to a base class object doesn't require any special syntax: example object o = new Rectangle(10,20);
- Assigning a base class object to a derived class object must be explicitly cast: example Rectangle r = (Rectangle) o;
|
|
|
Term
Why use Delegates instead of Interfaces? |
|
Definition
* An eventing design pattern is used.
* it is desirable to encapsulate a static method.
* The caller has no need to access other properties, methods, or interfaces on the object implementing method.
* Easy composition is desired.
* A class may need more than one implementation of the method. |
|
|
Term
|
Definition
- Polymorphism is the ability of derived classes to share common functionality with base classes but still define their own unique behavior.
- Polymorphism allows the object of a derived class to be treated at runtime as objects of the base class.
|
|
|
Term
Both delegates and interfaces enable a class designer to separate type declarations and implementation. A given interface can be inherited and implemented by any class or struct. A delegate can be created for a method on any class, as long as the method fits the method signature for the delegate. An interface reference or a delegate can be used by an object that has no knowledge of the class that implements the interface or delegate method. Given these similarities, when should a class designer use a delegate and when should it use an interface? |
|
Definition
Use a delegate in the following circumstances:
-
An eventing design pattern is used.
-
It is desirable to encapsulate a static method.
-
The caller has no need to access other properties, methods, or interfaces on the object implementing the method.
-
Easy composition is desired.
-
A class may need more than one implementation of the method
Use an interface ini the following circumstances:
-
There is a group of related methods that may be called.
-
A class only needs one implementation of the method.
-
The class using the interface will want to cast that interface to other interface or class types.
-
The method being implemented is linked to the type or identity of the class: for example, comparison methods.
|
|
|
Term
|
Definition
- Interfaces are used to establish contracts through which object can interact with each other without knowing the implementation details.
- Interface definition cannot consist of any data fields or any implementation details such as method bodies.
- A common interface defined in the System namespace is the IComparable namespace.
- Each class that implements IComparable is free to provide its own custom comparison logic inside the CompareTo method.
Interfaces are used to build loosely-coupled applications.
- Interface members are public by default
- The interface doesn't allow explicit access modifiers
- The interface cannot contain fields
- if a class or struct inherits from an interface it has to provide an implementation for all interfaces members otherwise you get a compiler error.
|
|
|
Term
|
Definition
Namespace is a language element that allows you to organise code and create globally unique class names.
- .NET Framework uses namespaces to organise all its classes.
|
|
|
Term
|
Definition
Boxing is the process of converting a value type to the reference type.
int i = 10;
object o =i ; // boxing |
|
|
Term
|
Definition
Unboxing is the process of converting an object type to a value type.
object o = 10;
int i = (int)o; // unboxing |
|
|
Term
|
Definition
- Array is a collection of items of the same type
- items in an array are stored in contiguous memory locations.
- Capacity of an array is predefined and fixed.
- C# array indexes are zero-based
|
|
|
Term
|
Definition
Enqueue: Adds an item to the tail end of the queue. |
|
|
Term
|
Definition
Dequeue removes the current element at the head of the queue. |
|
|
Term
|
Definition
Peek Access the current item at the head postion without actually removing it from the queue. |
|
|
Term
|
Definition
Contains Determines wheather a particular item exists in the queue. |
|
|
Term
|
Definition
Stacks:
- A Collection of items in which last item added to the collection is the first one to be removed.
- Stack is a heterogeneous data structure.
|
|
|
Term
|
Definition
- Generics feature helps you define classes that can be customized for different data types.
- Generics provide many benefits including reusability , type - safety and performance.
- Most common use of generics is to create collection classes.
|
|
|
Term
|
Definition
A delegate is special type that can hold a reference to a method. |
|
|
Term
|
Definition
Events: are a way for object to notify other objects when something of interest happens.
- Object that sends the notification is called as publisher of the event
- Object that receives the notification is called the subscriber of the event.
|
|
|
Term
|
Definition
- An exception is an error condition that occurs during the execution of a program.
- unless you "catch" the exception by writing proper exception handling code , the program execution will terminate.
|
|
|
Term
Basic Application Setting ? |
|
Definition
- Application settings store custom application specific data
- Application setting allows you to change certain program settings at runtime with out the need to modify the program's source code.
- Setting data is stored as XML in a disk file.
- For Web application you store the application setting in web.config file.
- For Windows-based application , the application setting are specified in an app.config file.
|
|
|
Term
Console class Methods for reading data from and writing data to the console windows. |
|
Definition
Method Name :
- Read [ read the next character from input stream as integer.]
- ReadKey [ Reads the next character or function key pressed by the user as ConsoleKeyInfo. ]
- ReadLine [ Reads the next line of characters from the input stream as a string ]
- Write [ Writes text to the output stream ]
- WriteLine [ Writes text to the output stream, followed by the line terminator character. ]
|
|
|
Term
|
Definition
using system.IO;
StreamReader and StreamWriter classes
BinaryReader and BinaryWriter |
|
|
Term
|
Definition
Classes to work with XML data are organised in using system.XML ;
Above classes provide a fast , non-cached , and forward only way to read or write XML data. |
|
|
Term
|
Definition
XML schema describes the structure of an XML document.
- XML schema is particularly important when an XML file is used to shared data between two applications.
|
|
|
Term
|
Definition
Four main types
- SELECT
- INSERT
- UPDATE
- DELETE
|
|
|
Term
|
Definition
DataAdapter acts as a bridge between the data source and the DataSet.
- DataAdapter stores the data connection and data commands needed to connect to the data source.
- DataAdapter also provides commands for retrieving data from the data source and commands for updating data source with any changes.
|
|
|
Term
|
Definition
- DataSet is an in-memory representation of relational data.
- DataSet can have tables , relations and data-integrity
- such as unique constraints or foreign-key.
|
|
|
Term
what do we mean by Iteration? |
|
Definition
Iteration is the act of repeating a process with the aim of approaching a desired goal, target or result. Each repetition of the process is also called an "iteration", and the results of one iteration are used as the starting point for the next iteration. |
|
|
Term
|
Definition
Array is a collection of objects , all of the same type , example string , integer , double , float etc...
Array in C# are zero -based which means index of the first array is alway Zero. |
|
|
Term
what are the bracket call within Array example int[] ? |
|
Definition
these bracket call refer as 'index operator' [] |
|
|
Term
|
Definition
var. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type |
|
|
Term
|
Definition
events are declared and raised in class and associated with the event handlers using delegate , the class containing the event is used to publish the event is call publisher class
A subscriber is an object that accepts the event and provides an event handler. the delegate in the publisher class invokes the method. |
|
|
Term
What is Concatenation in C# |
|
Definition
Concatenation is joining things together, you can join direct text with variables or join two or more to make a longer string. |
|
|
Term
What does Protected mean? |
|
Definition
protected means that that the method is visible inside the class and for. theirs derivers, nobody else can use it.. override means that it will change the implementation of a previously. defined method with the same name and parameters. void means that it returns nothing.
This is an accessibility keyword. It controls how other types (like derived types) in a C# program can access a class and its members. |
|
|
Term
|
Definition
A function allows you to encapsulate a piece of code and call it from other parts of your code |
|
|
Term
What is NON-Functional () |
|
Definition
non -functional requirement specifies "how well the what must behave"
-
- A constraint is a condition to make the requirements in line with quality expectations
|
|
|
Term
What is integration testing : |
|
Definition
Integration testing is the phase in software testing in which individual software modules are combined and tested as a group. it occurs after unit testing and before validating testing.
[Acceptance testing ]
|
[system testing ]
|
[Integration testing] |
|
|
Term
|
Definition
A base class is the parent class of any derived class.
The base keyword is used to access members of the base class from within a derived class:
A base class access is permitted only in a constructor, an instance method, or an instance property accessor.
example, both the base class, Person , and the derived class, Employee , have a method named Getinfo . By using the base keyword, it is possible to call the Getinfo method on the base class, from within the derived class.
|
|
|
Term
what is virtual and why use it ? |
|
Definition
The keywordvirtual is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. For example, this method can be overridden by any class that inherits it: |
|
|
Term
What does Protected Internal mean ? |
|
Definition
Protected Internal 'access modifier' is a Union of both the protected and internal modifiers
Protected
The type or member can be accessed only by the code in the same class or struct, or in class that is derived from that class.
Internal
The type or member can be accessed by any code in the same assembly, but not another assembly
|
|
|
Term
What does @ before the "" mean in C# |
|
Definition
C# '@' before a String. It means to interpret the string literally (that is, you cannot escape any characters within the string if you use the @ prefix). It enhances readability in cases where it can be used. For example, if you were working with a UNC path, this: @"\\servername\share\folder" is nicer than this: "\\\\servername\\share\\folder". |
|
|
Term
Can you delete an element in array example stirng[] value = new string[5]
say you want to remove 2nd character from this array? |
|
Definition
Single dimension array are immutable meaning you can't delete any of the items of the array, what you can do is copy the array to another array and exclude the element you don't want |
|
|
Term
Can you call a method from Constructor? |
|
Definition
according to MSCD Certification Toolkit Exam 70-483 page 170
you can do this. also refer as 'Creative Constructors
example
public Customer(string email )
{
StoreEmailAddress(email);
}
private void StoreEmailAddress(string email )
{
// code goes here to save the email address.
} |
|
|
Term
C# does not allow Multiple inheritances is this True or False |
|
Definition
Yes its true you can't use Multiple inheritances in C#
that why we have Interface to simulate multiple inheritances |
|
|
Term
What the fuck is Interface Class in C# |
|
Definition
Well, you little nob; An Interface is similar to the class that specifies properties, methods, and events, but it doesn't provide any code to implement them, its form of a contract specifying features that other classes can implement.
if a class implements an interface, it agrees to provide the features defined by the interface.
This provides a kind of polymorphism that is similar to the way classes let a program treat an object as if it were of another class. |
|
|
Term
What letter does the Interface name begin with? |
|
Definition
By convention, interface names begin with a capital letter I as in IStudent , Icomparable , and ICloneable |
|
|
Term
Can class access Interface if it's explicit |
|
Definition
No, if a class implements an interface explicitly, the program cannot access the interfaces' members through a class instance.
instead, it must use an instance of the interface.
example of access interface class explicitly
TeachingAssistant ta = new TeachingAssistant();
Istudent student = ta;
student.PrintGrade();
// how not to access , this causes design time error.
ta.PrintGrade(); |
|
|
Term
|
Definition
The IEquatable interface provides that capability by requiring a class to provide an equals method. |
|
|
Term
|
Definition
A class that implements the ICloneable interface must provide a Clone method that returns a copy of the object for which is called. |
|
|
Term
There is two types of Clones what are they? |
|
Definition
You have Shallow clone and Deep clones
shallow clone = any reference values in the copy refer to the same objects as those in the original object
deep clone = the new object reference values are set to new objects. |
|
|
Term
|
Definition
A class that implements the IEnumerable interface provides a method for a program to enumerate the items that the class contains.
Its GetEnumberator method returns an object that implements IEnumerator. |
|
|
Term
If all programs want to do a loop over a series of objects there's an easier approach. |
|
Definition
the easy approach is as follows:
Give the class a method that returns an object of type IEnumerable<Class> where the class is the class you are working with. have the method find the objects that should be in the enumeration and call yield return to place each in the enumeration.
yield break when it finishes building the enumeration. |
|
|
Term
What is nondeterministic finalization? |
|
Definition
One must first understand the process of calling an object's Finalize method
is referred to as finalization.
This is because you can't tell when the Garbage collector (GC) will call an object's finalize method.
as such we referrer this process as ' non-deterministic finalization. ' |
|
|
Term
How can you help object free their resources: |
|
Definition
two steps can be taken to help object free their resources
1) implementing the IDisposable interface
2) Provide destructors.
|
|
|
Term
|
Definition
A destructor is a method with no return type and a name that includes the class's name prefixed by ~ The Garbage collector executes an object's destructor before permanently destroying it. |
|
|
Term
|
Definition
The constructor is the signature of the class
* you can' return anything from it
* constructor name would always be the same as the class name. |
|
|
Term
|
Definition
Destructors in C# Destructors in C# are methods inside the class used to destroy instances of that class when they are no longer needed. The Destructor is called implicitly by the .NET Framework's Garbage collector and therefore programmer has no control as when to invoke the destructor. |
|
|
Term
|
Definition
GC is = Garbage collector
it may decide the program is running low on memory and decide to start garbage collection
|
|
|
Term
|
Definition
- Destructors can be defined in classes only, not structures.
- A class can have at most one destructor
- Destructors cannot be inherited or overloaded
- Destructor cannot be called directly
- Destructor cannot have modifiers or parameters
|
|
|
Term
Summarise "The resource management rules and concepts" |
|
Definition
- If a class contains no managed resources and no unmanaged resources, it doesn't need to implement IDisposable or have a destructor.
- If the class has only managed resources, it should implement IDisposable but it does not need a destructor.
- If a class has only unmanaged resources it needs to implement IDisposable
- destructor should free only unmanaged resoruces
- The Dispose method should free both managed and unmanaged resources.
|
|
|
Term
|
Definition
If an object has a Dispose method, a program using it should call it when it is done using the object to free its resources.
- To make it easier to ensure that Dispose method is called, C# provides the using statement
- The using statement begins a block of code that is tied to an object that implements IDisposable. When the block ends, the program automatically calls the object's Dispose method for you.
|
|
|
Term
A short summary of Interface and Deleage |
|
Definition
An Interface specifies properties, methods, and events that a class must provide to implement the interface.
A delegate is a bit like interface in the sense that it specifies the characteristics of the method. |
|
|
Term
|
Definition
A delegate is a data type that defines kind of methods
example :
private delegate float function delegate(float x);
Delegate has :
- accessibility: such as public or private
- Delegate: The keyboard Delegate keyword.
- return type: The data type that a method of this delegate type returns such as void int or string
- delegate named
- parameters
|
|
|
Term
What are Covariance and Contravariance? |
|
Definition
Covariance and contravariance give you flexibility when assigning methods to delegate variable basically let you treat the return type and parameters of a delegate polymorphically. |
|
|
Term
|
Definition
Contravariance lets a method take parameters that are fro superclass of the type expected by a delegate.
remember: A variable is called contravariant if it enables contravariance. |
|
|
Term
What is Action Delegates? |
|
Definition
Okay, a generic Action delegate represents a method that returns void.
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2)
Keyword In within generic parameter list indicates that the T1 and T type parameters are indeed contravariant. |
|
|
Term
|
Definition
The generic Func delegate represents a method that returns a value.
in C# does not have plain functions only member functions (aka methods). And methods are not first-class citizens. First-class functions allow us to create beautiful and powerful code as seen in F#
C# ameliorates this somewhat with the usage of delegates and Lamba express.
Func is a build-in delegate that brings some sort of functional programming features and helps reduce code verbosity.
Func can contain 0 to 16 input parameters and must have one return type
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2)
|
|
|
Term
What is Comparable variable? |
|
Definition
Comparable interface. Compares values and returns an int which tells if the values compare less than, equal, or greater than. If your class objects have a natural order, implement the Comparable<T> interface and define this method. |
|
|
Term
What is Anonymous Methods? |
|
Definition
An anonymous method is basically a method that doesn't have a name.
Instead of creating a method as you usually do, you create a delegate that refers to the code that the method should contain. you can then use that delegate as if it were a delegate variable holding a reference to the method.
delegate ([parameters]) { code..... } |
|
|
Term
What is 'Lambda Expressions'? |
|
Definition
Lambda methods provide a shorthand notation.
- A Lambada expression uses a concise syntax to create an anonymous method.
() = expression; |
|
|
Term
|
Definition
- Use can use the keyword async indicate that a method can be run asynchronously.
- await keyword to make a piece of code call an asynchronous method and wait for it to return.
|
|
|
Term
How do you create an event handler for a button ? |
|
Definition
To create an event handler
public void ButtonName(Object sender , EventArgs e)
{
} |
|
|
Term
What is Publisher & Subscriber? |
|
Definition
The object that raises an event is called that event's publisher.
The class that catches an event is called its subscriber.
You can have many subscribers or no subscribers. |
|
|
Term
Explain Try Catch , finally |
|
Definition
try-catch-finally block allows the program to catch unexpected errors and handle them.
you don't have to include any code in the catch or finally section.
try
{
//do something
}
finally
{
}
is valid statement as well as:
try
{
}
catch(execption ex)
{
}
|
|
|
Term
What is 'Unhandled Exception'? |
|
Definition
An unhandled exception occurs when an exception is thrown and the program is not protected by a try-catch-finally block |
|
|
Term
What is an Overflow Exceptions? |
|
Definition
By Default C# will not throw an exception if arithmetic operation causes an integer overflow.
- if the operands are integral or decimal then the program will discard any extra bits and return a truncated result
- C# program also doesn't throw an exception if a floating point operation causes an overflow or underflow, or produce the special value NaN ( which stands for "not a number ")
|
|
|
Term
|
Definition
A numeric code describing the exception |
|
|
Term
What is System.Diagnostics.Debug class |
|
Definition
This class provides an Assert method that is often used to validate data as it passes through a method. takes a boolean value as its first parameter and throws an exception if that value is false. |
|
|
Term
Explain What Events is and Exceptions |
|
Definition
Events enable an object to notify other parts of the application when some interesting event occurs. To define and raise an event, a program must use delegates.
Exceptions: let a method the calling code that it has encountered a critical problem. |
|
|
Term
Name three types of Lambdas expressions? |
|
Definition
1) Lambdas
2) Statement lambdas
3) Asnc lambdas |
|
|
Term
|
Definition
|
|
Term
What is system idle process? |
|
Definition
This thread does nothing except keeps the processor busy when there is no other thread to run.
|
|
|
Term
In dot NET all application have several threads what are they ? |
|
Definition
- Garbage Collector thread: Responsible for the garbage collection.
- Finalizer thread: Responsible to run the Finalize method of your object
- Main thread: Responsible to run your main application's method
- UI thread: If your application is Window Form application, a WPF application, or a Windows store application, it will have a thread dedicated to updating the user interface.
|
|
|
Term
You have three methods as such how can this be improved and why
class Program
{
static void Main(string[] args)
{
Step1();
Step2();
Step3();
Console.ReadKey();
}
static void Step1()
{
Console.WriteLine("Step 2 active");
}
static void Step2()
{
Console.WriteLine("Step 2 active");
}
static void Step3()
{
Console.WriteLine("Step 3 active");
}
} |
|
Definition
we can pass the three methods via Paralle.Invoke this will improve performance as it uses continuations mechanisms that are available in the TPL
Parallel.Invoke(Step1, Step2, Step3); // this usages Continuations mechanisms TPL
Console.ReadKey();
before the code is unpredictable but via Parallel.Invoke we can force the order to be run as it should be |
|
|
Term
|
Definition
- Garbage Collector thread: Responsible for the garbage collection
- Finalizer thread: responsible to run the finalize method of your objects
- Main thread: Responsible to run your main applications' method.
- UI thread: if your application is windows form applications, WPF application or a windows store application, it will have one thread dedicated to updating the user interface.
|
|
|
Term
What is 'atomic operation' |
|
Definition
Atomic operations are ones that cannot be interrupted partway throught asuch as by threading . Take for instance the statement
somevalue++:
If you have two threads executing this code at once with a starting value of 0 , you may have the following
- Thread A reads
_value , 0
- Thread A adds 1, 1
- Thread B reads
_value , 0
- Thread B adds 1, 1
- Thread A assigns to
_value , 1
- Thread B assigns to
_value , 1
so now, even though we've called an increment twice, the final value in _value is 1 , not the expected 2 . This is because increment operators are not atomic.
The function Interlocked.Increment , however, is atomic, so replacing the above code with
Interlocked.Increment(ref _value);
Would solve the given race condition.
|
|
|
Term
In .NET there are two kinds of signalling mechanisms: synchronization events and barries. explain the meaning ? |
|
Definition
1) Synchronization events are objects that can be in one of the two states signalled and non-signalled. example if the thread needs something this can be done via synchronization event and interrogate the state of the event as a communication mechanism. implemented by two classes: EventWaitHandle and CountdownEvent.
2) C# Barrier class is synchronization primitives used in .NET threading Barrier is used in an algorithm which composed of multiple phases |
|
|
Term
What is Monitors in term of C#? |
|
Definition
Monitors are synchronization primitives use to synchronize access to objects. Which is implemented in .NET in the System.Threading.Monitor class |
|
|
Term
Summarise Task Parallel Library? |
|
Definition
In .NET 4 MS introduced the Task Parallel Library, this is represented as an asynchronous unit of work
The task can be created or started via :
- Task.Run
- Task Factory
- .StartNew
- ContinueWith
- WhenAnll
- WhenAny methods
|
|
|
Term
|
Definition
In simple term, it is Operations that are run in a nonblocking fashion.
when one method needs to call another method which potentially can block to avoid this we apply different techniques of the calling method.
demo this and PA code this
|
|
|
Term
What is Asynchronous Pattern Model (APM) |
|
Definition
When using this pattern, a method is split into parts a, Begin and End part.
The begin part is responsible to prepare the call and to return the caller right away.
the end part is the one called to get back the result. The method was run in a thread from the thread pool
|
|
|
Term
what is atomic operation? |
|
Definition
An operation that will be run at once without being interrupted by the scheduler |
|
|
Term
What is Event-based Asynchronous Pattern (EAP) |
|
Definition
This pattern requires a method to be suffixed with Async and provide events and delegates to signal |
|
|
Term
What is a fork-join pattern? |
|
Definition
The process of spawning another thread from the current thread ( fork) to do something else while the current threads continue their work and then to wait for the spawned thread to finish its execution (join) .
PA this and Code example |
|
|
Term
What is the race condition? |
|
Definition
A race condition occurs when two or more threads access shared data, writing at the same time if the access to data is for reading purpose only. |
|
|
Term
|
Definition
component of the operating system that ensures that thread is given access to the CPU in a fair manner, avoiding situations when a thread monopolises the CPU>. |
|
|
Term
What is the Task Parallel Library? |
|
Definition
Task Parallel Library (TPL ), .NET library created by Microsoft that tries to abstract away and simplify the code that deals with threads. |
|
|
Term
What is the Task-based Asynchronous Pattern (TAP)? |
|
Definition
A pattern based on a single method that returns Task or Task<Result> objects that represent the asynchronous work in progress. |
|
|
Term
|
Definition
the thread pool represents a pool of pre-created three that can be used by the task or to queue work items or to run asynchronous IO operations. |
|
|
Term
Explain what is Reflection? |
|
Definition
Reflection refers to the ability to examine code and dynamically read modify or invoke behaviour for an n assembly module or type. |
|
|
Term
|
Definition
A type is any class interface array value type enumeration, parameter, generic type definition and open or closed constructed generic types. |
|
|
Term
In Which design patterns do we use 'Reflection' |
|
Definition
- Factory or Inversion of Control design patterns.
|
|
|
Term
Name Five Type-testing and conversion operators? |
|
Definition
- is operator
- as the operator
- Cast operator ()
- typeof operator
|
|
|
Term
What does GetArrayRank do? |
|
Definition
When the Type object represents an array, the GetArrayRank method returns the number of dimensions in the array. |
|
|
Term
|
Definition
c# the part of the program where the particular variable is accessible is termed as the scope of that variable.
basically, you declare variable and use it in class, loop code etc.. so where it is use is like scope |
|
|
Term
What is the Code Document Object Model? |
|
Definition
CodeDom is a set of classes in the .NET Framework that enables you to create code generators.
A code generator is a program that can write your code for you.
|
|
|
Term
Explain Lambada Expressions c# |
|
Definition
Lambda expression is a shorthand syntax for creating anonymous methods.
the question follows on: What is an anonymous method, well its an anonymous method is essentially a method without a name. |
|
|
Term
|
Definition
- Array
- sets
- collections
- lists
- dictionaries
- queues
You must PA all of them |
|
|
Term
|
Definition
An ArrayList is a class that enables you to dynamically add or remove elements to the array. |
|
|
Term
|
Definition
Hashtable is Data collection
A Hashtable enables you to store a key \ value pair of any type of object. The data is stored according to the hash code of the key can be accessed by the key rather than the index of the element. |
|
|
Term
|
Definition
Data collection type
A queue is a first-in-first-out collection. queues can be useful when you need to store data in a specific order for sequential processing. |
|
|
Term
|
Definition
Data Collection drive from System.Collection class
SortedList is a collection that contains key\value pairs but it is different from a Hashtable because it can be reverence by the key or the index can because it is sorted. |
|
|
Term
What is a stack collection? |
|
Definition
Data collection drive from System.Collection Class
A stack collection is a last-in-first-out collection, similar to a Queue except the last element added is the first element retrieved. |
|
|
Term
What is System? Collections.Generic? |
|
Definition
The System.Collections.Generic namespace contains classes that are used when you know the type of data to be stored in the collection and you want all elements in the collection to be of the same type. |
|
|
Term
Best Practices on using Data Collection? |
|
Definition
Where possible it is best practices to use a collection from the Generic namespace because they provide a type-safety along with performance gains compared to the non-generic collections. |
|
|
Term
What is the command object? |
|
Definition
A command object is used to execute statements against a database
System.data.common.DBCommand |
|
|
Term
What is the ExecuteNonQuery Method? |
|
Definition
The ExecuteNonQuery method is used to execute statements against the database that do not return result sets.
|
|
|
Term
What is the ExecuteReader Method? |
|
Definition
Use the ExecuteREader method to retrieve results from the database such as when you use a Select statement. |
|
|
Term
What is the ExecuteScalar Method? |
|
Definition
The ExecuteScalar method is used when you know that your resultset contains only a single column with a single row. |
|
|
Term
What is ExecuteXMLReader Method? |
|
Definition
The ExecuteXMLReader method returns an XMLReader, which enables you to represent the data as XML. |
|
|
Term
|
Definition
Serialization is the process of transforming an object into a form that can either be persisted to storage or transferred from one application domain to another. |
|
|
Term
|
Definition
Every developer should know String is a reference type and behaves like value type. In .Net Framework Strings are immutable reference types. All .net datatypes has default size except string and user type. So String is a Reference type, because it does not have default allocation size.
Reference Type
Unlike value types, a reference type doesn't store its value directly. Instead, it stores the address where the value is being stored. In other words, a reference type contains a pointer to another memory location that holds the data. |
|
|
Term
Name four Reference Types? |
|
Definition
The following data types are of reference type:
- String
- All arrays, even if their elements are value types
- Class
- Delegates
|
|
|
Term
|
Definition
A reference parameter is a reference to a memory location of a variable. When you pass parameters by reference, unlike value parameters, a new storage location is not created for these parameters. The reference parameters represent the same memory location as the actual parameters that are supplied to the method.
You can declare the reference parameters using the ref keyword.
this approach is safer to code than pass parameters
- Better performance
- minimize copying value types
- By using value types you can minimize the number of allocations and gargage collection passeses. |
|
|
Term
|
Definition
- List is a collection of strong type Objects
- can be accessed by index and having methods for sorting searching and modifying list.
- it a generic version of ArrayList that comes from system. collection.generic name space
|
|
|
Term
What are Anonymous Types or Functions |
|
Definition
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first. The type name is generated by the compiler and is not available at the source code level. The type of each property is inferred by the compiler.
You create anonymous types by using the new operator together with an object initializer. For more information about object initializers, see Object and Collection Initializers. |
|
|
Term
|
Definition
A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type.
... In other words, a method must have the same return type as the delegate. This ability to refer to a method as a parameter makes delegates ideal for defining callback methods
delegates are similar to pointers to functions, in C or C++ |
|
|
Term
|
Definition
yield return statement return's each element one at a time. |
|
|
Term
What are Lambda Expression |
|
Definition
- Lambda expressions are used like anonymous functions.
- => operator is used, which is called Lambada Operator
- Left side of operator is input
- right side of the operator is expression/statement
|
|
|
Term
What is the difference between Expression Lambda and Statement? |
|
Definition
Well the expression Lambda is like this
(input-params) => expression;
// example
Func<int,int,bool> TestMe = (x,y) => x > y;
above return evaluated value implicitly.
However Statement Lambda is like this :
(input-param) => { statements };
example would be like this :
Func<int,int,bool> TestMe = (x,y) =>
{
var sum = x +y;
Console.writeLine(sum);
return x > y ;
}
statement Lambda does not return any value implicitly. |
|
|
Term
What are Predicate delegate in c# |
|
Definition
Predicate is the delegate like Func and Action delegates. It represents a method containing a set of criteria and checks whether the passed parameter meets those criteria. A predicate delegate method must take one input parameter and return a boolean - true or false |
|
|
Term
What is the basic different between Methods and Functions |
|
Definition
- ) Method come with void and as no return type
- ) Functions has a return type
Alwayse use the correct acronym { a - Kruh - nuhm } |
|
|
Term
|
Definition
A complex type is a set of properties that exist in its own object for C#, but are mapped to columns on an already existing table (the one for the entity that contains it), instead of having its own table (which would need a key, etc.).
|
|
|