Saturday 20 July 2013

.net interview questions and answers for freshers

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.What is 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 client’s 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 doesn’t 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 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.
    22.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 column’s “Visible” property.
    23.What are different types of directives in .NET?
     
    • @Page
    • @Control
    • @Import
    • @Implements
    • @Register
    • @Assembly
    • @OutputCache
    • @Reference
    24.What data type does the RangeValidator control support?
     
    • Integer
    • String.
    • Date.
    25.What is cookies?
     Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then re-use it on each page if needed
    26.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.
    27.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.
    28.Which method do you use to redirect the user to another page without performing a round trip to the client?
     
    • Server.Transfer
    • Server.Execute.
    29.Which method do you use to redirect the user to another page without performing a round trip to the client?
     Server.transfer
    30.What tag do you use to add a hyperlink column to the DataGrid?
     < asp:HyperLinkColumn > < / asp:HyperLinkColumn >
    31.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.
    32.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.
    33.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
    34.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.
    35.Which two properties are on every validation control?
     
      We have two common properties for every validation controls: 
    • Control to Validate
    • Error Message
    • 36.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.
      37.What is garbage collection?
       Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy.
      38.What is serialization?
       Serialization is the process of converting an object into a stream of bytes.
      Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects.
      39.What is the differnce between Managed code and unmanaged code?
       Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtimeto provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

      Un-Managed Code:Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).
      40.What is difference between constants, readonly and, static?
       
      • Constants: The value can’t be changed.
      • Read-only: The value will be initialized only once from the constructor of the class.
      • Static: Value can be initialized once.
      41.In which event are the controls fully loaded?
       Page_load event guarantees that all controls are fully loaded. Controls are also accessed.
      In Page_Init events but you will see that viewstate is not fully loaded during this event.
      42.What is the use of @ Register directives?
       @Register directive informs the compiler of any custom server control added to the page.
      43.Define RequiredFieldValidator?
       It checks whether the control have any value. It's used when you want the control should not be empty.
      44.What are the different types of Session state management options available with ASP.NET?
       ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

      45.What are the difference between const and readonly?
       
      • A const can not be static, while readonly can be static.
      • A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.
      • A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtim
        46.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.
        47.What is the difference between ASP Session and ASP.NET Session?
         Asp.net session supports cookie less session & it can span across multiple servers.
        48.What is Common 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.
        49.What is Intermediate Language?
         MSIL are also known as Microsoft Intermediate Language 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.
        50.What is CTS?
         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.

No comments:

Post a Comment

Featured post

Life Infotech now a leading brand in the field of technology training

  Life Infotech now a leading brand in the field of technology training & its invites students around the nation to be a part of the Tra...