What is
the difference between ref & out parameters?
An
argument passed to a ref parameter must first be initialized. Compare this to
an out parameter, whose argument does not have to be explicitly initialized
before being passed to an out parameter
What is a multi cast delegates?
Each delegate object holds reference to a single method. However,
it is possible for a delegate object to hold references of and invoke multiple
methods. Such delegate objects are called multicast delegates or combinable
delegates.
Can you override private virtual methods?
No. Private methods are not accessible outside the class.
What are the different types of literals in C#?
- Boolean literals : True and False are literals of the Boolean type that map to the true and false state, respectively.
- Integer literals : Used to write values of types Int, ulnt, long, and ulong.
- Real literals : Used to write values of types float, double, and dedmal.
- Character literals : Represents a single character and usually consists of a character in quotes, such as 'a'.
- String literals : C# supports two types of string literals, regular string literal and verbatim string literals. A regular string literal consists of zero or more characters enclosed in double quotes, such as "116110". A verbatim string literal consists of an @ character followed by a double–quote character, such as ©"hello".
The Null literal : Represents the null–type.
Can you have parameters for static constructors?
No, static constructors cannot have parameters
Can a class have static constructor?
Yes, a class can have static constructor. Static
constructors are called automatically, immediately before any static fields are
accessed, and are generally used to initialize static class members. It is
called automatically before the first instance is created or any static members
are referenced. Static constructors are called before instance constructors. An
example is shown below.
What is the difference between Shadowing and
Overriding
- Overriding redefines only the implementation while shadowing redefines the whole element.
In overriding derived classes can refer the parent class
element by using "ME" keyword, but in shadowing you can access it by
"MYBASE".
What is the difference between compile time
polymorphism and run time polymorphism?
Compile time Polymorphism
- Compile time Polymorphism also known as method overloading.
- Method overloading means having two or more methods with the same name but with different signatures.
Run time Polymorphism
- Run time Polymorphism also known as method overriding.
Method overriding means having two or more methods with the
same name , same signature but with different implementation.
What are sealed classes in c#?
- The sealed modifier is used to prevent derivation from a class.
·
A compile time error occurs if a
sealed class is specified as the base class of another class.
What is
the use of using statement in C#?
The using
statement is used to obtain a resource, execute a statement, and then dispose
of that resource.
What is
serialization?
Serialization
is the process of converting an object into a stream of bytes.
De-serialization is the opposite process of creating an object from a stream of bytes.
Serialization / De-serialization is mostly used to transport objects.
De-serialization is the opposite process of creating an object from a stream of bytes.
Serialization / De-serialization is mostly used to transport objects.
What are
the difference between Structure and Class?
- Structures are value type and Classes are reference type
- Structures can not have contractors or destructors.
- Classes can have both contractors and destructors.
·
Structures do not support Inheritance,
while Classes support Inheritance.
What is
difference between Class And Interface?
Class : is logical representation of object. It is
collection of data and related sub procedures with defination.Interface : is also a class containg methods which is not having any definations.Class does not support multiple inheritance. But interface can support
What is Delegates?
Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it
What is Authentication and
Authorization?.
Authentication is the process of identifying
users. Authentication is identifying/validating the user against the credentials
(username and password).
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user
Can “this” be used within a static method?
No
‘This’ cannot be used in a static method. As only static variables/methods
can be used in a static method.
What are
the different types of Caching?
There are three types of Caching :
- Output Caching: stores the responses from an asp.net page.
- Fragment Caching: Only caches/stores the portion of page (User Control)
- Data Caching: is Programmatic way to Cache objects for performance.
·
What is
the difference between Custom Control and User Control?
Custom
Controls are compiled code (Dlls), easier to
use, difficult to create, and can be placed in toolbox. Drag and Drop controls.
Attributes can be set visually at design time. Can be used by Multiple
Applications (If Shared Dlls), Even if Private can copy to bin directory of web
application add reference and use. Normally designed to provide common
functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files
User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files
What is literals and their types?
Literals are value constants assigned to variables in a
program. C# supports several types of literals are
- Integer literals
- Real literals
- Boolean literals
- Single character literals
- String literals
- Backslash character literals
No comments:
Post a Comment