Here are some Good Questions which i faced in my written exam (Walkin).
:30 Question :60Minutes :Subjective Answers
1.In Which Page Cycle All Controls Are Fully Loaded
Page_load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that viewstate is not fully loaded during this event.
2.Types Of Authentication:
My Answer Was:
Passport,Windows & Forms authentication.
3.How To Load A XML Into a Dataset.My Answer:-
DataSet ds = new DataSet();
ds.ReadXml("C:\\Proof.xml");
4.Difference Between DataList ,ListviewI do not know answer of this question:
But Answer must be like this: which i found and learned from MSDN
ListView
Paging :supported
Data Grouping :supported
Provide Flexible Layout: supported
Update,Delete :supported
Insert: supported
Sorting: supported
GridView
Paging: supported
Data Grouping: Not supported
Provide Flexible Layout :Not supported
Update,Delete : supported
Insert :Not supported
Sorting :supported
DataList
Paging: Not supported
Data Grouping: supported
Provide Flexible Layout :supported
Update,Delete :Not supported
Insert: Not supported
Sorting: Not supported
Repeater
Paging: Not supported
Data Grouping: Not supported
Provide Flexible Layout: supported
Update,Delete: Not supported
Insert :Not supported
Sorting: Not supported .
5. Print The Value Of All Datatables in a Dataset.
My Answer was something like this ,but was incorrect as i came to know that Dataset
Does Not Support GetEnumerator ,so ForEach can not be implemented:
My Incorrect Answer was:
foreach (DataTable dt in ds)
{
foreach (DataRow dr in dt)
{
ListBox1.Items.Add(dr["Id"].ToString());
}
}
Now I Found the solution other than foreach Loop which is given below and working perfactly:
int a= ds.Tables.Count;
for (int i = 0; i < drc=" ds.Tables[i].Rows;">
6. It was a Basic Question of Abstract Class and Interface.
7. Create a DataTable Using DatColumn and DataRow.
DataTable myDataTable = new DataTable();
DataColumn myDataColumn;
myDataColumn = new DataColumn();
myDataColumn.DataType= Type.GetType("System.String");
myDataColumn.ColumnName = "id";
myDataTable.Columns.Add(myDataColumn);
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.String");
myDataColumn.ColumnName = "username";
myDataTable.Columns.Add(myDataColumn);
DataRow row;
row = myDataTable.NewRow();
row["id"] = Guid.NewGuid().ToString();
row["username"] = "Bheeshma";
myDataTable.Rows.Add(row);
8.Question to write a css for a given specification.
9.Write A javascript for a confirmation.
Confirm("Are You Nuts!!!");
10. Where the Viewstate information stored and how can we encrypt it.
Stored In HTML Hidden Fields
Encryption:
<%@Page ViewStateEncryptionMode="Always" %>
or
<configuration> <system.web>
<pages ViewStateEncryptionMode="Always" /> </system.web></configuration>
ViewStateEncryptionMode.AutoIn this mode, ASP.NET will encrypt the ViewState for a page if any control on the page requests it. Note that this means all of the ViewState is encrypted, not just the ViewState for the control that requests it. A large part of the performance cost associated with encryption is in the overhead. So encrypting the whole ViewState is faster than doing separate encryption operations if more than one control makes the request.
ViewStateEncryptionMode.NeverAs you would expect, in this mode ASP.NET will not encrypt the ViewState, even if the application is set for encryption and controls on the page have requested it. If you know that no data involved in the page needs to be encrypted, then it may be safe to set the mode to Never. However, at this point it is rare for the documentation about a control to disclose what is being saved in ViewState, so you will want to be careful if there is a chance that sensitive data could be exposed.
ViewStateEncryptionMode.Always
In this mode, ASP.NET does not wait for a control in the page to request encryption. ViewState is always encrypted. When working with sensitive data, it is a good practice to utilize encryption.
11.What is Session and Application Object?
Session object store information between HTTP requests for a particular user, while application object are global across users.
12.What is operator Overloading,Explain with example.
Simple Question , Based on OOPS Concept.
13.Write a Code to execute a SP in ADO.NET
SqlConnection cn=new SqlConnection("ConnectionString");
SqlCommand cmd=new SqlCommand();
cmd.Connection=cn;
cmd.CommandType=CommandType.StoredProcedure;
cmd.CommandText="Test_SP";
cmd.Parameters.Add("@param1",SqlDbType.Int);
cmd.Parameters["@param1"].Value=10;
cmd.Parameters.Add("@param2",SqlDbType.Int);
cmd.Parameters["@param2"].Value=20;
cmd.Parameters.Add("@param3",SqlDbType.Int);
cmd.Parameters["@param3"].Direction=ParameterDirection.Output;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
int x=Convert.ToInt32(cmd.Parameters["@param3"].Value);
whereas SP for the above code goes like this:-
Create proc Test_SP
@param1 int,
@param2 int,
@param3 int output
as
set @param3=@param1+@param2
14.Which is safe: Convert.ToString() or .ToString()
Ans is Convert.ToString()
The basic difference between them is "Convert" function handles NULLS while ".ToString()" does not ,it will throw a NULL reference exception error.
15.What are Value Type and reference type.
16.Can we Use custom types in webservices?
YES
It is possible to process user-defined types (also known as custom types) in a Web service. These types can be passed to or returned from Web methods. Web service clients also can use these user-defined types, because the proxy class created for the client contains these type definitions. Custom types that are sent to or from a Web service are serialized, enabling them to be passed in XML format. This process is referred to as XML serialization. Classes that are used to specify Web method return types and parameter types must provide a public default or parameterless constructor. Properties and instance variables that should be serialized in XML format must be declared public. Properties that should be serialized must provide both get and set accessors. Read-only properties are not serialized. Data that is not serialized simply receives its default value when an object of the class is deserialized.
17.What Is the Use of System.Diagnostic.Process?
Follow the given link:
http://www.dotnetspider.com/resources/31435-Use-System-Diagnostics-Process.aspx
18.Static Properties?
19.Types Of Array?
Single,Multi Dimension,Jagged
20.Difference betwenn StringBuilder and String Class.
System.String is immutable; System.StringBuilder can have mutable string where a variety of operations can be performed,and System.StringBuilder class allows us to format the string and compared to string , operation on Builder are very fast.
21.Is It Correct cType(123.34,Integer) ?
22.What is Valid XML Document.?
A valid XML document is defined by the W3C as a well-formed XML document which also conforms to the rules of a Document Type Definition (DTD) or an XML Schema (XSD), which W3C supports as an alternate to DTD.This term should not be confused with a well-formed XML document, which is defined as an XML document that has correct XML syntex according to W3C standards.
23.How To End A Session?
Session.Abondon()
24.Under Which Account ASP.NET Worker Process Runs.
ASPNET
25.Write a sample code to call a method of a web service.
26.Difference betwenn char,varchar,nvarchar?
--nchar and nvarchar can store Unicode characters.
--char and varchar cannot store Unicode characters.
--char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don't use up all that space.
--varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar.
--nchar and nvarchar will take up twice as much storage space, so it may be wise to use them only if you need Unicode support.
27.Write a SP to Get the Duplicate rows from a table.
Please Follow my Post in the same blog "Removing Duplicate Rows".
These are the Questions which i am able to recall as i have very good Memory!!!
Some Question are still unanswered..If possible then provide the solutions (m also looking for).
Need Comments and Feedback to improve this post.............
Thanks & Regards
Bheeshma P. Nayak
8 comments:
One question was to find out the output..ans was "Hello C#".
still we are missing 2 questions!! but anyways good job!!
Confirm("Are You Nuts!!!");...hehehehe!!
I have a doubt..the question was how many types of authentications are there in ASP.Net?..the ans should be one(Form Auth.)..if it is asked in .NET framework then it is of 3 types...m not sure about it..but somewhere i'v read this..plz check this out!!
gud job....
i did not get the final solution of 5th que.Please xplain..Is it some typo error over dere..
Dear Ketan,
My Mistake.........'
Here Is the solution......
int tblCount = ds.Tables.Count;
for (int i = 0; i < tblCount ; i++)
{
DataRowCollection drc = ds.Tables[i].Rows;
foreach (DataRow dr in drc)
{
//Access The Row Here //Like this==:dr["Id"].ToString();
}
}
Hope This Will Make your life easy.......
Himanshu:
I will Include remaining question ASAP. And i'll also refer authentication types again.
ThanQ for Suggestion.......
Regards
AMHSEEHB
yup a little easy..
Gud job
One question I like to add
1. How to initialize garbage Collector
@Deepak:
Garbage collector keeps running as a background thread, to Excecute it Forcefully we need
to use GC.Collect(); Method.
Correct Me If I am Wrong.
Post a Comment