Professional Documents
Culture Documents
Data Abstraction
Inheritance
Data Encapsulation
Polymorphism
Array:
1. You need to specify the size of an array at the time of its declaration. It cannot
be resized dynamically.
2. The members of an array should be of the same data type.
Collection:
You can prevent a class from being inherited further by defining it with
the sealed keyword.
Overriding involves the creation of two or more methods with the same name and
same signature in different classes (one of them should be parent class and other
should be child).
Overloading is a concept of using a method at different places with same name and
different signatures within the same class.
Class:
Structure:
1. A structure is a value type.
2. In structure, memory is allocated on stack.
3. Structures do not support inheritance.
4. Structure members cannot have null values.
5. Structure does not require constructor/destructor and members can be
initialiazed automatically.
7. Define enumeration?
Enumeration is defined as a value type that consists of a set of named values. These
values are constants and are called enumerators.
9. What is a namespace?
You are allowed to include more than one catch block in your program; however, it is
not possible to execute them in one go. Whenever, an exception occurs in your
program, the correct catch block is executed and the control goes to the finally block
if exists.
All types and type members have an accessibility level, which controls whether they
can be used from other code in your assembly or other assemblies. You can use the
following access modifiers to specify the accessibility of a type or member when you
declare it:
public: The type or member can be accessed by any other code in the same assembly
or another assembly that references it.
private: The type or member can be accessed only by code in the same class or struct.
protected: The type or member can be accessed only by code in the same class or
struct, or in a class that is derived from that class.
internal: The type or member can be accessed by any code in the same assembly, but
not from another assembly.
bool, byte , char, decimal , double, float, int, long, sbyte , short, uint, ulong, ushort.
New features can be easily added without disturbing the existing one.
Abstract method doesn't provide the implementation & forces the derived class to
override the method.
The crux is we can have Multiple classes in one .cs file; and we can define one Main
method in each class.& while doing compliation we can spcify the compiler to choose
the Main methods from the specific class .
The default access modifier for a class is internal if it's defined within the same
namespace. It is private if it's defined within another class.It can declare members
(methods etc) with following access modifiers:
Public
Internal
Private
protected internal
-------------------------------------------------------------------------------------------------------
State Management
-------------------------------------------------------------------------------------------------------
State management is the process by which you maintain state and page information
over multiple requests for the same or different pages.
We know that Http is stateless, means when we open a webpage and fill some
information and then move to next page then the data which we have entered will
lost.
It happed do to Http protocol stateless nature. So here session come into existence,
Session provide us the way of storing data in server memory. So you can store your
page data into server memory and retrieve it back during page postbacks.
Advantages:
Session provide us the way of maintain user state/data.
It is very easy to implement.One big advantage of session is that we can store any
kind of object in it. :eg, datatabe, dataset.. Etc By using session we don't need to
worry about data collesp, because it store every client data separately. Session is
secure and transparent from the user. Disadvantages: Performance overhead in case
of large volumes of data/user, because session data is stored in server memory.
Overhead involved in serializing and de-serializing session data, because in the case
of StateServer and SQLServer session modes, we need to serialize the objects before
storing them.
Asp.Net use 120 bit identifier to track each session. This is secure enough and can't
be reverse engineered. When client communicate with server, only session id is
transmitted, between them. When client request for data, ASP.NET looks on to
session ID and retrieves corresponding data.
<configuration>
<sessionstate Mode="off"/>
</configuration>
Initialization
LoadViewState
LoadPostBackData
Load
RaisePostBackEvent
SaveViewState
Render
Dispose
There are mainly two types of state management that ASP.NET provides:
View State
Control State
Hidden fields
Cookies
Query Strings
Application State
Session State
32. Explain about View State in ASP.Net ?
ASP.NET uses this mechanism to track the values of the controls on the web page
between page request for same page. We can also add custom values to view state.
ASP.NET framework takes care of storing the information of controls in view state
and retrieving it back from viewstate before rendering on postback.
There are scenarios when we need to store the data between page requests. So far, the
techniques we have discussed store the data for the single page requests. Now we
look at the techniques that store information between page requests.
Query strings are commonly used to store variables that identify specific pages, such
as search terms or page numbers. A query string is information that is appended to
the end of a page URL. They can be used to store/pass information from one page to
another to even the same page.
a) Use Session state variables to store items that you want keep local to the
current session (single user).
b) Use Application state variables to store items that you want be available to
all users of the application.
To create a Cookie that never expires set the Expires property of the Cookie object to
DateTime.MaxValue.
No, Cookies are not secure. You must pay attention to the type of data you store in
cookies.
-------------------------------------------------------------------------------------------------------
Validations
-------------------------------------------------------------------------------------------------------
43. Are the validation controls fired on the client side if javascript is disabled on
the client browser?
No, validation controls are not fired on the client side if javascript is disabled on
the client browser.
45. How do you programatically check, if the client side validation is not
bypassed by disabling the javascript on the client browser?
We use Page.IsValid property to determine if all the validations have succeeded. For
this property to return true, all validation server controls in the current validation
group must validate successfully.
Validation groups allow you to group validation controls on a page as a set. Each
validation group can perform validation independently from other validation groups
on the page.
You create a validation group by setting the ValidationGroup property to the same
name for all the controls you want to group. You can assign any name to a validation
group, but you must use the same name for all members of the group.
Yes, DropDownList control can also fire validation if the control's CausesValidation
property is set to true and the AutoPostBack property is set to true.
Use this property to specify the initial value of the input control.Validation fails only
if the value of the associated input control matches this InitialValue upon losing
focus.
50. What are the different validation controls available in ASP.Net?
Display - Determines how the error messages will be displayed. Possible values are
"None" (error message will not be displayed), "Static" (space for the error message is
allocated in the page layout), "Dynamic" (space for the validation message is
dynamically added to the page).
52. What is the syntax for range validator control when max and min values are
given?
<asp:rangevalidator id="RangeValidator1" runat="server" style="top: 194px; left:
365px;position: absolute; height: 22px; width:105px" errormessage="RangeValidator"
controltovalidate="TextBox4" maximumvalue="100" minimumvalue="18"
type="Integer"></asp:rangevalidator>
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
54. What’s the difference between Server controls and HTML controls?
55. What are the 2 types of controls that you can use on a webform in
ASP.NET?
Web Server Controls
HTML Controls
56. How can you prevent users from editing Text in TextBox control on a web
form?
By making the TextBox a readonly TextBox. To make a TextBox readonly set
the ReadOnly property to True.
58. What happens when you set the AutoPostBack property of a TextBox to
true?
When AutoPostBack property is set to True, the TextBox control fires a
TextChanged postback event when the user leaves the TextBox control after
changing the contents. By default, this property is set to False and the Text 颅
Changed event is cached until some other postback event occurs.
59. What are the 3 values that a TextMode property of TextBox can have?
SingleLine : Single Line TextBox
MultiLine : Multi Line TextBox(scrollable)
Password : When set to Password, the text box displays dots in place of the
characters typed.
60. How do you limit the number of characters entered by a user in the
ASP.NET TextBox?
By setting the MaxLength property of the TextBox. If you set the MaxLength
property to 10, a user can enter only 10 characters into the TextBox..
61. What is the use of rows and columns properties in asp TextBox in asp.net
Columns: The width of the text box in characters. The actual width is determined
based on the font that is used for the text entry.
Rows:The height of a multi-line text box in lines. The default value is 0, means a
single line text box.
62. What is the use of GroupName property for a radio Button in asp.net?
GroupName:Name of the group the control belongs to.
63. What are the list controls provided by asp.net explain each?
Drop-down list,
List box,
Radio button list,
Check box list,
Bulleted list.
64. What is the name event client side when button click in asp.net?
OnClientClick=”dhbd();”
PageIndexChanged Event
PageIndexChanging Event
RowCancelingEdit Event
RowCommand Event
RowCreated Event
RowDataBound Event
RowDeleted Event
RowDeleting Event
RowEditing Event
RowUpdated Event
RowUpdating Event
SelectedIndexChanged Event
SelectedIndexChanging Event
Sorted Event
Sorting Event
CallingDataMethods Event
CreatingModelDataSource Event
ItemCommand Event
ItemCreated Event
ItemDataBound Event