Microsoft .net interview & answers



Question 1: What is meant by CLR?

Answer: CLR is a runtime provided by .NET. It allows us to execute the program on the .Net platform. The CLR provides "Simple Application Performance ,Safety, Multiple Language Support, Good Performance, etc".

Question 2: What is meant by ASP.NET?

Answer: ASP.NET is open source server-side web application framework designed for web development to produce dynamic web pages.

Question 3: What is the difference between STORED PROCEDURES and FUNCTIONS?

Answer:
Function
Stores Procedures
It supports only Input Parameters.
It supports both Input and Output 
Parameters.
We can write any T-Sql statements which will not modify the existing Data-Base.
We can write any T-Sql statements.ex: .dml,.dql,.ddl
We can call Functions using Select statement. using Select Statement.
We can not call Stored Procedures
Functions can be call from Stored Procedures.
Stored Procedures can not call from Fumctions.
Question 4: What is the difference between ABSTRACT CLASS and INTERFACE?

Answer:
Abstract Class
Interface
It have Constants,Members with out Method Body.
It has only Constants without
Method Body.
We can use any Access Modifiers for Visibilty [Public,Private,Internal,Protected].
The methods of an Interface must be Public only.
Abstarct contains Constructors.
Interface does not contain Constructors.
Question 5:What is the difference between AS and IS keywords?

Answer:
IS
AS
Is Operator is used to Check the Compatibility of an Object with a given Type and it returns the result as a Boolean (True Or False).
As Operator is used for Casting Object to a given type Or Class.
Question 6:What is the difference between QUEUE and STACK?

Answer:
Stack
Queue
A Stack is a Last-In First-Out (LIFO) container.
A Queue is a First-In First-Out (FIFO) 
container.
Stack is a collection of items.
Queue is an ordered collection of
items.
Question 7: What is the difference between a STRUCT and a CLASS?

Answer:
Struct
Class
Structs are value types.
Classes are reference types.
Structs cannot support inheritance.
Classes can support inheritance
Structs are passed by value (like integers).
Classes are reference (pointer) types.
Question 8: What do you mean by AUTHENTICATION and AUTHORIZATION?

Answer: Authentication is the process of validating a user on the credentials (username and password) and Authorization performs after Authentication. After Authentication a user will be verified for performing the various tasks, access is limited and it is known as Authorization.

Question 9: What is the global assembly cache (GAC)? 

Answer: GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries. GAC solves some of the problems associated with dll’s (DLL Hell).

Question 10: What is Boxing/Unboxing?

Answer: Boxing is used to convert value types to object. 

Example: 
1.  int x = 1;   
2.  object obj = x ;   
Unboxing is used to convert the object back to the value type. 

Example: 

1.  int y = (int)obj;  
Note: Conversion of Boxing and UnBoxing reduces Application Performance. 

Question 11: What is garbage collection? 

Answer: Garbage collection is the process of managing the allocation and release of memory in your applications.

NOTE: We can also call Garbage Collection Explicitly.

Question 12: What is meant by overloading and overriding?

Answer: Overloading is when you have multiple methods, with the same name but different signatures. Overriding is a principle that allows you to change the functionality of a method in a child class.

Question 13: How to find the 2nd Highest salary using Query?

Answer: 

Method 1: 
1.  select * from employees emp1 where 1 = (select count(DISTINCT(emp2.salary)) from employees emp2 where emp2.salary > emp1.salary)  
Method 2:

select top 2 salary from employees emp order by sal desc

Question 14: Write a program to print * ?

* *
* * *
* * * *

Answer: 

1.  Static void main(string[] Args)  
2.  {  
3.      int num = 1;  
4.      for (int i = 0; i < 4; i++)  
5.      {  
6.          for (int j = 0; j < num; j++)  
7.          {  
8.              console.write("*");  
9.          }  
10.         num++;  
11.         console.writeline();  
12.     }  
13.     console.readline();  
14. }  
Question 15: Explain ViewState?

Answer: It is a .NET mechanism to store the posted data among post backs. It allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required. 

Question 16: What are the various types of Authentication? 

Answer: There are 3 types of Authentication namely Windows, Forms and Passport Authentication: 
  • Windows authentication: It uses the security features integrated in Windows NT and Windows XP OS to authenticate and authorize Web application users.

  • Forms authentication: It allows you to create your own list of users and validate their identity when they visit the Web site.

  • Passport authentication: It uses the Microsoft centralized authentication provider to identify users. Passport allows users to use a single identity across multiple Web applications.
Question 17: What are the various session state management options provided by ASP.NET

Answer: ASP.NET provides two session state management: 
  • In-Process state management: In-Process stores the session in memory on the web server.

  • Out-of-Process state management: Out-of-Process stores data in an external data source. This data source may be a SQL Server or a State Server service. 
Question 18: What are the validation controls available in ASP.NET?

Answer: ASP.NET validation controls are the following:

  • RequiredFieldValidator: This validates controls if controls contain data.
  • CompareValidator: This allows checking if data of one control match with other control.
  • RangeValidator: This verifies if entered data is between two values.
  • RegularExpressionValidator: This checks if entered data matches a specific format.
  • CustomValidator: Validate the data entered using a client-side script or a server-side code.
  • ValidationSummary: This allows developer to display errors in one place.
Share on Google Plus

About Unknown

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment