Sunday, January 11, 2009

Asp.Net , C# and Sql One Line Question Ansewr

In One line answer Of Dot Net Question

Qut: Waht is Data Binding ?

Ans : Data Binding involves fetching the data from database and binging each row and colums from the data to the row and columns in control.

Que : Waht is the tag is used for the data bainding ?

Ans : Ans : The special <% # and %>tags delimit the data binding exprission .

Qut : Is every control has databind() method ?

Ans : Yes , It is a method of base control class used by both the web and html control .

Qut 4 : What is the advantage of Data binding ?

Ans : The advantage is that it helps to you achive a clear seperation b/w your control and code your code in a wev page.

Qut : What happen when we forget to call control's DataBind() method ?

Ans : If we forget to call the control's DataBind() method , the control will remain empty , and the information will not appear on the page.

Qut 6 : Specially for which control Data binding is sesigned ?

Ans : The control like DataGrid , GridView , Datalist , Detail View , FormView and Repetar is designed for data binding .

Qut 7 : Which property and mathod are used by control for data bainding ?

Ans : Controls that support databinding exposed a property named :

DataSource (Property)

DataBind (Method)

Qut 8 : Is it possible to bind data to the text box ?

Ans : Yes

Qut 9 : What is .NET Framwork ?

Answer : The .Net Framework is a managed , type safe environment for developing and executing appications.

Qut 10 : What is the main two compaonat of the .Net Framework ?

Ans : Comman Language Runtime (CLR)

Class Libraries

Qut 11 : What is the CLR ?

Ans : CLR (Commann Langguage Runtime) is described as the "Execution Engine" of the .net .

Qut 12 : What is class libraries ?

Ans : Class libraries consists of lots of prewritten code . The code for all the elements like forms , controls

actualy comes from the class library .

Qut 13 : What is CLS (Comman Language Specification) ?

Answer : The cls describe a set of rules (features) that different language have in common .

Qut 14 : What is Web services ?

Ans : Web Services are the applcation that run on web surver and communicate with othe application . It uses

different or seried of protocols to responds to different request. The protocols are UDDI , WSDL , SOAP , XML , Http

, Smtp .

Qut : 15 : What is the Meaning of UDDI , WSDL , SOAP ?

Ans : UDDI (Univarsal Discovery and Description Language)

WSDL (Web Services Description Language)

SOAP (Simple Object Access Protocol )


Qut 16 : What is managed code ?

Ans : Managed code is IL (Intrmidiate Language ) which C # compiler produce . It is not machine code taht runs

directly . But Intermitiate code (IL) that is stored in the Assembly and handled by CLR (Comman Language Runtime).

Qut 17 : What is Unmanage Code ?

Ans : This code is machine executable code that execute directly without being manupulate by CLR (Comman Language

Runtime)

Qut 18 : Is IL (Microsoft Intermidiate Language) code is mannaged code ?

Ans : Yes .

Que : 19 : Is managed code is plateform Indepandent ?

Ans : yes .

Que : 20 : What is the advantage of Managed Code (IL) ?

Ans :Managed code has a big advantage over unmanaged code in terms of plateform depandancy .

Que 21 : What is Assembly ?

Ans : Assemby is self describing instalation unit . It may consists of more than one dll or exe . Assemby contan

manifist. Manifeat cantain metadata . All the Assemblies contan - the definition of tupes , version information of

version , meta-data , and manifiest .

Que 22 : How many Types of Assembly >

Ans : Assemby are two types :

Private

Shared

Que 23 : What is the namespaces ?

Ans : A namespace is collection of differnt classes .

All the C# application are developed by using classes from the .Net System namespace .

All other namespaces are based on the This System namespaces .


Que 24 : What is view ?

Ans : A View is a virtual tables , which consites of a subset of columns from one or more tables .

Que 25 : What is the advantage of View ?

Ans : View is used for data security reasion , when view is used to manipulate table data , the underline base table
will be complitely invisible . This will give the label of data security .

Que 26 : How many types of view ?

Ans : There differnt types of view :

Read-Only View

Updatable View .


Que 27 : Can we use order by clause when creating view ?

Ans: The Order by clause can not be used while creating a view .

Que 28 : Can record be Updated or deleted with the help of view ?

Ans : Yes , The user can update and deldte records with the help of view even if the primary key columns and NOT

NULL columns are execluded from the view definition (On single table) .

Que 29 : Can record be inserted with the help of view ?

Ans : Yes , It user wants to insert record with the help of view , then the Primary keyb columns and all the NOT

NULL columns must be included in the view . With some exception , we can also parform database operations INSERT ,

UPDATE and DELETE with single - table database views .

Que 30 : What is the syntex of destryin the view ?

Ans : The Drop viw command is used to remove a view from a database .

Drop view vw_client .

Que 31 : Why View is called Virtual ?

Ans : A view is not stored as phisical table , only its definition is stored . For this reasion , view are called

virtual table .

Que 32 : What is the two reasion for using the view ?

Ans : There are main two reasion to use view :

Securty

Conviniance.

Que 33 : What is the FindControl() ?

Ans : Static page.findControl() method , which search the entire page for control with the ID we supplied .

Que 34 : Every Codebehind class is explictly derived from ?

Ans : Every codebehid class is explictly derived from :

System.Web.UI.Page class .

Ans 35 : What is Page Class ?

Ans : All the forms are actually insance of the Asp.Net Page Calss , which is found in the System.Web.UI.Page class.

Que 36 . What is the Stored Procedure ?

Ans : Stored Procedure is Precomplied database object . Precomplied means that procedure is comlied beforhand and is

readily avalable for execte. As a result , time is not spent at all in parsing and compling the procedure again.


Que 37 : What is the adwantage of Stored Procedure ?

Ans : Advantage of S.P. :

Improve performance

Reduce Network Congetion .

Que 38 : How S.p. Improve Performance ?

Ans : Application do nat have to compile the procedure over again and again .

Que 39 : How S.P. Reduce Network Congetion ?

Ans :


Que 40 : How many maximum number of parameters are allowed in a S.P. ?

Ans : 1024 .

Que 41 : How S.P. send and reveive data ?

Ans : A S.P. recives and send data through the folloeing :

Input parameters

Output parameter

Return code

Que 42 : How many types of S. P. ?

Ans : Vaires types of s.p. are :

User Defined

System Defined

Temprorey (prefix with # symble)

Remote

Que 43 : Give the list of object which can not be created within a stored procedure (restriction taht apply on S.P.) ?



Ans : The following object can not be created within a stored procedure :

Default

Triger

Procedure

View

Rule

Que 44 : What are Trigar ?

Ans : Triggers are special type (kind) of stord procedure that gets executed automatically when an INSERT , UPDATE

and DELETE statement (operation) takes place on a table .Trigaers are invoked (fired) automatically by Sql Server

when any modification statement is issued .

Another Definotion of Triggers :

A trigger is always defined on a table , and is said to be fired whenever the data in the underline table is

affected by any of the Data Manulation Language (DML) statement - INSERT , UPDATE and DELETE.

Que 45 : How many trigger can be define par table ?

Ans : In Sql 6.5 you could define only 3 triggers per table , one for Insert , one for Update and one fpr Delete.

Foom Sql Server 7.0 onwords , this restriction is gone ,and you could create multiple triggers per each action .

Que 46 : What is the difference between S.P. and Trigeres ?

Ans : It can't be explicitly invoked or executed as in the case of S.P. . It is invoked automatically (implicitely)

Que 47 : How many level triggers are nested ?

Ans : Triggers are nested 32 levels .

Que 48 : Why triggers are used ?

Ans :Triggers can be used to enforce the business rules and data intigrity . It privent incorrect , unauthorized or inconsistant change data .

Que 49 : What is the Characteristics of the triggers ?

Ans : Itv can only be associated with table .

It can not retun data to the user .

Que 50 :Can triggers be defined on temprory table or view ?

Ans : It can not be defined on a temprorary tabales or views . However , a triggers can reference temprorey tables and views .



Que 51 : What are cursor ?

Ans : Cursor allow row by row processing of The resultsets.

Que 52 : How many types of cursors ?

Ans : Cursor are 4 types :
Static
Dyanamic
Forword-only
Keyset-Driven


Que 53 : What are disadvantage of cursor ?

Ans : Eatch time you fetch a row from the cursor, it result a roundtrip ,where as normal SELECT statement (query) makes only one roundtrip ,however large the large resultset is. Cursor are also castoly because they requre more resources and tempory storage.

Que 53 : What is roundtrip ?

Ans : When a user submit a page , the page is posted back to the web server for server-side processing. After the processing the processing is done on the web server ,the page is sendback to the client. This sequece is called round trip.

Que 54 : What is directive ?

Ans : A directive specify how an Asp.Net page is complied .

Que 55 : What is native code ?

Ans : Native code is the code that has been complied to CPU specific machine language.

Que 56 : How does assembly versoning in .Net prevent DLL hell ?

Ans : .Net allows assemblies to specify the name and the version of any assemblies they need to run .

Que 57 : What is cookies ?

Ans : Cookies are small text file. A small amount of inforamation sent by web server to the web browser , saved by browser, and sent back to the server.

Que 58 : What is the order of event in yoru page ?

Ans : Init ()
Load ()
Prerender ()

Unload ()

Que 59 : How can we kill a user sessoion ?

Ans : call session.abandan .

Que 60 : What is the DLL hell problem ?

Ans : 1. Copy the dll (C:\my COM /calc.dll)
2.Register it (regsve32 )
3. Registry entry ( OS - it is part of OS )


Que 61 : What is the reasion of DLL hell ?

Ans : 1.Identy (GuID)
2.Registry Intraction
3.Every COM is titely coupled with OS.


Que 62 : What is the .Net Solution of DLL hell ?

And : 1. No registary intruction (Only copy and pest ) . It never goed to registory .
2..Net assemblies are loosley coupled whit OS .
3. Identity (Name ,Culture, Strong Name, Version) .


Que 63 : What is parser error ?
Ans : Its basically syntax error in your aspx page .

Que 64 : What is caching ?

Ans : Caching is technique of storing an in-memory copy of some information that is expencive to create .

Que 65 : How many attribute in form tag ?

Ans : < method="" action="">
There are two attribute of Form tag :
Action
Method


Que 66 : What is the Method ?

Ans : Method is way to sent the data . There are two option - Post and Get .

Que 67 : What is the Action ?

Ans : Action is used to specify the address where you want to send the data .

Que 68 : What is the use of using GET method ?

Ans : We can use get method when we have to Use as a book mark .

Que 69 : How many character are show in URL by Get method ?

Ans : Limited no of character ( 256-249 ) .
Sped
Limited no of character.


Que 70 : Which machanics is used in .Net POST or GET ?

Ans : It is POST method .

Que 71 : What is the advantege of POST method ?

Ans : Data is never visible in the URL .
Post method is slower .
Post method has huge data .


Que 72 : What does the URL ?

ANS : URL loads your data .

Que 73 : What the meaning of Page Navigation ?

Ans : The page navigation means going from one page to another page .

Que 74 : Why used POST rather than GET in Asp.Net ?

Ans : Since GET shows only limited no. of character in the url about 256. and these queries add more than 256 character and there is no problem in POST method becaues Post METHOD has huge data .

Que 75 How : How can u create an event handler ?
Ans : Double click the Button to create a new event handler method .

Que 76 : Waht does Asp.Net when we use Server control at runtime ?
Ans : ASP.NET generates HTML code for you at runtime when you use server controls.

Que 77 : What is The ID of Server control ?
Ans : The ID is what you use in the C# source code behind .cs file to reference a control on a web form.
When you drag a control onto the web form, the IDE creates a default ID for your control .


Que 78 : What is Event Handler Method ?
Ans :An event handler method is a special type of Method in an ASP.NET web page that defines the actions that will occur when a particular event occurs.

Que 79 : What is event driven programming model ?
Ans : ASP.NET uses an event driven programming model. This means that in order for code to run, an event must occur that triggers or tells ASP.NET to run an event handler Method.

Que 80 : Explane Button1_Click ?
Ans : We saw that if you are in the Design view for a web form and you double click on a Button control, Visual Web Developer will automatically generate an event handler Method called Button1_Click. Basically an empty Method is
generated and Visual Web Developer lets you put whatever code you want into that event handler. Notice the naming
convention that Visual Web Developer when it generates the event handler Method. The first part of the name is the
ID for the server control: Button1. The second part of the name an underscore appended with the event type: Click.

Que 81 : Give example of Event Handler Method ?
Ans : event handler Method called Button1_Click .

Que 82 : What is Requred field validation ?
Ans : ASP.NET offers the RequiredFieldValidator control to ensure that mandatory fields are filled in.(i.e. fields that must be filled out)

Que 83 : What is benifit of VAlidation Control ?
Ans : Validation controls do not require any coding, thus saving time performing redudant tasks.

Que 84 : What are the property of RangeValidator control ?
Ans : ASP.NET offers the RangeValidator control to ensure that fields follow range rules.
The ErrorMessage property sets what error text will be displayed in case the validation fails. The MaximumValue property sets the largest possible value in your validation rule that is acceptable.
The MinimumValue property sets the smallest possible value in your validation rule that is acceptable
Type property lets the validator know what type of data will be validated: String, Integer, Date, etc.

Que 85 : Why we use The ControlToValidate property ?
Ans : The ControlToValidate property sets which server control to examine at runtime to see if it follows the rule.

Que 86 : What is ccs. ?
Ans : Cascading Style Sheets are text files with a .css extension.
These files contain a list of styles(style means font , size and colour ) that are defined for an application.

Que 87 : What is the style ?
Ans : A style is a descriptor that defines how an object in a web page should look and how it should be layed out within the page.

Que 88 : Give one exp of style ?
Ans : For example, with a style you can define that the font size for text box should be 12 point and it should be left aligned. Applications typically contain many styles for various objects in a web application .

Que 89 : What is the Redirect Method ?
Ans : ASP.NET gives you access to a special object called the Response object. The Response object contains a method called Redirect that you can use to perform the redirection to another web page. You should pass the name of the web page to the Redirect method as a string parameter.
Response.Redirect("Page2.aspx");
Redirect()
This method transfers the user to another page in the application or to a different web site.

Que 90 : What is the Redirect means ?
Ans : A redirect simply means you are sending a message to the browser, telling it to visit a different web page.

Que 91 : What is the session object ?
Ans : There are also situations where you may want to store information in the Session that is shared among ALL web
pages in your ASP.NET application.
The Session object is similar to a Dictionary object as it contains key/value pairs.

Que 92 : Give the example of Session state ?
Ans : In the example for this lesson, I setup a web form called Page1 that contains some TextBox controls to allow
the user to type their name and credit card information. When the user clicks the Next button, I store the
information entered into the Session object and redirect the application to another web form called Page2 (which is
a confirmation page).
Session["FirstName"] = txtFirstName.Text; Session["LastName"] = txtLastName.Text; Session["CreditCardNumber"] = txtCreditCardNumber.Text; Session["ExpirationDate"] = txtExpirationDate.Text; Response.Redirect("Page2.aspx");
Session["FirstName"] = txtFirstName.Text;Session["LastName"] = txtLastName.Text;Session["CreditCardNumber"] = txtCreditCardNumber.Text;Session["ExpirationDate"] = txtExpirationDate.Text;
Response.Redirect("Page2.aspx");On the Page2 confirmation page, I read back the variables from the Session object and display them on the web page.
txtFirstName.Text = Session["FirstName"].ToString(); txtLastName.Text = Session["LastName"].ToString(); txtCreditCardNumber.Text = Session["CreditCardNumber"].ToString(); txtExpirationDate.Text = Session["ExpirationDate"].ToString();
txtFirstName.Text = Session["FirstName"].ToString();txtLastName.Text = Session["LastName"].ToString();txtCreditCardNumber.Text = Session["CreditCardNumber"].ToString();txtExpirationDate.Text = Session["ExpirationDate"].ToString();

#################################################################################
Useful Link http://www.csharpuniversity.com/category/beginning-web-programming/ I LOVE THIS WEB SITE
2 . http://www.csharpuniversity.com/category/getting-started-with-the-language/
3. http://www.csharpuniversity.com/category/classes-and-objects/
4. http://www.csharpuniversity.com/2008/10/12/creating-and-using-methods/
5 .http://www.csharpuniversity.com/2008/12/27/using-the-aspnet-gridview-control-to-query-a-sql-server-database/
6 . http://www.csharpuniversity.com/category/mid-level-aspnet/
I WANT TO MAKE MY OWN KEY FOR ANY SUBJECT TO OPEN THE LOCK OF THAT TOPIC
######################################################################################

Que 93 : Introduction of data type ?
Ans : This is important to understand because although the syntax of the C# language is different than VB.NET and
others, the data types used are the same. Every time you declare a variable type in C# like “int” for example, you are really declaring a .NET Framework type called Int32, which is a large 32 bit signed integer number.

Que 94 : What is the meaning of // ?
Ans : The // tells C# that you are putting a comment into the program. A comment is simply notes or comments that are ignored by the compiler .

Que 95 : What are the methods ?
Ans : Methods are blocks of code that perform some actions and can return back a result . Methods are also called Functions or Procedures in other languages.

Que 96 : What will happen when we will not use return in method ?
Ans : Since I declared that my Method will return a number, it is mandatory that I have a “return” statement in my
Method. If I don’t put a “return” statement, the source code compiler will throw an error.

Que 97 : Is every thing is built around Classes in c# ?
Ans :In C#, almost everything is built around Classes, even some of the language data types such as String, which is actually a Class called System.String.

Que : How to call a class ?
Ans : In order to call a Class you first have to Instantiate an Object of the Class. This terminology means that you have to declare a variable with the type set to your Class name.

Que 98 : What is DataSet ?
Ans : A DataSet is a set of rows that can hold data in memory.A DataSet has columns, just like a database table. The DataSet was purposely designed to be disconnected from the database.

Que 99 : Why we use System.Data.SqlClient namespace.?
Ans : That namespace contains connection and query oriented classes.

Que 100 : Waht is the use of SqlConnection class ?
Ans : There is a class called SqlConnection that allows you to open a database connection to SQL Server.
Que 101 : For which purpose SqlDataAdapter class ?
Ans : The SqlDataAdapter class is responsible for executing the queries.

Que 102 : What is the use of " using " block ?
Ans : I created a special block of code called a “using” block with open and closed curly braces. The using statement is used in situations where you want .NET to automatically close a resource when you are finished using it.

Que 103 : What does the "using " block ?
Ans : The using statement block will make sure that the dbconn object is available until the closed curly brace. After the closed curly brace, the dbconn object isn’t available for use anymore.

Que 104 : What is the method of SqlDataAdapter ?
Ans : Fill is the method SqlDataAdapter .

Que 105 : What is the meaning of this - dbadapter = new SqlDataAdapter("select * from Customer", dbconn);
Ans : Inside the using statement, I first instantiate the SqlDataAdapter object and call the constructor method.
The constructor takes two parameters: a string containing the SQL query you want to execute and an SQLConnection
object (dbconn) that tells .NET which database to execute against.

Que 106 : What is the meaning of this - dbadapter.Fill(dbdata);?
Ans : I call a special method of the SqlDataAdapter object called Fill. Fill allows you to take the results of the query and store them in a DataSet object which is dbdata in my example.

Que 107 : Explane me thies lines accordingly to the c# concept ?
DataSet dbdata = new DataSet();
dbadapter = new SqlDataAdapter("select * from Customer", dbconn); dbadapter.Fill(dbdata);
Ans :

Que 108 : What is the meaning of thies two lines ?
Ans : Once I have the DataSet object populated with data from the database, there are many things that I can do with it. In this example, I am displaying the data in an ASP.NET GridView (similar to an HTML table tag) control. In
order to achieve this, I have to perform data binding. In .NET data bound controls are basically server controls
like a GridView that have a DataSet object assigned (bound) to them. Once a DataSet is bound to a server control,
the server control (e.g. GridView) can display the data that is in in the DataSet on the web page. For a GridView
control, this is very easy and only takes two lines of code. First you have to assign the GridView’s DataSource
property to a DataSet object that contains data. Then you call the GridView’s DataBind method to let ASP.NET know
that you want to display the data.

Que 109 :Why we do AutoGenerateColumns property of the GridView to False. ?
Ans : Normally when you use a GridView control, it will show all the columns in the associated DataSource. The GridView also displays the column names as the header for the grid on the web page.
In a real world scenario, you probably are going to need more control over what is displayed in your grid. The way
to achieve this is to set the AutoGenerateColumns property of the GridView to False.
When you do this, it lets ASP.NET know that you are going to manually define how you want the data displayed in your grid .

Que 110 : What is meaning of BoundField ?
Ans : A BoundField means that you are creating a display field that is “bound” to a column in the DataSource.

Que 111 : Waht does HeaderText property ?
Ans : The HeaderText property gives you the ability to control what shows up as the header for each grid column.
Notice that even though my query is returning more than two columns from the database table, I am only showing two
of them on the web page.

Que 112 : Why Debugging and Tracing are used ?
Ans : "Debugging and Tracing" feature are used for sorting and fixing errors .

Que 113 : What is the method used in Classic Asp ?
Ans : In classic ASP, using Response.Write method we can display an error message .

Que 114 : Whaat is the drawback of using Response.Write method in asp ?
Ans : Although it is easy to use, it has some drawbacks. Before deployment we have to remove or comment out all those Response.Write statement wherever we have used in the application. We cannot forget to remove or comment out any such statement that can be visible to end user/client.

Que 115 : What is round trip ? and it is alwaysing confusing for me ?
Ans : To Understad Round trip by one example you can understand it properly . By Using Response.Redirect() and
Server.Transfar(). Response.Redirect requires a round trip between the browser and the server, but allows the user
to see the new URL in the browser address bar.Server.Transfer is a quicker approach in that ASP.NET simply loads the
specified page without the round trip. As a result, the browser’s address bar is not changed.

Que 116 : Why we inherite System.Web.UI.Page class in our cs file ?
Ans : By using this we can directly use the page class objects like - 1. Session
2. Application
3. Cache
4. Request
5. Response
6. Server
7. User
8. Trace

Que 117 : What is the meaning of Credintials ?
Ans : Credentials means loging and password .

Que 118 : What is the IsPostBack ?
Ans : IsPostBack is the property of the page ,IsPostBack gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time .
Que 119 : What is the IsValid ?
Ans : IsValid is the property of the page , IsValid gets a value indicating whether page validation succeeded .

Que 120 : What is the EnableViewState ?
Ans : EnableViewState is the property of the page , gets or sets a value indicating whether the page maintains its view state .




1 comment:

Anonymous said...

Genial fill someone in on and this enter helped me alot in my college assignement. Thanks you for your information.