You are on page 1of 23

ASP.

Net Interview Question and Answers


1. What is ASP.NET? ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server. ASP.NET provides increased performance by running compiled code. 2. What is the difference between Classic ASP and ASP.Net? ASP is Interpreted language based on scripting languages like Jscript or VBScript. ASP has Mixed HTML and coding logic. Limited development and debugging tools available. Limited OOPS support. Limited session and application state management. ASP.Net is supported by compiler and has compiled language support. Separate code and design logic possible. Variety of compilers and tools available including the Visual studio.Net. Completely Object Oriented. Complete session and application state management. Full XML Support for easy data exchange. 3. What is Difference between Namespace and Assembly? Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time. 4. What is the difference between early binding and late binding? Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding. 5. What is the difference between ASP Session State and ASP.Net Session State? ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm. 6. What is the difference between ASP Session and ASP.NET Session? Asp.net session supports cookie less session & it can span across multiple servers. 7. What is reflection? All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly. 8. What is the difference between Server.Transfer and response.Redirect? The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page. While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution. 9. What is a PostBack?

The process in which a Web page sends data back to the same page on the server. 10. What namespace does the Web page belong in the .NET Framework class hierarchy? System.Web.UI.Page 11. Whats a bubbled event? When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents. 12. What is the differences between Server-side and Client-side code? Server-side code executes on the server. Client-side code executes in the clients browser. 13. What is the difference between static or dynamic assemblies? Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. Dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. 14. What are the difference between Structure and Class? Structures are value type and Classes are reference type Structures can not have constructor or destructors. Classes can have both constructor and destructors. Structures do not support Inheritance, while Classes support Inheritance. 15. What is the differences between dataset.clone and dataset.copy? Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesnt copy the data. Dataset.copy, copies both the dataset structure and the data. 16. What is the difference between Custom Control and User Control? Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application. User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files. 17. What is the difference between ASP Session State and ASP.Net Session State? ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm. 18. What is ViewState?

ViewState is a .Net mechanism to store the posted data among post backs. ViewState allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required. 19. What is Authentication and Authorization? Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user. 20. What are the types of Authentication? There are 3 types of Authentication. Windows, Forms and Passport Authentication. Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users. Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site. Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across multiple Web applications. To use Passport authentication in your Web application, you must install the Passport SDK. 21. What are the different types of Validation Controls? There are six types of validation controls available : RequiredFieldValidator RangeValidator RegularExpressionValidator CompareValidator CustomValidator ValidationSummary 22. What is the Web User Control? Combines existing Server and/or HTML controls by using VS.Net to create functional units that encapsulate some aspects of UI. Resides in Content Files, which must be included in project in which the controls are used. 23. What namespaces are necessary to create a localized application? System.Globalization System.Resources 24. How to Manage State in ASP.Net? There are several ways to manage a state. ViewState QueryString Cookies Session Application

25. What are the different types of Caching? There are three types of Caching : Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance. 26. What is Side-by-Side Execution? The CLR allows any versions of the same-shared DLL (shared assembly) to execute at the same time, on the same system, and even in the same process. This concept is known as sideby-side execution. 27. How to view an assembly? We can use the tool "ildasm.exe" known as "Assembly Disassembler" to view the assembly. 28. Which are the namespaces that are imported automatically by Visual Studio in ASP.Net? There are 7 namespaces which are imported automatically. System System.Collections System.IO System.web System.web.UI System.web.UI.HTMLControls System.web.UI.WebControls. 29. What are the layouts of ASP.NET Pages? GridLayout FlowLayout. GridLayout positions the form object on absolute x and y co-ordinates of the screen. FlowLayout positions the form objects relative to each other. 30. What is Delegates? Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. Delegates are generally used as basis of events, which allow any delegate to easily be registered for as event. 31. What is a Namespace? What is the use of a namespace? Namespaces are logical grouping of classes and other types in hierarchical structure. Namespaces are useful to avoid collision or ambiguity among the classes and type names. Another use of the namespace is to arrange a group of classes for a specific purpose. 32. Whats the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"? Visual Studio uses the Codebehind attribute to distinguish the page source or programming logic from the design. Also the src attribute will make the page compile on every request. That is the page will not be compiled in advance and stored in the bin as a dll instead it will be compiled at run time. 33. What is datagrid?

The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data. 34. How do you hide the columns? One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a columns Visible property. 35. What are different types of directives in .NET? @Page @Control @Import @Implements @Register @Assembly @OutputCache @Reference 36. What data type does the RangeValidator control support? Integer String. Date. 37. What is cookies? Cookies are small pieces of text, stored on the clients computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then reuse it on each page if needed 38. How many classes can a single .NET DLL contain? It can contain many classes. 39. What methods are fired during the page load? Init() - when the page is instantiated. Load() - when the page is loaded into server memory. PreRender() - the brief moment before the page is displayed to the user as HTML. Unload() - when page finishes loading. 40. What is the difference between Value Types and Reference Types? Value Types uses Stack to store the data. where as Reference type uses the Heap to store the data. 41. What is the difference between Server-side scripting and Client-side scripting? Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading, etc. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript.

42. How do you create a permanent cookie? Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue. 43. Which method do you use to redirect the user to another page without performing a round trip to the client? Server.Transfer Server.Execute. 44. Which method do you use to redirect the user to another page without performing a round trip to the client? Server.transfer 45. What tag do you use to add a hyperlink column to the DataGrid? < asp:HyperLinkColumn > < / asp:HyperLinkColumn > 46. What is web.config file? Web.config file is the configuration file for the Asp.net web application. There is one web.config file for one asp.net application which configures the particular application. Web.config file is written in XML with specific tags having specific meanings.It includes databa which includes connections,Session States,Error Handling,Security etc. 47. What is the difference between in-proc and out-of-proc? An Inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it. Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed. 48. What is a PostBack? The process in which a Web page sends data back to the same page on the server. 49. How many languages .NET is supporting now? When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported. 50. What is smart navigation? The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed. 51. How do you validate the controls in an ASP .NET page? Using special validation controls that are meant for this. We have Range Validator, Email Validator 52. How do you turn off cookies for one page in your site? Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user's hard disk when a session ends. 53. Which two properties are on every validation control?

We have two common properties for every validation controls: Control to Validate Error Message 54. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator is used to ensure that two fields are identical. 55. What is the difference between HTTP-Post and HTTP-Get? The GET method creates a query string and appends it to the script's URL on the server that handles the request. The POST method creates a name/value pairs that are passed in the body of the HTTP request message. 56. What is strong-typing versus weak-typing? Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion Weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required.

VB.Net Interview Question and Answers


1. What is VB.NET? VB.Net is a windows based programming language.It supports oops concept. 2. What is the base class of .net? System.Object 3. What is Difference between Namespace and Assembly? Namespace is a collection of different classes. whereas an assembly is the basic building blocks of the .net framework. 4. What is the difference between early binding and late binding? Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding. 5. What is Intermediate Langauge? Microsoft Intermediate Language(MSIL or IL) is the CPU -independent instruction set into which .Net framework programs are compiled. It contains instructions for loading, storing initializing, and calling methods on objects. 6. What is Commom Language Runtime? CLR also known as Common Language Run time provides a environment in which program are executed, it activate object, perform security check on them, lay them out in the memory, execute them and garbage collect them. 7. What is Common Type System? The common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages. 8. What is Common Language Specification? The Common Language Specification is a set of constructs and constraints that serves as a

guide for library writers and compiler writers. 9. Whats the difference between private and shared assembly? Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name. 10. What namespace does the Web page belong in the .NET Framework class hierarchy? System.Web.UI.Page 11. What is an Assembly? Assembly are the basic buiding blocks of the .net framework.They are the logical grouping of the functionality in a physical file. 12. What are the advantages of an assembly? Increased performance. Better code management and encapsulation. It also introduces the ntier concepts and business logic. 13. What is Code Access Security? CAS - Code Access Security is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. 14. What are the difference between Structure and Class? Structures are value type and Classes are reference type Structures can not have constructors or destructors. Classes can have both constructors and destructors. Structures do not support Inheritance, while Classes support Inheritance. 15. What is the differences between dataset.clone and dataset.copy? Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesnt copy the data. Dataset.copy, copies both the dataset structure and the data. 16. What is the use of Internal keyword? Internal keyword is one of the access specifier available in .Net framework , that makes a type visible in a given assembly , for e.g : a single dll can contain multiple modules. 17. What is the difference between the Debug class and Trace class? Use Debug class for debug builds, use Trace class for both debug and release builds. 18. What are class access modifiers? Access modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the four access modifiers : Public Protected Internal Protected inertnal Private 19. What is portable executable?

The file format used for executable programs and for files to be linked together to form executable programs. 20. What is the difference between System.String and System.StringBuilder classes? System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 21. What is tracing? Tracing refers to collecting information about the application while it is running. You use tracing information to troubleshoot an application. 22. What is the difference between a Thread and a Process? A Process is an instance of an running application. And a thread is the Execution stream of the Process. A process can have multiple Thread. 23. What is serialization? Serialization is the process of converting an object into a stream of bytes. De-serialization is the opposite process of creating an object from a stream of bytes. Serialization/De-serialization is mostly used to transport objects. 24. How a base class method is hidden? Hiding a base class method by declaring a method in derived class with keyword new. This will override the base class method and old method will be suppressed. 25. What is a Constructor? A special Method Always called whenever an instance of the class is created. 26. What is Polymorphism? Mean by more than one form. Ability to provide different implementation based on different number / type of parameters. 27. What is an Interface? An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. 28. What is the difference between an EXE and a DLL? Dll is an In-Process Component whereas EXE is an OUt-Process Component.Exe is for single use whereas you can use Dll for multiple use. Exe can be started as standalone where dll cannot be. 29. What is the GAC? Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine. 30. How does CAS work? The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. 31. What is difference between MetaData and Manifest? Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net framework .

Out of which Metadata is a mandatory component , which as the name suggests gives the details about various components of IL code viz : Methods , properties , fields , class etc. 32. What is the top .NET class that everything is derived from? System.Object 33. How is method overriding different from method overloading? When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class. 34. What is a formatter? A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end. 35. What is an ArrayList? The ArrayList object is a collection of items containing a single data type values. 36. What is static member? The member defined as static which can be invoked directly from the class level, rather than from its instance. 37. What is Overloading? A process of creating different implementation of a method having a same name as base class, in a derived class. It implements Inheritance. 38. When do you use virutal keyword? When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable. Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes. 39. What is the purpose of XML Namespaces? An XML Namespace is a collection of element types and attribute names. It consists of 2 parts The first part is the URI used to identify the namespace The second part is the element type or attribute name itself. 40. What is a constructor? A constructor is invoked when you use the new operator, or use the various methods of reflection to create an instance of a class. 41. What is the difference between System.String and System.StringBuilder classes? System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 42. What is the use of JIT ? JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie. CPUspecific code that runs on the same computer architecture).

43. What is the difference between early binding and late binding? Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding. 44. Which method do you invoke on the DataAdapter control to load your generated dataset with data? DataAdapters fill () method is used to fill load the data in dataset. 45. What is the purpose of an Assembly? An assembly controls many aspects of an application. The assembly handles versioning, type and class scope, security permissions, as well as other metadata including references to other assemblies and resources. The rules described in an assembly are enforced at runtime. 46. What is Authentication and Authorization? Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password). Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user. 47. What are the types of Authentication? There are 3 types of Authentication. Windows authentication Forms authentication Passport authentication. 48 What is a Literal Control? The Literal control is used to display text on a page. The text is programmable. This control does not let you apply styles to its content. 49. What are the namespace available in .net? Namespace is a logical grouping of class. System System.Data System.IO System.Drawing System.Windows.Forms System.Threading 50. What is Side-by-Side Execution? The CLR allows any versions of the same-shared DLL (shared assembly) to execute at the same time, on the same system, and even in the same process. This concept is known as sideby-side execution.

C#.Net Interview Question and Answers


1. What is C#? C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language. It will immediately be familiar to C and C++ programmers.

C# combines the high productivity of Rapid Application Development (RAD) languages. 2. What are the types of comment in C#? There are 3 types of comments in C#. Single line (//) Multi (/* */) Page/XML Comments (///). 3. What are the namespaces used in C#.NET? Namespace is a logical grouping of class. using System; using System.Collections.Generic; using System.Windows.Forms; 4. What are the characteristics of C#? There are several characteristics of C# are : Simple Type safe Flexible Object oriented Compatible Consistent Interoperable Modern 5. How does C# differ from C++? C# does not support #include statement. It uses only using statement. In C# , class definition does not use a semicolon at the end. C# does not support multiple code inheritance. Casting in C# is much safer than in c++. In C# switch can also be used on string values. Command line parameters array behave differently in C# as compared to C++.

6. What are the basic concepts of object oriented programming? It is necessary to understand some of the concepts used extensively in object oriented programming.These include Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic Binding Message passing.

7. Can you inherit multiple interfaces? Yes. Multiple interfaces may be inherited in C#. 8. What is inheritance? Inheritance is deriving the new class from the already existing one. 9. Define scope? Scope refers to the region of code in which a variable may be accessed. 10. What is the difference between public, static and void? public :The keyword public is an access modifier that tells the C# compiler that the Main method is accessible by anyone. static :The keyword static declares that the Main method is a global one and can be called without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created. void : The keyword void is a type modifier that states that the Main method does not return any value.

11. What are the modifiers in C#? Abstract Sealed Virtual Const Event Extern Override Readonly Static New 12. What are the types of access modifiers in C#? Access modifiers in C# are : public protect private internal internal protect 13. What is boxing and unboxing? Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion. Conversion of reference type variable back to value type is called as UnBoxing. 14. What is object? An object is an instance of a class. An object is created by using operator new. A class that creates an object in memory will contain the information about the values and behaviours (or

methods) of that specific object. 15. Where are the types of arrays in C#? Single-Dimensional Multidimensional Jagged arrays.

16. What is the difference between Object and Instance? An instance of a user-defined type is called an object. We can instantiate many objects from one class. An object is an instance of a class. 17. Define destuctors? A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde. 18. What is the use of enumerated data type? An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on. 19. Define Constructors? A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class. 20. What is encapsulation? The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code. 21. Does c# support multiple inheritance? No,its impossible which accepts multi level inheritance. 22. What is ENUM? Enum are used to define constants. 23. What is a data set? A DataSet is an in memory representation of data loaded from any data source. 24. What is the difference between private and public keyword? Private : The private keyword is the default access level and most restrictive among all other access levels. It gives least permission to a type or type member. A private member is accessible only within the body of the class in which it is declared. Public : The public keyword is most liberal among all access levels, with no restrictions to access what so ever. A public member is accessible not only from within, but also from outside, and gives free access to any member declared within the body or outside the body.

25. Define polymorphism? Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances. 26. What is Jagged Arrays? A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an arrayofarrays. 27. what is an abstract base class? An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function. 28. How is method overriding different from method overloading? When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class. 29. What is the difference between ref & out parameters? An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter. 30. What is the use of using statement in C#? The using statement is used to obtain a resource, execute a statement, and then dispose of that resource. 31. What is serialization? Serialization is the process of converting an object into a stream of bytes. De-serialization is the opposite process of creating an object from a stream of bytes. Serialization / De-serialization is mostly used to transport objects. 32. What are the difference between Structure and Class? Structures are value type and Classes are reference type Structures can not have contractors or destructors. Classes can have both contractors and destructors. Structures do not support Inheritance, while Classes support Inheritance. 33. What is difference between Class And Interface? Class : is logical representation of object. It is collection of data and related sub procedures with defination. Interface : is also a class containg methods which is not having any definations.Class does not support multiple inheritance. But interface can support. 34. What is Delegates? Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. 35. What is Authentication and Authorization?

Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password). Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user. 36. What is a base class? A class declaration may specify a base class by following the class name with a colon and the name of the base class. omitting a base class specification is the same as deriving from type object. 37. Can this be used within a static method? No This cannot be used in a static method. As only static variables/methods can be used in a static method. 38. What is difference between constants, readonly and, static ? Constants: The value cant be changed. Read-only: The value will be initialized only once from the constructor of the class. Static: Value can be initialized once. 39. What are the different types of statements supported in C#? C# supports several different kinds of statements are Block statements Declaration statements Expression statements Selection statements Iteration statements Jump statements Try catch statements Checked and unchecked Lock statement 40. What is an interface class? It is an abstract class with public abstract methods all of which must be implemented in the inherited classes. 41. what are value types and reference types? Value types are stored in the Stack. Examples : bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort. Reference types are stored in the Heap. Examples : class, delegate, interface, object, string. 42. What is the difference between string keyword and System.String class? String keyword is an alias for Syste.String class. Therefore, System.String and string keyword are the same, and you can use whichever naming convention you prefer. The String class provides many methods for safely creating, manipulating, and comparing strings. 43. What are the two data types available in C#?

Value type Reference type 44. What are the different types of Caching? There are three types of Caching : Output Caching: stores the responses from an asp.net page. Fragment Caching: Only caches/stores the portion of page (User Control) Data Caching: is Programmatic way to Cache objects for performance. 45. What is the difference between Custom Control and User Control? Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application. User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files. 46. What is methods? A method is a member that implements a computation or action that can be performed by an object or class. Static methods are accessed through the class. Instance methods are accessed through instances of the class. 47. What is fields? A field is a variable that is associated with a class or with an instance of a class. 48. What is events? An event is a member that enables a class or object to provide notifications. An event is declared like a field except that the declaration includes an event keyword and the type must be a delegate type. 49. What is literals and their types? Literals are value constants assigned to variables in a program. C# supports several types of literals are Integer literals Real literals Boolean literals Single character literals String literals Backslash character literals 50. What is the difference between value type and reference type? Value types are stored on the stack and when a value of a variable is assigned to another variable. Reference types are stored on the heap, and when an assignment between two reference

variables occurs.

ADO.Net Interview Question and Answers


1. What is Ado.NET? ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. ADO.NET is a set of classes that expose data access services to the .NET programmer. ADO.NET is also a part of the .NET Framework. ADO.NET is used to handle data access. 2. What are the two fundamental objects in ADO.NET? There are two fundamental objects in ADO.NET. Datareader - connected architecture and Dataset - disconnected architecture. 3. What are the data access namespaces in .NET? The most common data access namespaces : System.Data System.Data.OleDb System.Data.SQLClient System.Data.SQLTypes System.Data.XML 4. What are major difference between classic ADO and ADO.NET? In ADO the in-memory representation of data is the recordset.A Recordset object is used to hold a set of records from a database table. In ADO.NET we have dataset.A DataSet is an in memory representation of data loaded from any data source. 5. what is the use of connection object in ado.net? The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database. 6. What are the benefits of ADO.NET? Scalability Data Source Independence Interoperability Strongly Typed Fields Performance

7. What is a Clustered Index? The data rows are stored in order based on the clustered index key. Data stored is in a sequence of the index. In a clustered index, the physical order of the rows in the table is the same as the logical (indexed) order of the key values. A table can contain only one clustered index. A clustered index usually provides faster access to data than does a non-clustered index.

8. What is a Non-Clustered Index? The data rows are not stored in any particular order, and there is no particular order to the sequence of the data pages. In a clustered index, the physical order of the rows in the table is not same as the logical (indexed) order of the key values. 9. Whate are different types of Commands available with DataAdapter ? The SqlDataAdapter has SelectCommand InsertCommand DeleteCommand UpdateCommand 10. What is the difference between an ADO.NET Dataset and an ADO Recordset? Dataset can fetch source data from many tables at a time, for Recordset you can achieve the same only using the SQL joins. A DataSet can represent an entire relational database in memory, complete with tables, relations, and views, A Recordset can not. A DataSet is designed to work without any continues connection to the original data source; Recordset maintains continues connection with the original data source. DataSets have no current record pointer, you can use For Each loops to move through the data. Recordsets have pointers to move through them. 11. Which method do you invoke on the DataAdapter control to load your generated dataset with data? DataAdapter fill () method is used to fill load the data in dataset. 12. What are the different methods available under sqlcommand class to access the data? ExecuteReader - Used where one or more records are returned - SELECT Query. ExecuteNonQuery - Used where it affects a state of the table and no data is being queried - INSERT, UPDATE, DELETE, CREATE and SET queries. ExecuteScalar - Used where it returns a single record.

13. What is a DataSet? A DataSet is an in memory representation of data loaded from any data source. 14. What is a DataTable? A DataTable is a class in .NET Framework and in simple words a DataTable object represents a table from a database. 15. What is the data provider name to connect to Access database? Microsoft.Access 16. Which namespaces are used for data access? System.Data System.Data.OleDB System.Data.SQLClient 17. What is difference between Dataset. clone and Dataset.copy?

Clone: - It only copies structure, does not copy data. Copy: - Copies both structure and data. 18. What is difference between dataset and datareader? DataReader provides forward-only and read-only access to data, while the DataSet object can hold more than one table (in other words more than one rowset) from the same data source as well as the relationships between them. Dataset is a disconnected architecture while datareader is connected architecture. Dataset can persist contents while datareader can not persist contents, they are forward only.

19. What is DataAdapter? A data adapter represents a set of methods used to perform a two-way data updating mechanism between a disconnected DataTable and the database. It aggregates four commands: select, update, insert and delete command. One adapter can only generate and fill one table in a DataSet. 20. What is a Command Object? The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records. 21. What is basic use of DataView? DataView represents a complete table or can be small section of rows depending on some criteria. It is best used for sorting and finding data with in datatable. 22. What is the use of Connection Object? The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database. 23. What are the advantage of ADO.Net? Database Interactions Are Performed Using Data Commands Data Can Be Cached in Datasets Datasets Are Independent of Data Sources Data Is Persisted as XML. 24. What is a stored procedure? A stored procedure is a precompiled executable object that contains one or more SQL statements. A stored procedure may be written to accept inputs and return output

25. What is the difference between OLEDB Provider and SqlClient ? SQLClient .NET classes are highly optimized for the .net / sqlserver combination and achieve optimal results. The SqlClient data provider is fast. It's faster than the Oracle provider, and faster than accessing database via the OleDb layer. 26. What is the use of Parameter Object? In ADO Parameter object provides information about a single parameter used in a stored procedure or query.

27. What is DataAdapter? DataSet contains the data from the DataAdapter which is the bridge between the DataSet and Database. DataAdapter provides the way to retrieve and save data between the DataSet and Database. It accomplishes this by means of request to the SQL Commands made against the database. 28. What does ADO mean? ADO stands for ActiceX Data Objects.It was introduced few years ago as a solution to accessing data that can be found in various forms, not only over a LAN but over the internet. It replaced the data access technologies RDO(Remote Data Objects) and DAO (Data Access Objects). 29. Name some ADO.NET Objects? Connection Object DataReader Object Command Object DataSet Object DataAdapter Object 30. What is Data Provider? A set of libraries that is used to communicate with data source. Eg: SQL data provider for SQL, Oracle data provider for Oracle, OLE DB data provider for access, excel or mysql. 31. What is the DataTableCollection? An ADO.NET DataSet contains a collection of zero or more tables represented by DataTable objects. The DataTableCollection contains all the DataTable objects in a DataSet. 32. What are the benefits of ADO.NET? ADO.NET offers several advantages over previous versions of ADO and over other data access components. These benefits fall into the following categories: Interoperability Maintainability Programmability Performance Scalability 33. How to creating a SqlConnection Object? SqlConnection conn = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=Northwind;User ID=YourUserID;Password=YourPassword"); 34. How to creating a SqlCommand Object? It takes a string parameter that holds the command you want to execute and a reference to a SqlConnection object. SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn); 35. How to load multiple tables into dataset? SqlDataAdapter da = new SqlDataAdapter("Select * from Id; Select * from Salry", mycon); da.Fill(ds); ds.Tables[0].TableName = "Id";

ds.Tables[1].TableName = "Salary"; 36. What is the provider and namespaces being used to access oracle database? system.data.oledb 37. What is the difference between SqlCommand and SqlCommandBuilder? SQLCommand is used to retrieve or update the data from database. SQLCommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete. 38. What is the use of SqlCommandBuilder? SQL CommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete. 39. What are managed providers? A managed provider is analogous to ODBC driver or OLEDB provider. It performs operation of communicating with the database. ADO.NET currently provides two distinct managed providers. The SQL Server managed provider is used with SQL server and is a very efficient way of communicating with SQL Server. OLEDB managed provider is used to communicate with any OLEDB compliant database like Access or Oracle. 40. How do I delete a row from a DataTable? ds.Tables("data_table_name").Rows(i).Delete dscmd.update(ds,"data_table_name") 41. What inside in DataSet? Inside DataSet much like in Database, there are tables, columns, constraints, relationships, views and so forth. 42. Explain ADO.Net Architecture? ADO.NET provides the efficient way to manipulate the database. It contains the following major components. 1. DataSet Object 2. Data Providers : Connection Object Command Object DataReader Object DataAdapter Object.

43. What is the difference between int and int32? Both are same. System.Int32 is a .NET class. Int is an alias name for System.Int32. 44. What is the role of the DataReader class in ADO.NET connections? It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed. 45. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so its not as fastest and efficient as SqlServer.NET.

46. What are acid properties? Atomicity Consistency Isolation Durability 47. What is DataRowCollection? Similar to DataTableCollection, to represent each row in each Table we have DataRowCollection. 48. What is the use of Ado.net connection? Establishes a connection to a specific data source. 49. What are basic methods of Dataadapter? Fill FillSchema Update 50. What are the various methods provided by the dataset object to generate XML? ReadXML : Reads a XML document in to Dataset. GetXML : This is a function which returns the string containing XML document. WriteXML : This writes a XML data to disk. 51. What is DataSet Object? Dataset is a disconnected, in-memory representation of data. It can contain multiple data table from different database. 52. What is difference between Optimistic and Pessimistic locking? In Pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other users can only view the data when there is pessimistic locking In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record. 53. What is Execute Non Query? The ExecuteNonQuery() is one of the most frequently used method in SqlCommand Object, and is used for executing statements that do not return result sets (ie. statements like insert data , update data etc.). 54. What providers does Ado.net uses? The .NET Framework provides mainly three data providers, they are Microsoft SQL Server, OLEDB, ODBC.

You might also like