Você está na página 1de 18

asp.

net interview questions and


answers
ASP.NET is a specification that was formulated by Microsoft in January 2002 to generate vibrant
Web applications, Web sites and Web services. It is an aspect of .NET Framework and also the
successor to Microsofts Active Server Pages (ASP) technology. It gathers the Web pages and
delivers much improved performance than scripting languages, such as VB Script. The Web
server controls are competent of developing interactive Web applications in most of the .NET
compatible languages, such as Visual Basic, C# and J#.
Taking into account the variations among ASP and ASP.NET, is that ASP is interpreted, means it
makes use of VB script and when the page is accomplished, it is interpreted. Whereas, ASP.NET
is compiled, means it uses .NET languages, such as C# and VB.NET, which are compiled to
Microsoft Intermediate Language (MSIL).ASP.NET is built on the Common Language Runtime
(CLR)that allow programmers to write ASP.NET code using any supported .NET language.
These applications are hosted by a Web server that can run on any type of internet browser and
are accessed by making the use of stateless HTTP protocol.
ASP.Net interview questions and Answers are accessible from everywhere and we also provide
these for fresher to get through their employment interview phase. The WebPages of this
program are designed by using either VBScript or JavaScript and these pages have access to
the same solutions as Windows application, including ADO (ActiveX Data Objects) for database
access, SMTP (Simple Mail Transfer Protocol) for e-mail and the entire COM (Component Object
Model) structure used in the Windows environment.
1. What is a round trip?
The trip of a Web page from the client to the server and then back to the client is known as a
round trip.
2. What are the types of Cookies in Asp.net?
There are two types of Cookies available in Asp.net :
Session Cookie
Persistent Cookie
3. What is the difference between Session cookie and Persistent cookie?
Session Cookie :Resides on the client machine for a single session until the user does not log
out.
Persistent Cookie :Resides on a users machine for a period specified for its expiry, such as 10
days, one month and never. The user can set this period manually.
4. Which is the parent class of the Web server control?
The System.Web.UI.Control class is the parent class for all Web server controls.
5. Which Asp.net objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.
6. 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.
7. How can you identify that the page is PostBack?
The Page object uses the IsPostBack property to check whether the page is posted back or not.
If the page is postback, this property is set to true.
8. What is ViewState?
ViewState is a .Net mechanism to store the posted data among post backs. ViewState 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.
9. What is Authentication and Authorization?
Authentication is the process of identifying users. Authentication is identifying/validating the user
against the credentials (username and password) and 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.
10. What are the types of Authentication?
There are 3 types of Authentication. Windows, Forms and Passport Authentication.
Windows authentication uses the security features integrated into the Windows NT and Windows
XP operating systems to authenticate and authorize Web application users.
Forms authentication allows you to create your own list/database of users and validate the
identity of those users when they visit your Web site.
Passport authentication uses the Microsoft centralized authentication provider to identify users.
Passport provides a way to for users to use a single identity across multiple Web applications. To
use Passport authentication in your Web application, you must install the Passport SDK.

11. What are the different ways to send data across pages in Asp.net?
The following two ways are used to send data across pages in Asp.net:
Session
Public properties
12.Where is the Viewstate information stored?
The Viewstate information is stored in the HTML hidden fields.
13. What are different types of directives in .NET?
@Page
@Control
@Import
@Implements

@Register
@Assembly
@OutputCache
@Reference
14. What is the default timeout for a cookie?
The default time duration for a cookie is 30 minutes.
15. What is the difference between HTML and Web server controls?
HTML controls are client side controls therefore, all the validations for HTML controls are
performed at the client side.
On the other hand, Web server controls are server side controls; therefore, all the validations for
Web server controls are performed at the server side.
16. What is the difference between Server-side scripting and Client-side scripting?
Server side scripting means that all the script will be executed by the server and interpreted as
needed. ASP doesnt have some of the functionality like sockets, uploading, etc.
Client side scripting means that the script will be executed immediately in the browser such as
form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript
or JavaScript.
17. How do you create a permanent cookie?
Permanent cookies are available until a specified expiration date, and are stored on the hard
disk.So Set the Expires property any value greater than DataTime.MinValue with respect to the
current datetime. If u want the cookie which never expires set its Expires property equal to
DateTime.maxValue.
18.Which method do you use to redirect the user to another page without performing a
round trip to the client?
Server.Transfer
Server.Execute.
19. What are the major events in Global.Asax file?
Application_Init
Application Disposed
Application Error
Application Start
Application End
Application_BeginRequest
Application_EndRequest
Session Start
Session End
Application_AuthorizationRequest
20. What tag do you use to add a hyperlink column to the DataGrid?
< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

21. How many languages .NET is supporting now?


When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc.
The site DotNetLanguages.Net says 44 languages are supported.
22. What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server side validation
and the page gets refreshed.
23. How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validator, Email
Validator
24. How do you turn off cookies for one page in your site?
Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this
property instructs the client application not to save the Cookie on the users hard disk when a
session ends.
25. Which two properties are on every validation control?
We have two common properties for every validation controls:
Control to Validate
Error Message
26. What are the event handlers that can be included in the Global.asax file?
The Global.asax file contains some of the following important event handlers:
Application_Error
Application_Start
Application_End
Session_Start
Session_End
27. What Asp.net objects encapsulate the state of the client and the browser?
The Session Object.
28. Which class is inherited when an Asp.net server control is added to a Web form?
The System.Web.UI.Webcontrols class is inherited when an Asp.net server controls is added to a
web form.
29. What are the types of validation controls in Asp.net?
There are six types of validation controls in Asp.net:
Compare Validator
Custom Validator
Range Validator
Regular Expression Validator
RequiredField Validator
Validation Summary
30. Which namespace is needed to implement debug and trace?
System.Diagnostic

What is Interfaces in C# ?
C# Interview Questions

An interface is similar to a class with method signatures. There wont be any implementation of the
methods in Interface. Classes which implements i...
o

admin asked 2 weeks ago

0votes
0answers
Define Multiple Inheritance in C# ?

0 views

C# Interview Questions

In C# , derived classes can inherit from only one base class. If you want inherit multiple base classes,
use interface.
o

admin asked 2 weeks ago

0votes
0answers
What is overriding in c# ?

2 views

C# Interview Questions

To override a base class method which is defined as virtual , Override keyword is used. In the above
example , method Drive Type is overrided in de...
o

admin asked 2 weeks ago

last active 2 weeks ago

0votes
0answers
What is Method Hiding in C# ?

6 views

C# Interview Questions

If the derived class doesn't want to use methods in base class , derived class can implement the same
method in derived class with same signature. ...
o

admin asked 2 weeks ago

0votes
0answers
What is Method Hiding in C# ?

3 views

C# Interview Questions

If the derived class doesn't want to use methods in base class , derived class can implement the same
method in derived class with same signature. ...
o

admin asked 2 weeks ago

0votes
0answers
Explain Polymorphism in C# ?

0 views

C# Interview Questions

Ability of a programming language to process objects in different ways depending on their data type or
class is known as Polymorphism. There are tw...
o

admin asked 2 weeks ago

0votes
0answers
Define Abstract Class in C#?

3 views

C# Interview Questions

If we don't want a class object to be created define the class as abstract. An abstract class can have
abstract and non abstract classes. If a meth...
o

admin asked 2 weeks ago

0votes
0answers
Explain Static Method?

0 views

C# Interview Questions

It is possible to declare a method as Static provided that they don't attempt to access any instance
data or other instance methods.
o

admin asked 2 weeks ago

0votes
0answers
0 views

Explain strong reference and weak reference ?


C# Interview Questions

There are two types of memory references, strong & weak. When a root references an object, it is
said to be a strong reference as the object is...
o

admin asked 2 weeks ago

0votes
0answers
0 views

Explain strong reference and weak reference ?


C# Interview Questions

There are two types of memory references, strong & weak. When a root references an object, it is
said to be a strong reference as the object is...
o

admin asked 2 weeks ago

last active 2 weeks ago

0votes
0answers
0 views

Differentiate between a Struct and a Class?


C# Interview Questions

Structs are value-type variables and are thus saved on the stack, additional overhead but faster
retrieval. Another difference is that structs cann...
o

admin asked 2 weeks ago

0votes
0answers
What is Overloading in C# ?

2 views

C# Interview Questions

When methods are created with same name , but with different signature its called overloading. For
example , WriteLine method in console class is ...
o

admin asked 2 weeks ago

0votes
0answers
0 views

Differentiate between value type and reference type?


C# Interview Questions

Value types are stored on the stack and when a value of a variable is assigned to another variable.
Reference types are stored on the heap, and whe...
o

admin asked 2 weeks ago

last active 2 weeks ago

0votes
0answers
Explain the use of goto statement?

0 views

C# Interview Questions

The goto statement is also included in the C# language. This goto can be used to jump from inside a
loop to outside. But jumping from outside to in...
o

admin asked 2 weeks ago

0votes
0answers
0 views

differentiate between Array and LinkedList?


C# Interview Questions

Array is a simple sequence of numbers which are not concerned about each others positions. they are
independent of each others positions. adding,re...
o

admin asked 2 weeks ago

0votes
0answers
0 views

How does a break statement do in switch statements?


C# Interview Questions

The break statement terminates the loop in which it exists. It also changes the flow of the execution of
a program. In switch statements, the break...
o

admin asked 2 weeks ago

0votes
0answers
0 views

differentiate between CONST and READONLY?


C# Interview Questions

Both are meant for constant values. A const field can only be initialized at the declaration of the field.
A readonly field can be initialized eith...
o

admin asked 2 weeks ago

0votes
0answers
Explain how does C# differ from C++?

4 views

C# Interview Questions

C# does not support #include statement. It uses only using statement. In C# , class definition does not
use a semicolon at the end. C# does not s...
o

admin asked 2 weeks ago

last active 2 weeks ago

0votes
0answers
0 views

differentiate between the while loop and do while loop in C#?


C# Interview Questions

The while loop tests its condition at the beginning, which means that the enclosed set of statements
run for zero or more number of times if the co...
o

admin asked 2 weeks ago

0votes
0answers
0 views

Differentiate between an abstract method & virtual method?


C# Interview Questions

An Abstract method does not provide an implementation and forces overriding to the deriving class
(unless the deriving class also an abstract class...
o

admin asked 2 weeks ago

differentiate between console and window application?


C# Interview Questions

A console application, which is designed to run at the command line with no user interface. A
Windows application, which is designed to run on a us...
o

admin asked 2 weeks ago

0votes
0answers
What do you mean by C#?
C# Interview Questions

0 views

C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming


language. It will immediately be familiar to C and C++ pr...
o

admin asked 2 weeks ago

0votes
0answers
3 views

What are the different types of statements supported in C#?


C# Interview Questions

C# supports several different kinds of statements are: Block statements Declaration statements
Expression statements Selection statements Iteration...
o

admin asked 2 weeks ago

last active 2 weeks ago

0votes
0answers
Explain Generics in C#?

0 views

C# Interview Questions

Generics is C# feature introduced in version 2.0 using which you can define type-safe classes to
maximize code reuse,type safety and performance.Fo...
o

admin asked 2 weeks ago

0votes
0answers
Explain the lock statement in C#?

0 views

C# Interview Questions

It is ensures that one thread does not enter a critical section of code while another thread is in the
critical section. If another thread attempts...
o

admin asked 2 weeks ago

0votes
0answers
Explain Delegates?

0 views

C# Interview Questions

Delegates are a type-safe, object-oriented implementation of function pointers and are used in many
situations where a component needs to call back...
o

admin asked 2 weeks ago

0votes
0answers

What do you mean by base class?

0 views

C# Interview Questions

A class declaration may specify a base class by following the class name with a colon and the name
of the base class. omitting a base class specifi...
o

admin asked 2 weeks ago

0votes
0answers
0 views

differentiate between Custom Control and User Control?


C# Interview Questions

Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in
toolbox. Drag and Drop controls. Attributes can...
o

admin asked 2 weeks ago

0votes
0answers
0 views

What is the difference between classes and structures?


C# Interview Questions

A struct is a value type and a class is a reference type. When we instantiate a class, memory will be
allocated on the heap and when struct gets i...

C# OOPS INTERVIEW QUESTIONS-ANSWERS


Hi friends this time I come with OOPS interview questions answers with user friendly format. Here are

understand oops concept.


Thanks for visit..
OOPS QUESTIONS ANSWERS:-

1. We have two classes BaseClass and childClass, ChildClass inheret base class. If we make t
counstructor called first?
Ans: Base class constructor will be call first.

2. Can we declare an Abstract method in non-abstract class?


Ans: No

3. Can we give the return type of constructor?


Ans: No

4. If we have an abstract method in base class, then we must need to override(or use new k
Ans: Yes, if we not override it then it give error.

5. We know that Base class constructor called first. But if we creating object with parameter
default and parameterized, then which constructor of baseclass called first.
Ans: Base class default constructor called first.

6. Then what you can do that base class parameterized constructor call first.
Ans: We can use "Base" keyword

vikas.ahlawat
Administrator

04-27-2013, 05:54 PM (This post was last modified: 07-20-2013 11:07 AM by vikas.ahlawat.)
Post: #1

RE: C# OOPS INTERVIEW QUESTIONS ANSWERS WITH EXAMPLE (.NET C#)

Nice Post!!

Você também pode gostar