Wednesday, December 31, 2008

Interview Questions - Part 5

Interview Questions
------------------------

46. What is a command object?
a.) This is used to perform the required operations on the database. A command object contains 2 arguments. First argument specifies the sql statement or stored procedure to be executed on the database and second argument specifies the connection object. First argument, if it is a sql statement, it can be a select, update, insert or delete. If we want to use a stored procedure we should specify its name as the first argument of the command object. Command object is generally used along with the Data Reader.

47. Why we use ExecuteNonQuery method?
a.) This is the method of the connection object. This is used when you use a stored procedure. This won’t return any data from database, simply executes the procedure.

48. What is a DataAdapter?
a.) Dataset can’t communicate directly with the database. So, in order to communicate with the database it makes use of DataAdapter. This acts as a bridge between dataset and database. It contains 2 arguments. First argument specifies the sql statement , and 2 argument specifies the connection object. It can perform all the DML operations.

49. What is the method used by dataadapter to fill the dataset?
a.) It uses Fill() method to fill the dataset with data from database.

50. what are the differences between datareader and data adapter?
a.) DataReader:
1.It supports connected model
2.It is used to retrive a forward only read only stream of data from data source.
3.performance is more
4.It can not perform insert, delete or update operations
DataAdapter:
1.It supports Disconnected model
2.It acts as a bridge between dataset and database
3.performance is less when compared to datareader
4.It can perform insert, delete and update operations

51. How many templates are there in Repeater control?
a) 5 Templates are there
1. ItemTemplate
2. AlternatingItemTemplate
3. HeaderTemplate
4. FooterTemplate
5. SeparatorTemplate

52. What are the disadvantages of Repeater Control?
a )
1. It does not contain predefined layout.
2. It produces readonly output
3. It does not support user selection and editing of data
4. No inbuilt support for paging and sorting

53. How many templates are there in DataList Control
a ) 7 Templates
1. ItemTemplate
2. AlternatingItemTemplate
3. HeaderTemplate
4. FooterTemplate
5. SeparatorTemplate
6. SelectedItemTemplate
7. EditItemTemplate

54. What is the use of alternatingItem Template?
a ) This is used to apply alternate color scheme in Datareader and DataList server controls.

55. How many columns are there in DataGrid Control
a ) 5 columns
1. Bound Column
2. Button Column
3. Edit command column
4. Hyperlink Column
5. Templated Column

Monday, December 29, 2008

Interview Questions - Part 4

Interview Questions
--------------------------------

36. what are the differences between Ado and Ado.net
a.) Ado:
1. It supports connected model
2. xml support is less
3. It uses record set
Ado.net
1. It supports disconnected model
2. xml support is more
3. it uses data set

37. What are the basic objects needed for Ado.Net
a.) There are 5 main objects.
1. Connection object: used to open a connection to the database
2. command object: used to perform operations on database
3. datareader object: used to read data in forward only read only manner from database
4. DataAdapter: Acts as a bridge between Dataset and Dataset
5. Dtaset: In-Memory container for all your data.

38. What are the arguments of a connection object?
a.) 1. server : this is used to specify the server name.
2. InitialCatalog: This is used to specify the database name
3. usedID: specifies the user id
4. password: specifies the user password.

39. Which method is used to release resources on connection object?
a.) Dispose() method.

40. What are the namespaces required to use Ado.net
a.) System
System.Data
System.Data.SqlClient (or) System.Data.OleDb (OR) system.Data.Odbc (OR) system.Data.OracleClient.

41. What is a Dataset?
a.) Dataset is a simple, in-memory data store for your data. It contains data, constraints on data, and relationships between data. It supports disconnected model, means connection is opened when the request is made and it closes when request is served with response. It can contain data from more than one table or database.

42. Why we use AcceptChanges method ?
a.) This is the method used by Dataset to commit the changes done by DML statements.

43. What is Getchanges method?
a.) This is used to get only those rows which have been modified. This can be used on a datatable or dataset.

44. What is a DataReader?
a.) DataReader is used to read data in forward only and read only manner.
Read() method is used to read data from database using datareader. They support connected model. Performance is more as they read data in forward only and read only manner. It can’t read data from more than one table at any point of time.

45. What are the methods we can apply on dataReader?
a.) 1.Read(): used to read
2.Close(): Used to close datareader
3.IsClosed(): used to check whether datareader is closed or not
4.HasRows(): used to check whether there are rows or not
5.NextResult(): with this we can execute a set of sql statements

Tuesday, December 23, 2008

Interview Questions - Part 3

Interview Questions
----------------------------

26. How many types of assemblies are there?
a. 2 Types.
1. Private assemblies: which are used by only one application and are placed in the application's directory
2. shared assemblies: which are shared by many applications and are placed in machine wide code cache called global assembly cache.

27. What are main contents of an assembly
a. They are 4 contents
1. assembly manifest
2. Type metadata
3. msil that implements types
4. list of resouces

28. What is an assembly manifest?
a. Assembly manifest is main part of an assembly. it is used to store information about metadata like version information, security information, types info, scope of assembly etc.

29. What are the contents of an assembly manifest?
a. It contains name of the assembly,version information, culture information, strongname information, type reference information, list of files in assembly, and list of other assemblies

30. What is a global assembly cache?
a. Using this you can place assemblies at one common place. this common place is known as global assembly cache. the advantage of this global assembly cache is that the assemblies placed in this common place can be shared by many applications. they are not restricted to a particular application. they can be shared by any application. when you place an assembly in to global assembly cache that assembly should have a strong name. Global assembly cache is placed in the subdirectory of the systemroot directory.

31. What are the ways to keep assemblies in to global assemby cache?
a. 3 ways.
1. using windows installer
2. using global assembly cache tool
3. using windows explorer

32. what is advantage of windows installer ?
a. This should be used in the deployment time. this provides reference counting of an assembly.

33. what is a strong name?
a. when you want to place assembly in global assembly cache you should give strong name to that assembly. It contains assembly name, its version, public key and digital signature.This is used to uniquely identify an assembly, and to perform integrity checks on assembly. It ensures that no one can create a subsequent version of an assembly.

34. what are the advantages of global assembly cache?
a. 1. assemblies placed in GAC can be shared by multiple applications.
2. It provides security.
3. It provides a way to keep multiple versions of same assembly on the same machine.

35. can we place the contents of an assembly into different files?
a. Yes.

Monday, December 22, 2008

Interview Questions - Part 2

Interview Questions
--------------------------
16. What is Global.asasx file?
a. This file contains application and session level events. It is an optional file. It is placed in the
root directory of the application.

17. what is the difference between inline and code behind models?
a. In inline model server code is written along with the html code.
in code behind model server side code is written in separate file having .aspx extension.

18. How many types of validation controls are there in asp.net?
there are 6 types of validation controls are there.
1.RequiredFieldValidator:
Used to ensure that there is an entry for a specified field.
2. CompareValidator:
Used to check users entry with a constant value or value of another control
3. RangeValidator:
Used to check whether users value is with in the specified range or not.
4. RegularExpressionValidator:
Used to check users entry against a pattern specified by regular expression.
5. CustomValidator:
Enables a user to specify his/her validation logic
6. ValidationSummary:
Used to display all the error messages at one place in a web page.

19. which directive do we use to add a custom or user control to a web page?
a. We use @Register control.

20. What is the extension and namespace for user controls?
a. User controls have .ascx extension and namespace is System.Web.UI.Usercontrol

21. What are master pages?
a. Master pages provide a uniform layout for all pages in your application. They are used to
create same look and feel for all pages.they provide a template which can be used by any
number of pages in an application. They have .master extension.

22. Is it possible to nest master pages?
a. Yes.

23. What is a wizard control?
a. This provides a way to create a sequence of steps which can be used by the user. This
control is useful in suituations where you want to split the information in to steps.
for ex. When you are registering in to any web site we can divide the information
collection process from the user in to 3 steps, step1 for login information, step 2 for
personal inrmation and step 3 for address information.

24. what is the method used to set focus on any control?
a. We use Focus() method.

25. what is smart navigation?
a. 1. It maintains same scroll position during postbacks.
2. used to keep element focus during navigation
3. used to minimise flash during navigation
4. only the most recent web page state is retained in the browsers history folder.

Wednesday, December 17, 2008

Interview Qusetions - Part 1

Interview Questions
---------------------------

1. What is a private assembly?
a. An assembly which is used by only one application and which is placed in the installation directory of an application.

2. what is MSIL?
a. When we compile a c# program or any other program written in .net complaint languages, the source code is compiled in to MSIL. It is an instruction set in to which all .net prgrams are compiled and which is used by the CLR. It contains instruction for loading, storing, initializing, and calling methods.

3. What is CTS?
a. CTS means common type system. It defines how types are declared, used and managed in the runtime. This supports a variety of types and operations found in most of the programming languages and therefore calling one language from another does not require type convertions.

4. What is CLS?
a. CLS means common language specification. This enables interoperability in the .net platform.

5. What is JIT?
A. It is a compiler that converts MSIL to native code.

6. why do we use namespaces?
a. Namespaces are used to organise the code and to create globally unique types to avoid name collisions.

7. What is web farm?
a. Asp.net runs with in a process known as asp.net worker process. All asp.net functionality runs with in the scope of this process. A regular web server contains only a single asp.net worker process. A web farm contains multiple asp.net worker processes. Generally normal(small) web sites uses a single web server to satisfy the user requests. but a web farm(larger web sites) uses one or more seb servers to satisfy the user requests.

8. What is Globalization?
a. It is the process of design and development of applications that serve multiple cultures.

9. What is Localization?
a. It is a process of customizing an application for a given culture and locale.

10. What is a Thread?
a. A thread is a basic unit to which operating system allocates processor time. One process can have more than one thread. Each thread maintains exception handlers, scheduling priorities, and a set of structures the system uses to save the thread context until it is scheduled.

11. Differences between managed code and unmanged code?
Managed code:
1.It is executed under CLR.
2.It compiles to intermediate language
3. it provides services like security, exception handling, garbage collection etc
4. It can access both managed and unmanaged data
unmanaged code :
1. It is not executed under CLR.
2. It compiles directly to machine code.
3. It doen not provide security, exception handling, garbage collection etc
4. It can access only unmanaged data.

12. What is a bin directory?
a. It contains precompiled assemblies. this is useful when you need to use code that is possibly written by someone else where you don't have access to the source code but you have a compiled dll instead.

13. What is the use of enableviewstatemac property?
a. This is the attribute of a @page directive. This is used to check whether the view state has been tampered or not.

14. How to change a master page during rntime?
a. This is possible in the PreInit() event by setting MasterPageFile property to .master page.

15. What is serialization?
a. It is a process of saving the state of an object by converting it to a stream of bytes. the object can then be persisted to a file, database, or even memory.

Thursday, December 11, 2008

State Management in Asp.Net

Server side state management (Part-3)

In this type state information will be stored on the server side.

1. Application state: It is used to store application specific information. This is stored in the server memory. Information stored in application state is common to all users and all sessions. Generally data which does not change often is stored in the application state.

Advantages:
a) As it is common all sessions we can keep a single copy.
b) Easy to implement
Disadvantages:
a) We lose data stored in application state when the web server process Containing it is destroyed.
b)As values stored in application state is particular to one process other
Processes can’t use those values.
c) As it requires server resources it may effect the performance of the server
And the scalability of the application

2. Session State: It Contains Session specific information that needs to be maintained between multiple page requests and server round trips. A session starts when the user enters in to the web site and session ends when he/she leaves the web site( which is called user’s. session). So, Session state object is used to maintain that particular session values. If there are multiple users for a web site then each one will have their own session. Generally session state is used to store data which is sensitive and which changes frequently. It can configured in web.config file.

Advantages:
a)Easy to implement
b)Session state is suitable for multi computer and multi process settings.
c) We can use session with cookies or without cookies
Disadvantages:
a)As it is specific to a particular user session we need to maintain multiple Sessions for multiple users.
b)As it requires server resources it may effect the server performance.


3. Database support: This is mainly used in cases where you want to store more amount of information. Using this method for each request your application contacts the database.

Advantages:
a) We can store large amount of information
b) It provides more security
c) Using this option we can store data for longer time
d) It provides data consistency
Disadvantages:
a) As this stores state information in database it effects server performance.

State Mnagement in Asp.Net

Client side statemanagement (Part-2)

1. View state: It is a in built structure for maintaining the state of a page. Its purpose is to keep the state of controls during subsequent post backs by the same user. It indicates the state of an object at that particular instant of time. It is maintained using hidden fields.

Advantages:
a) As it is a client side technique it does not require server resources
b) It is a in built structure
c) It is little secured as the values in view state are hashed, compressed and encoded
Disadvantages
a) As view state is stored in the page itself, if we store more information in view state it affects the performance of the page
b) As view state is stored in the page itself we can view its contents when we view the source code.


2. HiddenFields: This is used to store page specific information in hidden fields.
This used to store values in html form with out displaying it on the browser.
We can use these for the page which post backs to itself or to another page.

Advantages:
a) As it is a client side technique it does not require server resources.
b) Most Browsers support this technique
Disadvantages:
a) As Hidden Fields is stored in the page itself, if we store more information in
Hidden fields it affects page performance
b) Security is less as users can view the information in hidden fields when they
Open the source code.

3. Cookies: A cookie is a file stored on users computer containing information Specific one site. Values stored in a cookie are sent to the same server with every page request through browser. Means they are posted back and forth on every request. Generally frequently changing information will be kept in a cookie. Default life time of a cookie on user s machine is 100000 minutes.

Advantages:
a) It does not require server resources.
b) It is very simple to implement
c) Cookie can expire when browser session ends or it can stay permanently till we apply some expiration rules.
Disadvantages:
a) Security is less as users can manipulate cookies on their machines.
b) Most Browsers allows only cookie with a max size of 4096 bytes
c) As there is security threat some users may disable their machines capability of receiving cookies thus reducing its functionality.

4. Query Strings: Query string is the information which we see at the end of the pages Url. Generally it is used to place navigation specific information.
We can’t keep sensitive information using query string.

Advantages:
a) It Does not require server resources
b) It is very easy to implement
c) Most Browsers support this feature
Disadvantages:
a) There is a security risk as it is visible in the browsers address bar.
b) Using query strings we can’t place more information.(2083 character limit)

5. Control State: This is used to store custom control data between server trips.
This is used to store small amounts of information of a control between server trips.
By default it is stored in hidden fields on a page.

Advantages:
a) server resources are not required
b) Easy to implement.
c) We can’t turn off control state at the page level. So, it is more reliable
Disadvantages:
a) To use this we need to write code for saving and loading of control state.

Wednesday, December 10, 2008

StateManagement in Asp.Net

State Management in ASP.NET (Part-1)
------------------------------------------------

State management is a process through which you can maintain the page information over multiple requests for the same page or different page.
Earlier, in ASP, if you submit a form with values and come back to it later you will get the form without values. Sometimes you may submit a form with huge information in these situations if the server comes back with an error you need to fill the entire page or form once again. It’s tedious task. All this is because of lack of state management.
But, In Asp.Net There are many ways to keep track of page information or state.
Means if you submit a form with values and come back to it later the values will still be there. You need not to fill the page once again.

There are 2 types of state management techniques
1.Client side state management
2.Server side state management

1.Client side state management
In this type page information is stored on the client side. There are different ways to maintain state on client side
View state
Hidden fields
cookies
query strings
control state
2. server side state management
In this type page information is stored on the server side. Here also you have many techniques to maintain state.
Application state
Session state
Profile properties
Database

Tuesday, December 9, 2008

Asp.Net Page Life Cycle

Asp.Net Page Life Cycle
------------------------------
Page life cycle is the cycle through which a page performs a series of processing steps

There are mainly 10 events in asp.net 2.0 page life cycle
1. PreInit(): In this event we set master page and themes property dynamically
------------
and IsPostBack property is checked to determine whether this is a new request or postback request.
2.Init(): This is used to initialize control properities
--------
3.InitComplete():This is used to perform tasks which need initialization be complete
-----------------
4.PreLoad(): This is used to load viewstate for the page and its contents.
-------------
5.Load(): This is used to establish database connections and to set control properties
------------
6.LoadComplete():This is used to Perform tasks which need loading be complete
--------------------
7.PreRender():This is used to make final changes to the contents of page and its controls
----------------
8.SaveStateComplete():Before this event view state for the page and all its controls is saved.Any
------------------------
changes to the page or controls in this event are ignored
9.Render():During this event page calls Render() method on all its controls that writes out the
--------------
controls markup that is sent to the browser.
10.Unload():This event occurs for each control and for the page. This is used to make final
--------------
cleanup for specific controls such as database connections

Monday, December 8, 2008

Directives for Asp.Net Web Pages

Directives
---------------
Directives are used to specify the settings used by the page or usercontrol compilers to process pages or usercontrol files

There are 11 types of directives
1.@Page: This is used to define page specific attributes. It is used only in .aspx files
2.@Control: This is used to define Control specific attributes. It is used only in .ascx files
3.@Master: This is used to define masterpage specific attribute. It is used only in .master files
4.@Import: This is used to import a namespace in to the current page or usercontrol
5mailto:5.@Register: This is used to render usercontrols and custom server controls in to a current page or usercontrol
mailto:6.@Assembly:: This is used to link a page or usercontrol in to current page or usercontrol
8mailto:8.@Implements: This is used to implement a specific .Net framework Interface in to current page or usercontrol
9mailto:9.@Outputcache: This is used to apply cache techniques in to the current page or usercontrol
10.@MasterType: This defines a class or virtual path used to type the master property of a page
11.@Previouspagetype: This is used to create a strongly typed reference to the source page from the target of a cross page posting.

Sunday, December 7, 2008

Differences between Asp and Asp.net

ASP
----------
1. Asp supports interpreted model
2. In asp you must place all directives on the first line of a page with in the same delimiting block
3. Asp uses only 2 scripting languages vb script and java script
4. Asp has no inbuilt facility for Validation of controls. Developer has to write code for both client side and server side validation

ASP.NET
------------
1. Asp.net supports compiled model
2. In asp.net you can place directives at any place in .aspx file . But standard practice is to place them at the begining of the file
3. Asp.net is not constrained to 2 languages. we can use any .net complaint languages like c# vb.net etc
4. Asp.net inbuilt facility for validation of controls. There are a set of validation controls which are easy to implement.

Goals of Asp.Net 2.0

The Goals of ASP.NET 2.0
---------------------------
They are
1. Developer productivity
2. Administration and management
3. Performance and scalability

Developer productivity: Much of the focus of the asp.net 2.0 is on productivity. It achieved it by introducing new controls like Gridview, detailsview, masterpages, sitenavigation and etc.

Administration and management: Asp.net 2.0 now includes a Microsoft Management Console(MMC) snap-in that enables web application administrators to edit configuration settings easily.
This allows system administrators to edit the contents of the machine.config and web.config files directly from the dialog instead of having them examine the contents of an xml file.
In addition to this dialog, web or system administrators have a web based way called web administration tool to administer their asp.net 2.0 applications.

Performance and scalability: One of the most exciting performance enhancements of asp.net 2.0 is its Caching capability. It includes a feature called SQL Cache invalidation.
Before asp.net 2.0 it was possible to cache the results from sql server and to update the cache based on a time interval- for ex. every 10 sec so on. This means that the end user might see stale data if the result set changed sometime during 10 sec period. but by using asp.net2.0 new feature sql cahe invalidation the output cache is triggred to change when the result set from sql server changes.
In addition to this asp.net 2.0 now provides 64 bit support.This means that now you can run your asp.net applications on a 64 bit Intel or AMD processors.

Saturday, December 6, 2008

Hi To All
Well, this is my first post in my blog.
I would like to share my experiences with all of you.