You are on page 1of 11

PRESSMART HYD

FIRST ROUND

1) What is Ajax?

2) Why Ajax come to picture?

3) Why dot net introduced update panel instead of normal Ajax?

4) What are the Ajax status codes?

5) What is session?

Ans : A session is defined as the period of time that a unique user interacts with
a Web application. Active Server Pages (ASP) developers who wish to retain
data for unique user sessions can use an intrinsic feature known as session
state.

6) What is cookie?

Ans: A Cookie is a small text file that the browser creates and stores on the hard
drive of your machine. Cookie is just one or more pieces of information stored as
text strings. A Web server sends you a cookie and the browser stores it. The
browser then returns the cookie to the server the next time the page is
referenced. The most common use of a cookie is to store information about the
user and preferences the user makes.

A cookie is a small bit of text that accompanies requests and pages as they go
between the Web server and browser. The cookie contains information the Web
application can read whenever the user visits the site.

7) Disadvantages of cookies?

Answer:
Advantages
1. Cookies do not require any server resources since they are stored on the
client.
2. Cookies are easy to implement.
3. You can configure cookies to expire when the browser session ends (session
cookies) or they can exist for a specified length of time on the client computer
(persistent cookies).
Disadvantages
1. Users can delete a cookies.
2. Users browser can refuse cookies,so your code has to anticipate that
possibility.
3. Cookies exist as plain text on the client machine and they may pose a possible
security risk as anyone can open and tamper with cookies.

8) What is index?

9) What is trigger?

10)What is non clustered index?

11)What is stored procedure?

12)How many values we return in stored procedures?

13)What is primary key and unique key?

14)How to store sessions in IIS?

15)Default time out for cookies?

16)If default time out is completed for the cookies then what happen to cookies?

17)Localization file?

18)Namespace for localization and globalization?

Answer : System.Globalization, System.Web, System.configuration

19)What are the cursors?

SECOND ROUND

1) what is dispose?

2) What is finalize?

3) What is ajax?

4) Difference between overloading overriding?

5) Marshaling?

6) Value type and reference type?

7) Data types for value type and reference type?

8) How to stop inheritance?


9) What is sealed class?

Answer : Sealed classes are used to restrict the inheritance feature of object
oriented programming. Once a class is defined as sealed class, this class
cannot be inherited.

In C#, the sealed modifier is used to define a class as sealed. In Visual


Basic .NET, NotInheritable keyword serves the purpose of sealed. If a class
is derived from a sealed class, compiler throws an error.

One of the best usage of sealed classes is when you have a class with static
members. For example, the Pens and Brushes classes of the
System.Drawing namespace.

10)Sealed methods?

Answer : In C# a method can not be declared as sealed. However when we


override a method in a derived class, we can declare the overridden method
as sealed as shown below. By declaring it as sealed, we can avoid further
overriding of this method.

public class testClass


{
public int x;
public int y;
public virtual void testMethod(){

public class TestClass: testClass


{
public override sealed void testMethod(){

}
}

11)Difference between abstract and interface?

12)What are the access-specifiers available in c#?

Answers : 1. public - The member can be accessed from anywhere


2. internal - The member can only be accessed from type it
originates from or other types in the same assembly
3. protected - The member can only be accessed from the type
it originates from or from detrieved types of the
originating type
4. protected internal - implies protected OR internal ( not
protected AND internal )
5. private - The member is only accessible by other members
within the type it originates from.

protect
protect intern
private public ed
ed al
internal
By object No No Yes Yes No
By derived class No Yes Yes Yes Yes(Same assembly)

13)Which access specifier are used in interface?

14)Diff between Array, Array List and Hash table, index?

15)Diff between late binding and early binding?

16)How to generate strong name?

Answer : Creating an Assembly with a Strong Name

1. Use the Strong Name tool (Sn.exe) that comes with the .NET Framework
Software Development Kit (SDK) to generate a cryptographic key pair.

The following command uses the Strong Name tool to generate a new key
pair and store it in a file called TestKey.snk:

sn -k Testkey.snk

2. Add the proper custom attribute to your source for the compiler to emit
the assembly with a strong name. Which attribute you use depends on
whether the key pair that is used for the signing is contained in a file or in a
key container within the Cryptographic Service Provider (CSP). For keys that
are stored in a file, use the System.Reflection.AssemblyKeyFileAttribute
attribute. For keys that are stored in the CSP, use the
System.Reflection.AssemblyKeyNameAttribute attribute.
The following code uses AssemblyKeyFileAttribute to specify the name of
the file that contains the key pair.

using System;
using System.Reflection;

[assembly:AssemblyKeyFileAttribute("TestKey.snk")]

17)Garbage collection?

18)How to call garbage collector?

19)Will G.C collects sessions?

Ans: Our system maintains session state using the ASP.NET State Server
service.
We expect some of our session state objects to be over 85K, which
categorizes them to be VLO's (very large objects) in terms of .NET memory
allocations. This means that these objects will be allocated in a special
managed heap for large objects. This makes sense since this would require
some work for the garbage collector to move and compact these objects
during
a GC (garbage collection). Regardless, this means that these objects will
eventually be placed in generation 2 of the directed graph of objects that
the GC maintains.

My questions are the following:


1) When do objects contained within the state server get garbage collected?
When the session "ends"?
a) If this is true, what event triggers the state server to tell it
the session has ended?

-> session timeout based on last access (this timeout is set in[/color][/color]
[/color]
web.config). when the timeout happens, any session objects are released,
and
thus availiable for GC.
2) Can I say that the objects will be ready for collection when I call
Session.Abandon()? I heard that Session.Abandon() only signals the end of a
Session for in-proc mode. Is this true?

-> yes. for non inproc, the session objects are created on page init, by[/color]
[/color][/color]
reserializing from the store. at the end of the page request, the session
objects are seialized to the store and released, ready for GC

3) Does the fact that our objects are allocated on a separate "special"
heap for very large objects influence how they are garbage collected?

-> somewhat, but don't worry. GC's normally create different heaps for
different object sizes to prevent fragmentation of the heap. normally you
would not GC a heap, until you needed the space. as the the number of large
allocation requests is smaller than the number of small allocation
requests, the smaller heaps are GC'd more often.

Ans 2: We're developing our first large scale ASP.NET web application and
I'm a
little concerned over memory usage of aspnet_wp.exe on the development
server during testing. The application appears to use a lot of memory and
I've got the feeling that it's not all been released.

Some initial questions:

1) When a session times out, is ASP.NET/CLR supposed to release every


resource
allocated during the session?

 Memory resources will be taken care of by the garbage collector -


eventually. Chances are it will not happen at the exact moment a
session times out. Server processes in general tend to not give up
memory easily, chances are they will need it again in the future.
Chances are you may not have a problem, the best way to find out would
be to do some simulated stress testing. Saying a process uses "a lot"
of memory is too relative.
2) Is there anyway to display what's happening on a IIS server when it's
running an application? A log of some kind. Just memory per session would
be
a start.

> You could start with perfmon, which comes with the operating system.
Under the .NET CLR Memory counter category pay particular attention to
the Large Object Heap size and Gen 2 heap size. These areas contain
the large objects and the objects that are hanging around the longest.

There are also memory profilers you can use - CLRProfiler is free [1].
WinDbg [2] is the best tool for seeing exactly what you have on the
heap, but has a steep learning curve and too many details for most
memory scenarios. Still, the latest version has an extension command
(!dac for DumpAspnetCache) that can show you exactly what is in the
cache (ASP.NET keeps Sessions in the Cache collection internally).

3) Are there any configuration options around memory management of


ASP.NET on
IIS?

> You can set q peak amount of memory for the worker process to use,
once it hits this number the application recycles, which might not be
what you want. In IIS 6.0 this is set on the Application Pool
properties dialog.

Despite what I've heard, do you actually have to carry out manual disposal
and memory collection. I've come from the VB6 world where the classic
circular reference (Obj1 points to Obj2 and Obj2 points to Obj1) causes both
objects (and their children) to stay in memory even though Obj1 and Obj2 are
both cleared to nothing. I currently believe the dream that CLR garbage
collection does work. I hope I can carry on with this dream... Waking up
into reality and having to implement cleanup code throughout the application
is more of a nightmare than a dream.

> Circular references are definitely not a problem in .NET.


Ans 3: let’s see the example code earlier just a little bit to see what would
happen if I saved a reference to one of the objects in a Session variable. The
Session is a special ASP.NET object that stores information (state) until the
user logs off or closes the browser.

1. protected void btnReferenceVariables_Click(object sender, EventArgs e)


2. {
3.
4. ExampleClass Number1 = new ExampleClass();
5. ExampleClass Number2 = new ExampleClass();
6.
7. Session["Number1"] = Number1;
8.
9. Number1.Number = 11;
10. Number2.Number = 22;
11.
12. txtClassNumber1Before.Text = string.Format("Number1 = {0}", Number1.
Number);
13. txtClassNumber2Before.Text = string.Format("Number2 = {0}", Number2.
Number);
14.
15. }

Notice that after the objects are instantiated, I am saving a reference to the
object that Number1 references in a Session variable called “Number1″. This
means that after the btnReferenceVariables_Click method completes, the
object that was created in the first new operation abvoe is NOT eligible for
Garbage Collection. Let’s see why by looking at this graphic.

Notice that after the method completes, there is still a reference to the first
object that was created. This is because although the local variables
Number1 and Number2 are out of scope, the Session is STILL in scope.
Therefore, the object that Number1 was pointing to is NOT eligible to be
Garbage Collected. Only when the Session dies, will that object’s memory
get cleaned up. Actually even if the Session hasn’t ended, there are a couple
of other scenarios that would cause that object to be eligible for Garbage
Collection. One way is if you assign the Session variable “Number1″ to null.
The second way is if you assign the Session variable “Number1″ to a different
object. In both of those cases, there wouldn’t be any more references left to
that original object created by the local variable Number1 in the method, so it
would then be eligible for Garbage Collection.

20)How to destroy sessions?

21)What are the validations?


Answer: Required Field Validator

Compare Validator Control

Range Validator Control

Regular Expression Validator Control


The CustomValidator Control

Validation Summary Control

22)Use of display property in validations?

23)Use of IsPageValid?

Answer : For this property to return true, all validation server controls in
the current validation group must validate successfully. You should check
this property only after you have called the Page.Validate method, or set
the CausesValidation property to true in the OnServerClick event handler
for an ASP.NET server control that initiates form processing. These server
controls include the Button, HtmlButton, HtmlInputButton,
HtmlInputImage, ImageButton, and LinkButton classes

Simpley if javascript not enable in client side invalid data can be


cary over in server in case of asp.net validator IsPageValid check at
server side all validator are passed or any in valid data are comes.

24)What is model popup?

25)Validations are client side or server side?

Answer : Both client and server side

26)What is function?

27)What is difference between function and stored procedure?

28)Arraylist supported datatypes?

29)Virtual key word?

30)Static contructor?

31)How can you call a method from static class?


32)Can we create an object for an abstract class?

33)What is postback url?

Ans : In ASP.NET 1.1 a page can only PostBack to itself, it is a common


technique to post the page to another page. In ASP.NET 2.0 ASPX page can
post to different ASPX page by using the button's PostBackUrl property.
Where ASPX is the extension of ASP.NET web application.

<asp:Button ID="BtnSubmit" runat="server" PostBackUrl="http://www.c-


sharpcorner.com" Text="Submit" OnClick="Button1_Click" />

protected void Button1_Click(object sender, EventArgs e)


{
if (PreviousPage != null)
{
TextBox txtName = (TextBox)
PreviousPage.FindControl("txtName");
this.TxtName.Text= txtName.Text;
}
}

34)Can we postback page with querystring?

Ans : Scratching my head about this. In the rendered HTML for the code
below, the btnEdit (in the GridView) has the correct Javascript in the onclick
parameter (onclick="javascript:WebForm_DoPostBack..."). The btnAddNew
has no onclick handler at all. Why? There is no compilation or runtime error,
and the page uses a master page that has the Form tag..

<ContentTemplate>
<asp:ImageButton ID="btnAddNew" SkinID="btnAddNew" runat="server"
PostBackUrl='<%# "EditUser.aspx?action="+Constants.actionAdd %>' />
<asp:GridView ID="UserGridView"
runat="server"
DataKeyNames="UserId" >
<Columns>
<asp:TemplateField
<ItemTemplate>
<asp:ImageButton id="btnEdit" SkinID="btnEdit" runat="server"
PostBackUrl='<%# Eval("UserId", "EditUser.aspx?
action="+Constants.actionEdit+"&uid={0}") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Ans 2: it looks like you don't need data binding tag (<%#) for the btnAddNew
button. So you can assign this property at server side :

btnAddNew.PostBackUrl = "EditUser.aspx?action=" + Constants.actionAdd;

35)Response.redirect and server.transfer?

36)In response.redirect and server.transfer will page url will change?

You might also like