dotnet interview questions

Dotnet Interview Questions and Answers

Q.What is .Net Framework?

Ans:

  • NET Framework is an important integral component in .NET software.
  • .NetFramework is a runtime environment,which we can use to run .net applications.

Q.What is Visual Studio.Net?

Ans: Visual Studio .NET is a Microsoft-integrated development environment (IDE) that can be used for developing console applications, Windows Applications, Web Applications, Windows Service, Web service.. And so on…

Q.Difference between .Net Framework and VisualStudio.Net?

Ans:

.NET FRAMEWORK VISUAL STUDIO .NET
1. It is a run- time environment, which 1. It is a development environment,
we can use to run applications. which we can use to develop
applications.
2. It is required for .net developers and 2. It is required for only .net developers.
.net application end users
3. It is a free ware which we can 3. It is not free way which we have to
download from Microsoft Website. purchase from Microsoft.

Q.What is CLR? 

Ans:

  • CLR stands for Common Language Runtime, it is .net execution.
  • CLR is a common execution engine for all .NET Languages that means every .NET language application has to execute with the help of CLR.

Q.Explain .net application Execution process?

Diagram for .net application execution process :

Ans: .Net application Execution process can be divided into 2 steps:

Step1. Converting HIGH level language code into MSIL (Microsoft Intermediate Language) with the help of language compilers because .Net execution engine (CLR) can understand only MSIL code.

Step2. JIT (JUST-IN-TIME) compiler will convert MSIL code to NATIVE code because operating system can understand only NATIVE code or MACHINE code.

Q.What is JIT Compiler?

Ans: JIT (JUST-IN-TIME) Compiler will convert MSIL (Microsoft Intermediate Language) code to Native code because operating system can understand only Native code or machine code.

Q.What is CLS?

  1. CLS (Common Language Specifications) is a set of common language standard defined by the Microsoft for all .NET Languages.
  2. Every .NET Language has to follow CLS Standards.
  3. Whenever a Programming Language wants to recognize as .NET Language then it has to follow CLS.

Q.What is CTS?

Ans:

  • CTS (Common Type System) is a subset of CLS. It is a set of common based data types defined by Microsoft for all .NET Languages.
  • Every .NET Language has to map their data types with CTS types.

Q.What is MSIL Code?

Ans: Microsoft Intermediate Language (MSIL), is one of the Core component of the

.NET Framework. Any .NET source codes written in any .net supportive language (C#, VB.net etc), when compiled are converted to MSIL. This MSIL, when installed or at the Runtime, gets converted to machine code. The Runtime conversion of MSIL code to the machine code is handled by a component called as the Just In Time (JIT) Compiler.

Q.Explain the role of Garbage collector?

Ans: In .NET, MEMORY MANAGEMENT is handling by GARBAGE COLLECTOR (GC). GC is an integral part of CLR.

To perform memory Management GC will do 2 duties.

     1.Allocating the Memory

->When new object is created by application garbage collector will allocate memory for that object with in Managed heap.

  1. De-Allocating the Memory:-

->When an object is not using by the application garbage collector will recognize it as unused object..and garbage collector will destroy unused objects according to generation algorithm.

Q.What is Managed Code and Unmanaged Code?

.Net application may contain 2 types of codes.

  1. A) Managed Code B) Unmanaged Code

Ans:  Managed code:

The code which is taking the help of CLR for execution is called as managed code.

Example for Managed Code:-

All .net languages code is managed code.

VB.Net code, C#.Net code…etc

  1. Unmanaged code: –

The code which is not taking the help of CLR for execution is called as Unmanaged code..

Example for Unmanaged Code:-

In .net application non .net code is unmanaged code..

VB Code, VC++ Code…

Note: –       .net application can contain non .net code.

C#.NET

Q.Why C#.Net?

Ans: To develop any type of application by using .NET we require one .NET LANGUAGE to write the business logic of that application.

Q.Explain about primitive data types?

Ans: In C#.NET, according to the type of the data and size of the data, data types are classified into 5 types.

They are—

  1. Numerical Data types
    1. Signed Numerical data types:

sbyte, short, int, long

b.Unsigned Numerical data types;-byte, ushort, uint, ulong

      2.Floating

float, double, decimal

     3.Character related Data types

a) Char

    4.Logical Data Types

a) bool

  1. General data Types
    1. string
    2. object

These data types are called as PRIMITIVE DATA TYPES.

Q.What is the MaxValue and MinValue?

Ans: MaxValue and MinValue are predefined constants, which are members of every primitive data type structure except bool.

Using this Constant we can get the MINIMUM value and MAXIMUM value of a data type.

Q.Difference between value types and Reference types?

Ans:

VALUE TYPES REFERENCE TYPES
1.In value types, data will storing in 1. In this, Data will be storing in HEAP
STACK MEMORY MEMORY.
2. Value type variable can contain the 2. Reference type variable will contain
actual data. the address of the data.
3. In primitive data types except General 3. In primitive data types only General
data types are called VALUE TYPES. data types will come under
They are Numerical, Floating, Character REFERENCE TYPE.
and Logical.
Ex: Int, Long, Char EX: String, Object
4. Structures and Enums are value types 4. Class, interface, delegates come under
this.

Q.When we will go for signed data types and when we will go for unsigned data types?

 For Example:-

When we will go for sbyte When we will go for byte

Ans: Whenever we want to allow both positive and negative values then we will go for signed data types.

Whenever we want to allow only positive values then we will go for unsigned data types.

Here sbtye is a signed data type and byte is an unsigned data type.

Q.What is the output?

static void Main (string [] args)

{

Char c=’a’;

int j=c;

Console.WriteLine (j);

Console.ReadLine ();

}

Output: 97

Q.Can I assign 1 or 0 into bool variable?

static void Main(string[] args)

{

bool b = 1;

Console.WriteLine(b);

Console.ReadLine();

}

Ans: No 

Q.What is the output ?

static void Main(string[] args)

{

bool b = true;

Console.WriteLine(b);

Console.ReadLine();

}

OUTPUT: True

Q.Can we assign null value into value type variable?

Ans:  No.

but we can assign null values into reference type variable.

Q.How to assign null value into value type variable?

Ans: We have to go for NULLABLE VALUE TYPES. Syntax: ? =NULL;

Q.When we will declare particular variable as nullable type?

Ans: Whenever an input is an optional that means not compulsory then we can declare particular variable as NULLABLE TYPES.

Q.What is implicit typed variable when we will go for implicit typed variable?

Ans:

  • Using var keyword we can declare IMPLICIT TYPED VARIABLE.
  • IMPLICIT TYPED VARIABLE can have any data type value and this variable will be converting into particular data type based on the value

which is assigning.

Whenever we r unable to expect the type of value which is going to assign.

Q.What is the difference between GetType() and typeof()?

Ans:

typeof() GetType()
1. It will return the given data type 1. It will return the given variable
base type data type base type
2. It is a operator 2. It is a method

Q.What is the output?

static void Main(string[] args)

{

var a = 10;

var b = 10.5;

Console.WriteLine(a.GetType());

Console.WriteLine(b.GetType());

Console.ReadLine();

}

OUTPUT: System.Int32

System .Double

Q.What is implicit type casting? When we will go for explicit type casing?

Ans: IMPLICIT TYPE CASTING: – Converting from Smaller size data type to bigger size data type is called as IMPLICIT TYPE CASTING.

When EXPLICIT TYPE CASTING: – The type casting which is not possible by using implicit type casting then we have to go for EXPLICIT TYPE CASTING.

Q.Difference between Parsing and Converting?

Parsing Converting
1.  Using parsing we can convert from 2.  Using converting we can convert
only string data type to any other data from any data type to any other
type except object data type. data type.

Q.What is the output?

static void Main(string[] args)

{

string s1 = “1234”;

string s2 = “1234.5”;

string s3 = “rama”;

string s4 = null;

string s5 = “12321321321323232132132332”; int res;

res = int.Parse(s1);

Console.WriteLine(s1);

//res = int.Parse(s2);

//res = int.Parse(s3);

//res = int.Parse(s4);

//res = int.Parse(s5);

Console.ReadLine();

}

OUTPUT: 1234

Q.Difference between int.Parse() and Convert.Toint32()?

Ans:

Int.Parse() Convert.ToInt32()
1.Using this we can convert from only 1.Using this we can convert from any
STRING to INT. data type value into INT.
2.When we are parsing if the string 2.When we are converting if the string
variable contains NULL value then this variable contains NULL value then it
parsing technique will throw argument will convert that NULL as ZERO.
NULL EXCEPTION.

Q.What is Boxing and Unboxing?

Ans:

BOXING: – It is the process of converting from VALUE type to REFERENCE type.

UNBOXING: –It is the process of converting from REFERENCE type to VALUE type.

EX: converting from object to int.

Q.What is the difference between Convert.ToString() and Tostring()? 

Ans: Convert.ToString() handles NULL values even if variable value become NULL.

Tostring() will not handles NULL values it will throw a NULL reference exception error.

Q.What is the difference between string and StringBuilder?

Ans:

STRING STRING BUILDER
1. When we implement modifications to 1. When we implement modifications to
the existing String object within the existing StringBuilder object will not
memory it will create a new object. create new copy of object instead of that
Because string is IMMUTABLE. it will modify the existing object.
Because StringBuilder is MUTABLE.
2. String will allocate a new memory 2. StringBuilder class will have a
whenever we concatenate the string method Append() this method is used to
Value insert the new value on the existing
value.
EX:  String s1=‖sathya‖; so the usage of string builder is more
S1=s1+‖Tech‖; efficient in case of large amount of
Console.WriteLine(s1); string
EX: StringBuilder s1=new
StringBuilder(―sathya‖);
S1.Append(―Tech‖);
Console.WriteLine(s1);
3. It will occupy more memory, it will 3. It will occupy less memory, it will
decrease the performance of improve the performance of
applications. applications.
For Example:-
static void Main(string[] args)
{

string s1 = “Hydera”;

Console.WriteLine(s1.GetHashCode());

s1 = s1 + “bad”;

Console.WriteLine(s1.GetHashCode());

Console.WriteLine(s1);

StringBuilder s2 = new StringBuilder(“Hydera”);

Console.WriteLine(s2.GetHashCode());

s2.Append(“Bad”);

Console.WriteLine(s2.GetHashCode());

Console.ReadLine();

}

Q.What is Error, Bug and Defect?

Ans: Error –> Which comes at the time of development. Bug –> Which comes at the time of testing. (Pre-Release) Defect –> Which comes in Production. (Post-Release)

Q.Why class and object?

Ans: CLASS: To achieve ENCAPSULATION, as well as for modularity OBJECT: To allocate memory for instance variables & to store the address of instance method.

Q.When we will go for instance variable?

Ans: Whenever we required a filed for multiple objects with the different values, then particular variable we will declare as INSTANCE VARAIBLE.

Q.When we will go for static variable?

Ans: According to the requirement whenever the value is common for all the objects then particular variable will declared as STATIC.

Q.Difference between instance variable and static variable?

Ans:

INSTANCE VARIABLE STATIC VARIABLE
(or) (or)
NON-STATIC VARIABLE CLASS VARIABLE
1. A variable which is declared within 1. A variable which is declared inside
the class and outside the method the class and outside the method by
WITHOUT using STATIC keyword is using STATIC keyword is called as
called as INSTANCE VARIABLE. STATIC VARIABLE.
2. Instance variable will create multiple 2. Static variable will create only once
times for every object creation. when the class is loading.
3. Instance variable value will be 3.satic variable value will be same for
differs from one object to another every object
object.

Q.When we will go for readonly?

Ans: Whenever filed is required for every object with the different value, but the value not required change.

Ex: – EmpNo

Q.When we will go for static readonly? Difference between static variable and static read only?

Ans: Whenever we want to have common value for every object and value should not be changed forever we will go for static readonly.

STATIC VARIABLE STATIC READONLY
1. Value will be common for all objects 1. value be common for all objects but
but value can be changed value can’t be changed

Q.Difference between constant, static and read-only?

Ans:

CONSTANT STATIC VARIABLE READONLY
1.const keyword is used 1. static keyword 1.Readonly keyword
2. Its value cannot be 2. Its value can be 2.Its value cannot be
changed changed modified
3. By default constant is 3. For static variable, 3.By default Non-static
static that means we don’t programmer has to
require to use any static declare as static
keyword
4. Constant value should 4. Static variable can be 4. Readonly can be
be initialized at the time initialized at the time of initialized at the time of
of declaration which we declaration as well as we declaration or runtime
cannot initialize in can initialize in runtime (only within the
runtime. within the static constructor)
constructor.

Q.When the memory will be allocated for instance variable and static variable?

Ans: STATIC VARIABLE: – At the time of class is loading, memory will be allocated for static variable.

INSTANCE VARIABLE: – When the object is created the memory is allocated for instance variable.

Q.What is the purpose of constructor and method?

Ans: Purpose of Constructor: To initialize at the time of creating an object for Instance variable as well as at the time class is loading for static variable. Purpose of Method: To perform operations on state.

Q.When we will go for instance method?

Ans:  To perform operations on Instance variables.

Q.When will go for static method?

Ans: While defining method if that method is not required to access instance variables we will define particular method as static method.

Q.If a class is having one static constructor and one instance constructor which constructor will call first?

Ans: First control will execute STATIC constructor because CLASS will load first then OBJECT will create.

Q.Why static constructor is a parameter less constructor?

Ans: Static constructor executes at the time of class loading. There is no need to pass values explicitly, so it doesn’t have parameters.

Q.What are the default access modifiers?

Ans: Default access modifier of class members is private. Default access modifier of a class is internal.

Q.What is the super class for all.net classes?

Ans: OBJECT Class

Q.When object class constructor is calling?

Ans: When we call instance constructor first it will call object class constructor.

Q.How constructor calling mechanism will work?

Ans: Constructor is calling from BOTTOM to TOP, but it is executing TOP to BOTTOM.

Q.What is this and base?

Ans: this: It is a keyword which is representing current class object or instance. Using this we can invoke current class instance members.

Base: It is a keyword which is representing the super class instance.

Using base keyword we can access super class instance members from derived class or sub class.

Q.How to invoke super class constructor?

Ans:  base()

Q.How to invoke current class constructor? 

Ans: this()

Q.What is constructor overloading?

Ans: Implementing multiple constructors within a single class with different signature (Different no. of parameters or Type of parameters or Order of parameters) is called CONSTRUCTOR OVERLOADING.

Q.What is constructor chaining?

Ans: Whenever one class constructor is invoking another class constructor which is called as constructor chaining.

For this we can use Base()

Q.Why Main() is static?

Ans: When we run the application CLR has to invoke the Main(). If the Main() is a instance method again it requires object.

To overcome this Main() is defined as static method.

Q.Main() and static constructor in same class which one will execute first?

Ans:  STATIC CONSTRUCTOR

Q.What is passing parameter mechanism? How many types?

Ans: Passing a value to a function is called as PASSING PARAMETER MECHANISM.

C#.Net will support passing parameter mechanism in 3 ways. 1. Call by value (or) Pass by value

  1. Call by reference (or) pass by reference
  2. Call by Out (or) pass by out

Q.When call by value, call by reference, call by out?

Ans: CALL BY VALUE: Whenever we want to pass some value to a function and the modifications are not expecting to reflect back to actual parameter then we will pass it as CALL BY VALUE.

CALL BY REFERENCE: Whenever we want to pass some value and we are expecting the modifications should be reflected back to actual paramer then we will pass it as CALL BY REFERENCE

CALL BY OUT: Whenever we don’t want to pass any values but we are expecting back the modifications then we will pass particular parameter as CALL BY OUT.

Q.Difference between call by ref and call by out?

Ans:

CALL BY REFERENCE CALL BY OUT
1.Ref keyword is used 1.Out keyword is used
2. Ref parameter should have some 2. Out parameter is not required to have
value. value.
3. Whenever we want to pass some 3. Whenever we don’t want to pass any
value and we are expecting the values but we are expecting back the
modifications should be reflected back modifications then we will pass
then we will pass it as CALL BY particular parameter as CALL BY OUT
REFERENCE

Q.What are oops principles?

 Ans:

  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism

Q.What is Encapsulation? How can we achieve?

Ans: Wrapping STATES and BEHAVIOURS are called as ENCAPSULATION.

Or

Binding VARIABLES and METHODS is called as ENCAPSULATION.

By implementing class we can achieve ENCAPSULATION.

51) What is abstraction? How can we achieve?

Abstraction means HIDING. Abstractions are 2 types.

1) data abstraction:-

Hiding unwanted data is called as data abstraction

2) Method abstraction:-

Invoking required method and hiding unwanted method is called as method abstraction.

With the help of FUNCTION OVERLOADING we can achieve Method ABSTRACTION.

Q.What is Inheritance? Types of Inheritance?

Ans: Inheriting or deriving members from one class to another class is called as

INHERITANCE.

C#.Net will support 5 types of Inheritance. They are

  1. Single Inheritance
  2. Multi-level Inheritance
  3. Multiple Inheritance
  4. Hierarchical Inheritance
  5. Hybrid Inheritance.

Q.Is C#.Net will support multiple Inheritance?

Ans: In C#.NET multiple inheritances is not possible by using classes, which is possible with the help of INTERFACES.

Q.What is sealed class? When we will go for sealed class?

Ans: While defining a class, if we have used ―sealed‖ keyword then that class can be called as SEALED CLASS. It cannot be inherited.

Whenever we want to restrict to inherit a class we can go for sealed class.

Q.Difference between static class and sealed class?

Ans:

STATIC CLASS SEALED CLASS
1. It can contain only STATIC 1. It can contain both STATIC and
members. INSTANCE members.
2. It cannot be instantiated. 2. It can be instantiated(we can create
object for sealed class)
3. STATIC keyword is used. 3. SEALED keyword is used.
4.Can’t be inherited 4. Can’t be inherited.

Difference between class and structure?

Ans:

CLASS STRUCTURE
1. It is reference type 1. It is value type
2. When we create an object for class it 2. When we create an object for
will be allocated into HEAP structure it will be allocated into
MEMEORY STACK MEMEORY
3.To define a CLASS, class keyword is 3. To define a STRUCTURE, struct
used keyword is used
4. It will support inheritance 4. It will not support inheritance
5.Instance field intailzers are allowed 5. Instance field intializers are not
allowed.
6.It can contain explicit default 6.It can’t contain explictit default
constructor constructor
7. We can’t create an object for class 7. We can create an object for structure
with out using new keyword. with out using new key word if it is not
having instance varibles.
8. We can have static, abstract, sealed 8. We can’t have static, abstract, sealed
class. structure.
9.We can implement overloading and 9. We can implement overloading with
overrding with in class in structure, but we can’t implement
overriding with in structure.

Q.Why property?

Ans: 1.To assign value to a class level variable after creating object to retrieve the value from class level variable individually.

  1. Property will provide SECURITY to variable data.
  2. Property will provide VALIDATION FACILITY for variable data at the time of Assigning.

Q.Difference between constructor and property?

Ans:

CONSTRUCTOR PROPERTY
1. It is used to initialize the instance 1. It is used to assign value to class level
variables at the time of creating an variables as well as can retrieve the
object. value from class level variables.

Q.What is polymorphism? Types of polymorphism?

Ans: Polymorphism means one name many forms. Implementing multiple functionalities with the same name is called POLYMORPHISM.

It is of 2 types:

  1. Static Polymorphism (or) Compile Time Polymorphism
  2. Dynamic Polymorphism (or) Runtime Polymorphism

Q.What is static polymorphism and dynamic polymorphism?

Ans: STATIC POLYMORPHISM:

A method which will bind at compile time will execute in runtime is called as static polymorphism or early binding or compile time polymorphism

DYNAMIC POLYMORPHISM:

A method which will bind at compile time will not execute, instead of that a method which will bind at runtime will execute is called as RUNTIME POLYMORPHISM (or) DYNAMIC POLYMORPHISM is nothing but LATE BINDING.

Q.What is function overloading? When we will go for function overloading?

Ans: FUNCTION OVERLOADING: Having multiple methods with the same name but a different no. of arguments or different type of arguments or different order of arguments in a single class or in a combination of base and derived class.

WHEN: Whenever we want to implement same method with the different functionalities then we have to go for FUNCTION OVERLOADING

Q.Can we overload static methods?

Ans:  YES.

Q.What is function overriding? When we will go for function overriding?

Ans: FUNCTION OVERRIDING: Having multiple methods with the same name and with the same signature in a combination of base and derived class.

WHEN:

Whenever we want to implement a method in multiple classes with the different behavior we can go for method overloading.

Q.What is method hiding?

Ans: Hiding the SUPER CLASS method within the SUB CLASS by using new keyword as called as METHOD HIDING.

Q.Can we override static methods?

Ans: NO. We cannot define static method as VIRTUAL, OVERRIDE and

ABSTRACT.

Because FUNCTION OVERRIDING is depending on OBJECT or INSTANCE

Q.What is the output?

class bc

{

internal virtual void display()

{

Console.WriteLine(“bc display”);

}

}

class dc : bc

{

internal override void display()

{

Console.WriteLine(“dc display”);

}

}

class tc : bc

{

internal new void display()

{

Console.WriteLine(“tc display”);

}

}

class Program

{

static void Main(string[] args)

{

bc b = new dc();

b.display();

  • = new tc(); b.display();

Console.ReadLine();

}

}

OUTPUT: dc display

bc display

Q.Difference between function overloading and function overriding?

Ans:

FUNCTION OVERLOADING FUNCTION OVERRIDING
1. Multiple methods with the same name 1. Multiple methods with the same name
and different signature. and same signature.
2. It can implement in a single class and 2. To implement override we should go
combination of base and derived class. for base and derived class, we cannot
implement in single class.
3. No keywords are used 3. virtual in base class and override in
derived class
4. Both functions return types can be 4. Both functions return types should be
same or differ. same.
5. It is a compile time polymorphism 5. It is a Run time polymorphism
6. We can overload static methods 6. We cannot override static methods
7. Constructors can be overload. 7. Constructors cannot be overload.

Q.When we will go for abstract class?

Ans: Whenever we want to implement some methods in current class and some methods we want declare in current class which we want to implement in future classes then we have to declare that class as abstract class.

Q.When we will go for interface?

Ans: Whenever we want to declare all the members in current class and want to implement all the members in future classes then we will declare particular class as interface.

Q.Why we can’t create object for abstract class and interface?

Ans: Not required

Because is abstract class is a partial implemented class and interface has no implementation.

Even though these abstract class abstract members and interface members should implement within the derived classes.

Due to that reason we don’t required to create object for abstract class and interface.

We will create an object for derived class and using that object we can access abstract members and interface members.

Q.Difference between abstract class and interface?

Ans:

ABSTRACT CLASS INTERFACE
1. It is a collection of abstract members 1. It is collection of abstract members,
and non-abstract members. that means by default interface members
are abstract.
2. While defining an abstract class, 2. While defining an interface, interface
abstract keyword is used. keyword is used.
3. It is partially implemented 3. No implementation
4.we can implement with in a method, 4. We can’t implement a property and
property(Normal method or Normal method.
property)
5.it can contain fields 5.it can’t contain fields
6.it can contain constructor 6.it can’t contain constructor
7. While implementing abstract class 7. While implementing interface
members with in the derived class we members with in the derived class we
have to use override keyword. don’t required to user override key
word.

Q.Benefits of oops?

Ans: 1. Reusability

  1. Extensibility
  1. Re-implementation
  2. Modularity
  3. Easy to modify
  4. Easy to implement real world programming
  1. Security

Q.What is an exception?

Ans: Run time error is nothing but and exception.

Q.Why exception handling mechanism?

Ans: To handle runtime error, when a runtime error is occurred to avoid abnormal termination by displaying user-friendly error messages.

Q.What code we will write within try, catch and finally blocks?

Ans: TRY BLOCK: We have to write the statements which may throw an error. CATCH BLOCK: We will write the statements to display user friendly messages to the user to give more clarity to the user regarding error.

FINALLY BLOCK: We will write ERROR FREE code or CLEAN UP code that means the statements which we want to execute irrespective of error occurrence.

Q.Can we have multiple catch blocks and if yes when we will go for multiple catch blocks?

Ans: Yes. Whenever we want to handle multiple errors we have to go for

MULTIPLE CATCH BLOCKS.

Q.What is super class for all .net exception classes?

Ans:  Exception class

Q.What is a delegate? Types of delegates?

Ans: It is similar like C++ function pointer. Delegate object can hold the address of a function and can invoke a function. Delegates are reference types.

Delegates are of 2 types

  1. Single cast Delegate and
  2. Multi Cast Delegate

Q.In C# which is called as type safe function pointers? Why?

Ans: In C#.Net, DELEGATES are called as TYPE SAFE FUNCTION POINTERS because Delegate declaration should follow the method declaration which is holding by the delegate object.

Q.What is language Independency? Is .NET language independent technology?

Ans: .Net is supporting for multiple languages. While developing an application by using one .net language we can use another .net language component.

For example:-

While developing C#.Net application we can use vb.net component. As well as while developing VB.Net application we can use C#.Net component.

Due to that reason we can say that .net is a language independent technology.

Q.What is an assembly? Types of assemblies?

Ans: An Assembly is a unit of code which provides versioning and deployment. Assemblies are of 2 types:-

  1. Private Assembly and 2. Shared Assembly

Q.Difference between dll and exe?

Ans:

exe dll
1.  exe stands for EXECUTABLE 1. dll stands for DYNAMIC LINK
LIBRARY.
2.File extension will be .exe 2.File extension will be .dll
Ex;-hello.exe Hello.dll
3.exe file will have an ENTRY point 3.dll file will not have an ENTRY point
called main() called main()
4. exe is SELF EXECUTABLE. Exe 4. dll is not a self executable, it is
itself is an application. reusable component. It will depend on
some other application for execution for
execution.
5. Collection of classes which has 5. Collection of classes which is not
Main() will produce exe files. having Main() will produce dll files.
Ex: .Net Console application Ex: .Net class library project.

Q.Difference between private assembly and shared assembly?

Ans:

PRIVATE ASSEMBLY SHARED ASSEMBLY
1. An assembly which is providing 1. An assembly which is providing
services to SINGLE client application at services to MULTIPLE client
a time is called as application at a time is called as
PRIVATE ASSEMBLY SHARED ASSEMBLY
2. It will create a local copy within 2. It will not create a local copy, it will
every client application folder, that local provide services to multiple client
copy will provide the services to application from a centralized shared
concern client application. folder called GAC.

Q.What is GAC?

Ans: GAC stands for GLOBAL ASSEMBLY CACHE. IT is a residence for all SHARED ASSEMBLIES. When we install .NET software, GAC folder will create

within the following path         C:\Windows\Assembly

Q.What is strong name? How to create strong name?

Ans: It is one of the .NET Framework utility, which is representing with a file called sn.exe.

Using this utility we can give a strong name or public key to the given assembly. Strong name or public key will give uniqueness to given assembly among collection of assemblies.

Q.How to install an assembly into GAC?

Ans: GAC UTILITY:

It is represented with a file called GACutil.exe. Using this utility we can install an

assembly into GAC folder

Syntax:- D:\\gacutil – i (Press enter)

Example:- D:\\gacutil – i myassembly.dll (Press enter)

Here ―i‖ stands for INSTALLING

The above command will install myassembly.dll into GAC folder.

Q.What signing assembly?

Ans: Informing about created strong name to the assembly is nothing but signing the assembly.

Q.What is satellite assembly?

Ans: An assembly which we can use to develop multi lingual       applications in .net.

Q.What are Multilingual applications?

Ans: An application that supports for more than one human readable language is known as multilingual application.

Q.What is Reflection?

Ans: Reflection is used to get the information about an assembly programmatically by writing some code.

Q.How to implement Reflection in .net?

Ans: System.Reflection

System.Type

Q.What are smart arrays in C#.Net?

Ans: In C#.Net, INDEXERS are called as SMART ARRAYS because accessing array with the help of indexers will be faster.

Q.What is enum? What is the default data type of enum?

Ans: Enum is a value type. It is a collection of constants that means it is a collection of string constants which are representing collection of integer constants.

Int is the default data type of enum.

Q.Why generics?

Ans: Generics allow us to define type-safe data structures, without committing to actual data types. It means it allows the programmer to decide the type of parameter in RUNTIME or CONSUMPTION TIME.

Q.What we are achieving by using generics?

Ans: We can avoid function overloading in some level.

Q.Can we create normal object for generic class?

Ans: NO. We CANNOT create a normal object for Generic class.

Q.Can we pass 2 different type values to generic function?

Ans:  YES.

HOW :

Class myclass

{

Internal static void print <t, k=””> (Ta, Kb)</t,>

{

}

}

Class program

{

Void Main ()

{

Myclass.print<int, string=””> (10,‖sathya‖);</int,>

Console.ReadLine ();

}

}

Q.How many types of collections?

Ans: Collections are of 2 types:

1. Normal Collection and

  1. Generic Collection

Q.What is dictionary?

Ans: 1.The Dictionary class is a generic class and can store any data types.

2. It is a collection of Pairs.

  1. Each pair will have 2 elements: 1. Key value and 2.Item Value.
  2. Every item should be represented with one unique key value.

Q.How to add summary to a method?

Ans: If we want to add a method comment you can just place your cursor on an empty line above one of your method and insert 3 slashes which will insert a comment block for you to fill out.

Q.Can we call message box with in console application.

Ans: Yes.

  1. Start a new project – File -> New Project -> Console Application -> OK.
  2. On Solution Explorer – right click on References and click Add Reference.
  3. Scroll down the list until you find “System.Windows.Forms”, click it and then click OK
  4. Now under all the using _____’s add this to the code window:
  5. Now go to the main function MessageBox.Show (“Hello World”);
  6. Now go to Debug -> Start without Debugging.

Q.what is partial class? Why partial class?

Ans: 1. While defining a class, if we have used partial keyword which can be called as PARTIAL CLASS.

  1. Partial class will split into multiple class files but the class name will be same but class files names should be differ.

WHY: According to the requirement, whenever multiple resources wants to work on single class then we can declare particular class as a PARTIAL CLASS.

Ex:-

In asp.net

Webform1 is a partial class

1) Webform1.aspx:- Here we will write the business logic

2) Webform1.aspx.desgigner.cs:- Here we will write the designing logic.

Q.what is a thread?

Ans: Thread is an independent execution path, it able to run simultaneously with other execution paths.

Q.what is the base class library for threading?

Ans:  System.Threading

Q.How to create thread?

Ans: Whenever we want to create a thread, we have to create an object for thread pre-defined class.

Thread thr1=new Thread ();

Q.How to invoke a thread?

Ans: Using thr1.Start ();

Start(): It is a pre-defined member method of thread class. Using this method we can invoke or start a thread.

Q.What is threadstart()?

Ans: 1. Threadstart() is a pre-defined delegate, which is a part of System.Threading base class library.

  1. We can initialize a method to thread with the help of ThreadStart().

Q.How to send a thread for sleep?

Ans: Using Thread.sleep(), we can send a thread for sleep according to the given time. Sleep() method is used to Block the current thread for the specified number of milliseconds. In other words

We can include specific time via thread.sleep() method like as: Thread.Sleep (TimeSpan.FromHours (1)); // sleep for 1 hour

Thread.Sleep (1000);                        // sleep for 1000 milliseconds

Q.How to suspend a thread?

Ans: Using Suspend() we can suspend the targeted thread. When you call Thread.Suspend() on a thread, the system notes that a thread suspension has been requested and allows the thread to execute until it has reached a safe point before actually suspending the thread. A safe point for a thread is a point in its execution at which garbage collection can be performed.

Once a safe point is reached, the runtime guarantees that the suspended thread will not make any further progress in managed code. A thread executing outside managed code is always safe for garbage collection, and its execution continues until it attempts to resume execution of managed code.

Q.How to call back suspended thread?

Ans: Suspended thread can be called back by using resume().

Q.How to terminate thread?

Ans: The Thread.Abort() method is used to start the process of terminating the thread. we are calling this method usually terminates the thread. it raised a System.Threading.ThreadingAbortException in the thread on which it is invoked.

Q.what is the scope of protected Internal?

Ans: If we declare a class or class member access modifier as protected internal which can be accessed by all the classes of CURRENT PROJECT and DERIVED CLASSES of other projects within that application.

Q.How to call Garabge collector?

Ans: Using GC.Collect();

The garbage collection class provides the GC.Collect(); which you can use to give your application some direct control over the garbage collector. In general, you should avoid calling any of the collect methods and allow the garbage collector to run independently.

Q.Difference between dispose() method and finalize() method?

Ans: These are just like any other methods in the class and can be called explicitly but they have a special purpose of cleaning up the object.

DISPOSE(): In the dispose method we write clean up code for the object. It is important that we freed up all the unmanaged recources in the dispose method like database connection, files etc.

The class implementing dispose method should implement IDisposable interface. A Dispose method should call the GC.SuppressFinalize method for the object it is disposing if the class has desturctor because it has already done the work to clean up the object, then it is not necessary for the garbage collector to call the object’s Finalize method.

FINALIZE(): A Finalize method acts as a safeguard to clean up resources in the event that your Dispose method is not called. You should only implement a Finalize method to clean up unmanaged resources. You should not implement a Finalize method for managed objects, because the garbage collector cleans up managed resources automatically. Finalize method is called by the GC implicitly therefore you can not call it from your code.

Note: In C#, Finalize method cannot be override, so you have to use destructor whose internal implementation will override the Finalize method in MSIL. But in the VB.NET, Finalize method can be override because it does support destructor method.

Dotnet Interview Questions            Dotnet Interview Questions and Answers

 

   ASP.NET

Q.What is ASP.Net? Why asp.net?

Ans:  ASP.NET is a .NET web technology or Server side technology.

WHY: To develop a web application by using .Net we have to use a .Net web

technology called Asp.Net and a .Net language called C#.Net.

Q.What do you mean by server side technology?

Ans: 1. The code which is executing within the WEB SERVER is called as SERVER SIDE CODE.

  1. Server side code we can implement by using Server side technologies. Ex. ASP, ASP.NET, JSP, PHP and so on
  2. Using server side technology we can develop server side web pages.

Q.What do you mean by client side technology?

Ans: 1. The code which is executing within the WEB BROWSER is called as CLIENT SIDE CODE.

  1. Client side code we can implement by using client side technologies. 3. Ex: JavaScript, HTML, CSS

Q.What are the programming techniques will be supporting by asp.net?

Ans: Asp.net will support 2 Programming Techniques. They are-1. InPage Technique and

  1. CodeBehing Technique.

Q.Can we convert client side control as a server side control? Can we convert server side control as client side control?

Ans: Yes. We can convert Client side control as server side control by adding an ATTRIBUTE called runat=‖server‖.

But we cannot convert server side control as client side control.

Q.How can you pass values between ASP.NET pages?

Ans: Different techniques to move data from one web form to another are:

1. Query string

  1. Cookies
  2. Session state
  3. Application state
  4. Cross page postback
  5. Context.Handler object

Q.What is the difference between Response.Redirect() and Server.Transfer()?

Ans: Response. Redirect():

  1. It is used to navigate the user request between multiple web servers.
  2. It will not hide the Destination url address.

Server. Transfer():

  1. It is used to navigate the user request within the web server.
    1. It will hide the Destination url address.

Q.Explain about validation controls in asp.net?

Ans: There are 6 Validator Controls. They are

1. Requiredfield Control

  1. Compare validator
  2. Range validator
  3. Regular Expression validator
  4. Custom validator
  5. Validation summary

Q.When we will go for custom validator control?

Ans: Whenever our validation requirement is unable to achieve with the help of existing validation controls then we have to go for CUSTOM VALIDATOR CONTROL

Q.How to invoke server side validation function and how to invoke client side validation function?

Ans: Server side validation functions can be invoked by using ASP.NET and Client side validation function are invoked with the help of JavaScript and HTML.

Q.How to access information about a user’s locale in ASP.NET?

Ans: User’s locale information can be accessed through

System.Web.UI.Page.Culture property.

Q.What are the life cycle events of asp.net?

Ans: Application level, Control level, Page level.

Q.What are the Asp.Net page cycle stages?

Ans: There are overall 8 stages available for any webpage that will undergo with in server at page life cycle.

1) Page Request

2) Start

3) Page Initialization

4) Load

5) Validation

6) PostBack Event Handling

7) Rendering

8) Unload

Q.What are page life cycle events?

Ans: 1. Page_PreInit

  1. Page_Ini
  2. Page_InitComplete,
  3. Page_PreLoad
  4. Page_Loa
  5. Page_LoadComplete
  6. Page_PreRender
  7. Page_PreRenderComplete,
  8. Page_Unload

Q.In asp.net page life cycle events which will fire first?

Ans:  Page_PreInit

Q.What is the difference between event and method?

Ans: Event will execute for some action i.e called as event firing or event calling or event executing.

Whereas method will contain some behavior or functionality.

Q.What are the default events of controls Button and Textbox?

Ans: Default events of: Button: CLICK Event TextBox: TEXTCHANGED Event

Q.What do u mean by postback?

Ans: When ever user request for a page for first time it is called First request. When ever user will interact the page by clicking button or selecting radiobutton e.t.c again one more request for the same page that is called postback request.

Q.What is Ispostback? When we will use Not Ispostback?

Ans: IsPostBack: It is the property of the Page class which is used to determine whether the page is posted back from the client.

When: Whenever we don’t want to execute the code within the load event, when the page load event fires then we will use (!IsPostBack).

Q.What is AutopostBack? when we will set Autopostback=true?

Ans: Autopostback is the property of the control. If you want a control to postback automatically when an event is raised, you need to set the AutoPostBackproperty of the control to True.

Q.Difference between web user control & custom control?

Ans:

WEB USER CONTROL CUSTOM CONTROL
1. It will provide services to single web 1. It will provide services to multiple
applications. web applications.
2.Its file is represented with *.ascx 2.Its file is represented with *.dll file
3. If we want to develop a web user 3. If we want to develop a custom
control we have to add a pre-defined control we have to use a class library
template called web user control to the project.
solution explorer of the application
4. Web user control we have to drag 4.Custom control we have to drag from
from solution explorer window to web toolbox window to web page.
page.

Q.How to get the current date to textbox?

Ans: TextBox1.Text = DateTime.Now.ToString();

Q.How to divide the page into different parts?

Ans: By using div tag and panel control.

Q.What is Rendering?

Ans: Rendering is a process of converting complete server side code into client understable code. It will happen before page is submitting to the client.

Q.What is the difference between ASP and ASP.Net?

Ans:

ASP ASP.NET
1. Asp is a classic server side 1. Asp.Net is a .Net advanced server
technology before .NET side technology.
2. Asp will support only ONE 2. Asp.Net will support 2 programming
programming technique called INPAGE techniques i.e INPAGE and
TECHNIQUE(writing both CODEBEHIND technique
(design/logic) code in the single file
called NOTEPAD)
3.In Asp, its file extension is .asp 3.In Asp, its file extension is .aspx
4. Asp uses mostly VBScript, HTML 4. Asp.Net uses any .Net languages
and JavaScript including VB.Net, C# but mostly
C#.Net.
5. Asp has limited OOPs support. 5. ASP.NET uses languages which are
fully object oriented languages like C#

Q.What is the parent class for all asp.net web server controls?

Ans:  System.Web.UI.Control.

Q.How many types of memories are there in .net?

Ans: Two types of memories are there in.net. 1. Stack memory and

  1. Heap memory

Q.D/B client side and server side scripting?

Ans:

Client Side Scripting Server Side Scripting
1. Scripting which will execute within 1. Scripting which will execute within
the web browser can be called as client the web server can be called as client
side scripting. side scripting.
2. Using this we can implement client 2. Using this we can implement server
side validations. side validations.
3. Client side scripting we can 3. Server side scripting we can
implement by using client side implement by using server side
technologies called JavaScript, VB technologies called Asp.Net, JSP, PHP
script and so on. and so on.

Q.When we will go for gridview customization?

Ans: Whenever we want to display the Gridview control according to our requirement then we will go for Gridview Customisation.

Q.What is AutoGenerateColumns property?

Ans: It is a Boolean property of gridview control. By default it is true.

If we want to customize gridview control..we have to set it as false.

Q.List out directories in Asp.Net?

Ans: Page, Register, Master, Control

Q.What are the major built in objects in asp.net?

Ans:  Application, Request, Response, Server, Session.

Q.When we will go for master page?

Ans: Whenever we want to have common header and common footer within multiple pages of a website then we can go for a Master Page.

Q.When can we use xml control?

Ans: Whenever we want to display the data from XML document to the user then we can use XML control.

NOTE: To fetch the data from XML document, XML control will depend on XSLT(Extensible Style sheet Language Transformation) file.

XSLT file will be acting as a mediator between XML control and XML document.

Q.When can we use wizard control?

Ans: Whenever we want to accept multiple inputs from the user in STEP by STEP process we can use WIZARD CONTROL.

Q.When can we use adRotator control?

Ans: Whenever we want to display the collection of images in a rotation manner one by one then we will go for Adrotator control.

Q.How view and Multiview controls will work?

Ans: View and multiview are container controls.

Multiview control: It can contain collection of view controls but not a normal control.

View Control: It can contain normal controls, but view control should be placed within the multiview.

  • By implementing view and multiview control we can reduce the no. of pages.

Q.What are the config files we have in asp.net?

Ans: In ASP.NET we have 2 types of Configuration files. They are-1. Web.Config and

  1. Machine.config

Q.What is web.config file? How many web.cofig can contain a single application?

Ans: 1. Web.Config is one of the configuration files.

  1. It is a XML file.
  2. This file we can use to define the ASP.NET application configuration settings.

We can have MULTIPLE Web.Config files within a single application.

Q.Can we declare more than oneconnection string in web.config file?

Ans:  YES. But the connection string names must be different.

Q.When we will go for multiple web.config files?

Ans: Whenever we want to define some separate settings for couple of web pages, we will create a new folder and we will add that couple of web pages to that folder and we will add a new Web.config file to that new folder and we will define that separate settings within that Web.config.

Q.What is the importance of machine.config? How many machine.config files?

Ans: The Machine.Config file, which specifies the settings that are global to a particular machine.

Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered.

We can have only ONE machine.config files.

Q.What is the Difference between Hyperlink button and Link Button

Ans: Hyperlink: It will not PostBack the webpage to the server. 

Link Button: It will postback the webpage to the server.

Q.What is State Management? Why?

Ans: STATE MANAGEMENT: It is a process of maintaining the user’s information.

WHY: Asp.Net web application is depending on HTTP protocol which is a STATELESS protocol that means it cannot remember previous user information. Solution for this problem is STATE MANAGEMENT.

Q.How many types of state management?

Ans: We can implement STATE MANAGEMENT in 2 ways. 1. Server Side State Management and

  1. Client Side State Management.

Q.What is client side state management? How many types?

Ans: Storing the user’s information within the WEB BROWSER memory or CLIENT MACHINE is called as Client Side State Management.

Q.What is server side state management? How many types?

Ans: Storing the user’s information within the WEB SERVER memory is called as Server Side State Management.

Q.What is a session? How many types of sessions?

Ans: Session is a temporary variable which will be used to maintain the user information.

Based on the locations, sessions are of 4 types:

  1. Inproc session
  2. State server session
  3. Sql server session
  4. Custom session

Q.What is the default type of session data?

Ans: OBJECT.

Q.What is the default life time of session variable?

Ans:  20 Minutes.

Q.Where we will define the session state type?

Ans: Within the Web.config , under the TAG.

Q.What is the Default Session state mode?

Ans: The default Session state mode is INPROC.

Q.How to set the life time of session variable?

Ans: Using TimeOut property.

Q.How to destroy session?

Ans: Using Abondon(). i.e Session.Abondon() will destroy the session.

Q.What are the advantages of inproc session and disadvantages?

Ans: ADVANTAGES OF INPROC SESSION:

  1. Accessing the inproc session data will be faster.
  2. It is very much suitable for small web applications

Disadvantages:

  1. It we restart the web server or if any crashes to the web server there is a chance of losing the session data.
  2. If the session data is increased there is a burden on the web server, it will affect the performance of web server and web application.
  3. It is not suitable for large web application models like webgarden and webfarm.

Q.What are the advantages of state server session and disadvantages?

Ans: ADVANTAGES OF STATE SERVER SESSION:

  1. State server session will provide more security because sessions are creating separately within the windows service.
  2. If we restart the web server or if any crashes to the web server but still session data will be safe.
  3. It is suitable for large web applications like webgarden and webfarm model.

DISADVANTAGES OF STATE SERVER SESSION:

  1. Accessing the state server session will be slower compare with inproc session.
  2. It is not that much suitable for small web applications because maintaining the windows service is expensive.
  3. Always windows service should be ON.

Q.Where inproc session data will store?

Ans: Inproc sessions are creating within the Current App Domain, which is a part of Web Server.

Q.Where state server session will store?

Ans: State server session are creating within the state server which is nothing but Windows Service, this windows service is representing by a file called (AspNet_state.exe).

Q.How to start windows service?

Ans: We can start the Windows Service in 2 ways-1. By using control panel and

  1. By using Command prompt.

Q.Where sql server session will store?

Ans: Sql server sessions will be creating within the Sql Server Database.

Q.What is the framework tool will user to create aspstate database with in sqlserver?

Ans:  aspnet_regsql

Q.What are the session related events?

Ans: There are 2 Types of Session events.

1. Session Start and

  1. Session End.

Q.When we will go for session concept?

Ans: Whenever we want to store user data within the server.

Q.What is worker process?

Ans: Worker process is nothing but Asp.Net execution engine or Asp.Net runtime. The role of Asp.Net runtime is executing the Asp.Net web page within the Web server.

Q.What is appdomain?

Ans: Every worker process will maintain a memory unit within the web server which is nothing but Appdomain.

Q.What is application pool?

Ans: It is part of web server or a unit of web server.

Q.What is webgarden?

Ans: An application pool which is having multiple WORKER PROCESS is called as WEB GARDEN.

Q.What is webfarm?

Ans: Deploying a website into multiple web servers is called Webfarm.

Q.Why inproc session is not suitable for webgarden and webfarm model?

Ans: Inproc sessions will create within the current App Domain due to that reason app domain data is not sharable due to that reason Inproc sessions are not suitable for WEB GARDEN and WEBFARM MODELS.

Q.When we will go for application state?

Ans: when ever we want to store the data in web server..which should be common for all users.

For example:

In youtube video number of views

Q.What are application events?

Ans: There are 3 application events.

1. Application Start Event

  1. Application End Event
  2. Application Error Event.

Q.Difference between session state and application state?

Ans:  1. Application state: It will be available to all users of the application.

  1. Application state variables are cleared, when the process hosting the application is restarted.

Session state:

  1. It will only be available to a specific user of the ASP.net application.
  2. Session state variable are cleared, when the user session times out. The default is
  • This is configurable in Web.Config.

Q.What is global.asax file?

Ans: This is a class file, which is coming with 1 user defined called Global and it has a super class called HTTPApplication. This file will contain all the application session related events.

Q.What is a cookie?

Ans: Cookie is a variable which we can use to store the user data.

It will create within the client machine due to that reason which is called as client side state management.

Q.What is the default life of cookie?

Ans:  30 Minutes.

Q.Types of cookies?

Ans: Cookies can be broadly classified into 2 types

  1. Persistent cookies: Remain on the client computer, even after the browser is You can configure how long the cookies remain using the expires property of the Http Cookie object.
  2. Non-Persistent cookies: If you don’t set the Expires property, then the cookie is called as a Non-Persistent cookie. Non-Persistent cookies only remain in memory until the browser is closed.

Q.What is the Scope of Cookie?

Ans: Throughout the website.

Q.What is the Difference between Cookie and Session?

Ans:

COOKIE SESSION
1. Cookie is a client side state 1. Session is a server side state
management technique. management technique.
2. Cookie is a variable which will create 2. Session is also a variable which will
within the client machine. create within the Web server.
3. Default timeout of a cookie is 30 3. Default life time of session variable is
minutes. 20 minutes.

Q.What is querystring? What is the draw back?

Ans: 1.QueryString is a way to forward the data from one web page to another. 2. QueryString is attached to the URL with “?”.

Drawbacks: 1. All the attributes and values are visible to the end user. Therefore, they are not secure.

  1. There is a limit to URL length of 255 characters.

Q.What is Viewstate? What is the scope of view state?

Ans: 1. Viewstate will maintain the user’s data among multiple postbacks requests.

2. View state will store the user’s data within client machine due to that reason it is called as CLIENT SIDE STATE                       MANGEMENT.

  1. The scope of the Viewstate is within that web form.

Q.Is HTML controls will maintain Viewstate?

Ans:  NO. Because HTML controls are Client side controls.

Q.What is Hiddenfield and what is the scope?

Ans: 1. HiddenField is a Server side control, which can hold the user data but holding the data will not be visible because it is a INVISIBLE CONTROL. 2. To Implement HiddenField we can use Asp.Net server control called HiddenField.

Q.What is caching?

Ans: Caching is a process of storing the frequently used web page (or) frequently used part of the web page (or) frequently used data into some location for future access.

Q.How many locations we can implement caching?

Ans: According to the location caching is classified into 4 types.

1. Client caching

  1. Proxy caching
  2. Reverse caching
  3. Web server caching

Q.What are types of caching techniques?

Ans: Asp.Net will support 3 Caching Techniques.

1. Page Output Caching

  1. Fragment Output caching
  2. Data Caching

Q.When we will go for page output caching?

Ans: Whenever we want to store the frequently used web page into some location then we will go for PAGE OUTPUT CACHING.

In general, we will implement page caching on startup page such as login and home page.

Q.When we will go for fragment caching?

Ans: Whenever we want to store the frequently used part of the web page into some location for future access then we will go for FRAGMENT CACHING.

Fragment caching we will implement on a Web user control, which is accessing by multiple web pages.

Q.When we will go for data caching?

Ans: Whenever we want to store the frequently used data for future access into some location then we will go for DATA CACHING.

Q.What is class we will use to access global connection string?

Ans: ConfigurationManager class.

Q.What is security?

Ans: Security is a process of allowing the authenticated users and denying the unauthorized users when user is requested for restricted web page.

Q.What is authorization?

Ans: Authorization is a process of verifying the authentication ticket and supplying the web page based on authentication ticket.

Q.What is Authentication?

Ans: Authentication is a process of accepting the user credentials, when user will request for a restricted web page and generating the authentication ticket for the valid user.

Q.How many types of authentications will support by asp.net?

Ans: It will support 3 types of authentications.

1. Forms authentication

  1. Passport authentication
  2. Windows authentication

Q.What is returnurl?

Ans: it is querystring varible

Q.What is the class we will use for forms authentication?

Ans: FormsAuthentication

Q.When we will go for forms authentication?

Ans: Forms authentication is used for normal web applications.

Q.When we will go for passport authentication?

Ans: A group of websites which will allow the user with single user id and password will go for the passport authentication.

Ex: If we have Gmail id with that we can access Gmail, Facebook, Youtube etc

Q.When we will go for windows authentication?

Ans: Whenever users are part of the same Windows domain as the server then the Windows Authentication is the preferred approach to authentication.

In other words, whenever we have intranet web applications it is better to go with Windows Authentication.

Q.List out Gridview events?

Ans: 1. Row deleting and Row deleted

  1. Row editing
  2. Row updating and Row updated
  3. Row Cancelling edit
  4. Row command
  5. Row created
  1. Row DataBound
  2. Page index changing and page index changed
  3. Sorted and sorting.

Q.What is the use of sqldata source control?

Ans: SqlData Source will make the programmer task easy to communicate SqlServer Database.

Q.When we will go for repeater control?

Ans: Whenever we want to display the data as it is we can go for Repeater control, that means we don’t require to provide any Edit or Delete facilities.

Ex: To display Bank Statements and Examination results.

Q.When we will go for datalist control?

Ans: Whenever we want to display the data in a repeating list format then we will go for Datalist control.

Q.When we will go for formview and when we will go for details view?

Ans:

FORMVIEW: Whenever we want to display record by record in VERTICAL manner then we can go for Formview.

Details View: Whenever we want to display record by record in HORIZONTAL manner then we can go for Details view.

Q.What is the use of data pager control?

Ans: Data pager control provides paging functionality for data bound controls.

Q.Difference between listbox and dropdownlist?

Ans: LISTBOX: It will allow the user to select one item or multiple items.

DropDownList: It will allow the user to select only one item.

Q.where is the viewstate information stored?

Ans: Within the html hidden fields.

Q.which are the 2 properties are on every validation control?

Ans: 1.ControlToValidate and 2.ErrorMessage.

Q.what is the use of @register directives?

Ans:  It informs the compiler of any custom server control added to the page.

Q.what is the textbox property used for password textbox?

Ans:  TextMode

Q.How to reduce the burden on the page?

Ans:  By implementing paging.

                                                          AJAX

Q.Why Ajax?

Ans:  To avoid full page postback,to implement partial page postback

  1. Using AJAX we can develops RICH USER INTERFACES web applications
  2. If we want to follow ASYNCHRONOUS REQUEST MODEL, while developing the web applications we have to use AJAX.
  3. To improve the PERFORMANCE of the web application and to reduce the NETWORK TRAFFIC we can use AJAX.
  4. We can avoid SCREEN FLICKER using AJAX.

Q.What is partial post back?

Ans: when ever user will interact the part of the page then sending postback request for only that part of the page

Q.What is synchronous request model and what is asynchronous request model?

Ans: Synchronous Request Model: In this model, every client request has to

communicate the web server and every request has to process by the web server then only that request, response will be getting by the client.

Asynchronous Request Model: In this model, between client and web server we will have a middleman called AJAX ENGINE.

AJAX ENGINE: It is a part of web browser. The role of AJAX engine is to process the part of the web page or partial web page within the client side.

Q.What is client centric and what is server centric?

Ans:  AJAX will support 2 programming models. They are:

  1. Server Centric programming model: In this model every client request will be processing by the web server that can be first request or postback request.
  2. Client Centric programming model: In this model, first request will be processing by the web server and postback request will be processing by the client.

NOTE: While developing an AJAX web page we can implement only server centric programming model or client centric programming model or both within single web page.

Q.Explain about extender controls? And non extender controls?

Ans: AJAX Toolkit is providing 2 types of controls.

EXTENDER CONTROLS:

  1. Extender controls are not individual controls i.e these controls will not provide any functionality individually.
  2. Extender controls will extend the functionalities of existing ASP.NET controls.
  3. Ex: Autocomplete extender, calendar extender, dropdown extender and so on..

NON-EXTENDER CONTROLS:

  1. Non – Extender controls are individual controls i.e every non-extender controls will provide some individual functionality.
  2. Non – Extender controls provides the extra controls in ASP.NET.
  3. Ex: Accordion and Accordion pane, Tab Container, Rating, Nobot.

Q.What is the importance of script manager and update panel control in Ajax?

Ans:  IMPORTANCE OF SCRIPT MANAGER:

  1. In Ajax, Script Manager is the main important parent control.
  2. Whenever we are developing an Ajax web page first we have to drag and drop SCIRPT MANAGER Control.
  3. These control class will provide all the AJAX related METHODS and PROPERTIES.

IMPORTANCE OF UPDATE PANEL:

  1. Update panel is one of the Ajax Container control.
  2. By default Asp.Net control follows Server Centric Programming Model Whatever controls we are adding to update panel will execute Client

Centric Programming Model.

  1. Whenever we want to make Asp.Net controls to follow Client Centric Programming Model.
  2. We can drag and drop update panel, in that we can add Asp.Net controls and Ajax controls.

                                                 ADO.NET

Q.What is ADO.Net? Why Ado.net?

Ans: ADO.NET : 1. It is an integral component in .NET framework, which was introduced by the Microsoft with .NET Framework 1.0

  1. It is a Data Access Object, which allows communication between .NET application and Databases.

WHY: 1. whenever .NET application wants to communicate Databases it has to take the help of Ado.Net.

  1. Ado.net acts like a mediator between .Net application and Database.

Q.Difference between Connected Oriented Architecture (COA) and Disconnected Oriented Architecture (DOA)?

Ans:

COA DOA
1. Whenever we require a continuous 1. Whenever we doesn’t require a
connection with the Database for continuous connection with the
accessing the data we use COA Database for accessing the data we can
use DOA.
2. In COA, SqlDataReader will fetch 2. In DOA, SqlDataAdapter will fetch
the data from database and bind to the the data from database and store into
Client application. the DATASET in the Client
application.

Q.What is the base class library used for ado.net?

Ans: System.data To communicate Sql server database we have to import a Base Class Library called Using System.Data.SqlClient;

Q.What are components required for connected oriented?

Ans: The components required for Connected oriented architecture are:

  1. Connection Object
  2. Command Object
  3. DataReader Object

Q.What are the components required for Disconnected oriented?

Ans: The components required for Disconnected oriented architecture are:

  1. Connection Object
  2. Command Object
  3. DataAdapter Object
  4. Dataset Object

Q.Difference between DataReader and DataAdapter?

Ans:

DATAREADER DATAADAPTER
1. It is used in Connected Oriented 1. It is used in Disconnected Oriented
Architecture. Architecture.
2. DataReader is represents with a 2. DataAdapter is represented with a
pre-defined class called pre-defined class called
SqlDataReader. SqlDataAdapter.
3. DataReader is used to retrieve a 3. DataAdapter is used to retrieve data
read-only, forward-only stream of from a data source and populate tables
data from a database within a DataSet.

Q.Difference between dataset and data table?

Ans:

DATASET DATA TABLE
1. Dataset is a collection of DATA 1. Data table represents a single table
TABLES. i.e it is a collection of rows and
columns.

Q.Difference between data reader and dataset?

Ans:

DATAREADER DATASET
1. It is used in Connected Oriented 1. It is used in Disconnected Oriented
Architecture. Architecture.
2. DataReader is directly accessing the 2. Dataset is a local database which is
central database. not communicating the central
database directly, between the central
db and local db there will a mediator
called DataAdapter for
communication.
3. DataReader is represented at a time 3. Dataset can contain collection of
single record. DataReader is Read tables because dataset itself is a local
only, Forward only, connected recoed database.
set.
4. DataReader we will use only when 4. We can use dataset for reading the
we want to read the data from Central data, inserting, updating and deleting
DataBase. the data.

Q.When we will go for connected oriented architecture and when we will go for disconnected oriented architecture?

Ans:  Connected Oriented Architecture (COA):

Whenever we require a continuous connection with the Database for accessing the data then we will go for COA.

DISconnected Oriented Architecture (DOA):

Whenever we doesn’t require a continuous connection with the Database for accessing the data then we will go for DOA.

Q.How to bind the data to textbox?

Ans: Txtbox1.Text=dr[0];

Q.How to bind the data to grid view?

Ans: Gridview1.datasource=dr;

Gridview1.databind();

Q.How to bind the data to label?

Ans: label1.Text=dr[0];

Q.How to bind the data to dropdownlist?

Ans: dropdownList1.datasource=dr;

dropdowList1.DataTextField=dr[1];

dropdownList1.DatavalueField=dr[0];

dropdownList1.DataBind();

Q.Difference between ExecuteReader, ExecuteNonquery, ExecuteScalar?

Ans: ExecuteReader(): It is apre-defined member method of SqlCommand class. This method will read or fetch the data from the central database and will return to DataReader object.

ExecuteNonQuery(): This method will execute the Non-Query command of command object CRUD Operations like INSERT, UPDATE, DELETE, CREATE and so on. Then it will return the no. of records which are affected by the command.

ExecuteScalar(): This method will executes the command object command till the first match. This method will avoid the unnecessary scanning of the table, which improves the performance of the application.

Q.How to destroy connection object explicitly?

Ans:  conn.Dispose()

Q.What is row command event? When we will go for row command event?

Ans:  Row Command event is one of the events of the Gridview control.

This event will fire when user will click any button within the Gridview control.

Q.Can I implement link button click event within gridview?

Ans:  Yes.

Q.How to create delete, edit, select buttons with in gridview?

Ans:  By using

PROPERTY BUTTON
AutoGenerateDeleteButton For DELETE Button
AutoGenerateEditButton For EDIT Button
AutoGenerateSelectButton For SELECT Button

Q.Which data bound control will support to create insert button by using property?

Ans:  Listview control

Q.What is the data provider to communicate sql server data base?

Ans: Every DataProvider is providing by the Microsoft as a Base class library (BCL).

To communicate Sql server database we have to import a BCL called Using System.Data.SqlClient;

Q.What is 3 tier?

Ans: A software solution which is implemented by using 3 layers can be called as 3-Tier Architecture.

In 3-Tier architecture, we have 3 layers

  1. I-Layer: It will contain the UI-Design and Validations Code is known as

PRESENTATION LAYER (UI).

  1. II-Layer: It will contain the Business Logic layer code and is known as

BUSINESS LOGIC LAYER (BLL).

  1. III-Layer: It will contain the Data Access Code and is known as DATA ACCESS LAYER (DAL).

In 3-Tier Architecture, UI interacts with BLL only

BLL will interacts with DAL

DAL interacts with DATABASE.

Q.What is windows service?

Ans:  1. Windows service in one of the software application.

  1. It works only on windows operating system due to that reason windows service is called operating system dependent application.
  2. It will start when the windows OS is Booting.
  3. It will run till the windows OS is Running.
  4. It will stop when the OS is Shutdown.
  5. It can be start and stop manually also.

Q.What is web service?

Ans: 1. A unit of code which is providing the services to multiple client applications can be called as WEB SERVICE.

  1. An application which is receiving the services can be called as SERVICE RECEIVER or CLIENT APPLICATION.
  1. An application which is providing the services can be called as SERVICE PROVIDER or WEB SERVICE.

Q.What is WPF?

Ans:  1. WPF stands for Windows Presentation Foundation.

  1. It is a .Net advanced windows technology, introduced by Microsoft with .Net Framework 3.0 in 2006.
  2. Using WPF we can develop an advanced windows applications.
  3. WPF is integrated with 2D graphics, 3D graphics, animations and multimedia.
  4. Whenever we want to implement animations within a desktop application the best choice is WPF.

Q.What is silverlight?

Ans: SilverLight is an advanced web technology which we can use to implement animations, multimedia for asp.net web application

Q.What is Jquery?

Ans: 1. Jquery is an advanced technology of JavaScript that means jquery is next generation of JavaScript.

  1. It is a predefined JavaScript Library.
  2. It is a group of JavaScript predefined functions.
  3. It is a lightweight and more powerful API adding dynamic behavior for webpage.
  4. To implement JavaScript programmer has to write the multiline code. But using Jquery we can implement JavaScript.

Q.What is Linq?

Ans: Linq stands for Language Integrated Query.

Linq is an advanced data access object for .net .

Q.What is Crystal Reports?

Ans: 1. Crystal Reports is one of the third party Reporting Tool. Using this tool, we can generate the reports.

  1. If we want to use Crystal reports in Visual studio 2010 then we have to install crystal reports software explicitly from the following site:

WWW.sap.com

Q.What is the base class library for crystal reports?

Ans: CrystalDecisions.CrystalReports.Engine;

Q.Can we run asp.net application without IIS?

Ans: Yes. Using ASP.NET DEVELOPMENT SERVER which is the default server in ASP.NET.

Q.Why virtual directory?

Ans: to provide security for web application

Q.What is the default server we will get with asp.net?

Ans: ASP.NET DEVELOPMENT SERVER.

Q.Why constraints?

Ans: Constraint is a condition which we can assign on a single column or multiple columns.

Constraints will maintain consistent data within the database.

Q.What is the importance of primary key?

Ans: To avoid duplicate values and null values in a column.

Q.What is the importance of foreign key?

Ans: 1. To establish relation between Parent table and Child table we require a common column , that column should be parent table primary key column. 2. To make that relation strong we require Foreign key constraint that means Foreign key constraint we should assign child table common column.

Q.What is stored procedure?

Ans:  1. Stored procedure is a pre-compiled Sql statements.

  1. That means stored procedure will contain sql statements like SELECT, UPDATE, DELETE and so on which is already compiled.

Syntax:

Create procedure procedurename () As

Begin

{

}

end

Q.What is advantage of stored procedure?

Ans: By implementing stored procedures we can avoid the multiple time compilation of Sqlcommands.

contact for more on Dotnet Online Training

Dotnet Interview Questions Overall rating: ★★★★☆ 4.4 based on 427 reviews
5 1

dotnet interview questions

Write A Review 

Name
Email
Review Title
Rating
Review Content

Dotnet interview questions Tags

Dotnet interview questions and answers,Dotnet online training, Dotnet interview questions, Dotnet training online, Dotnet training, Dotnet training institute, latest Dotnet interview questions, best Dotnet interview questions 2019, top 100 Dotnet interview questions,sample Dotnet interview questions,Dotnet interview questions technical, best Dotnet interview tips, best Dotnet interview basics, Dotnet Interview techniques,Dotnet Interview Tips.

For  online training videos