Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

search topic

Tuesday, May 13, 2008

Asp.Net Interview Questions (Part-1)

  1. What do I need to create and run an ASP.NET application?
  • Windows 2000, Windows Server 2003 or Windows XP.
  • ASP.NET, which can be either the redistributable (included in the .NET SDK) or Visual Studio .NET.

before installing the .NET SDK.)

  1. Are there any free IDEs for the .NET SDK?
    • Microsoft provides Visual Studio 2005 Express Edition Beta for free. Of particular interest to the ASP.NET developers would be the Visual Web Developer 2005 Express Edition Beta 2 available as a free download.
    • The ASP.NET Web Matrix Project (supported by Microsoft) is a free IDE for developing ASP.NET
    • There is also a free open-source UNIX version of the Microsoft .NET development platform called Mono
    • Another increasingly popular Open Source Development Environment for .NET is the #develop (short for SharpDevelop)

  2. When was ASP.NET released?

ASP.NET is a part of the .NET framework which was released as a software platform in 2002.

  1. Is a new version coming up?

ASP.NET 2.0, Visual Studio 2005 (Whidbey), Visual Web Developer 2005 Express Edition are the next releases of Microsoft's Web platform and tools. They have already been released as Beta versions. They are scheduled to be released in the week of November 7, 2005.

  1. Explain Namespace.

Namespaces are logical groupings of names used within a program. There may be multiple namespaces in a single application code, grouped based on the identifiers’ use. The name of any given identifier must appear only once in its namespace.

  1. List the types of Authentication supported by ASP.NET.
    • Windows (default)
    • Forms
    • Passport
    • None (Security disabled)
  2. What is CLR?

Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc. The CLR is also known as Virtual Execution System (VES).

  1. What is CLI?

The CLI is a set of specifications for a runtime environment, including a common type system, base class library, and a machine-independent intermediate code known as the Common Intermediate Language (CIL). (Source: Wikipedia.)

  1. List the various stages of Page-Load lifecycle.
    • Init()
    • Load()
    • PreRender()
    • Unload()
  2. Explain Assembly and Manifest.

An assembly is a collection of one or more files and one of them (DLL or EXE) contains a special metadata called Assembly Manifest. The manifest is stored as binary data and contains details like versioning requirements for the assembly, the author, security permissions, and list of files forming the assembly. An assembly is created whenever a DLL is built. The manifest can be viewed programmatically by making use of classes from the System.Reflection namespace. The tool Intermediate Language Disassembler (ILDASM) can be used for this purpose. It can be launched from the command prompt or via Start> Run.

  1. What is Shadow Copy?

In order to replace a COM component on a live web server, it was necessary to stop the entire website, copy the new files and then restart the website. This is not feasible for the web servers that need to be always running. .NET components are different. They can be overwritten at any time using a mechanism called Shadow Copy. It prevents the Portable Executable (PE) files like DLLs and EXEs from being locked. Whenever new versions of the PEs are released, they are automatically detected by the CLR and the changed components will be automatically loaded. They will be used to process all new requests not currently executing, while the older version still runs the currently executing requests. By bleeding out the older version, the update is completed.

  1. What is DLL Hell?

DLL hell is the problem that occurs when an installation of a newer application might break or hinder other applications as newer DLLs are copied into the system and the older applications do not support or are not compatible with them. .NET overcomes this problem by supporting multiple versions of an assembly at any given time. This is also called side-by-side component versioning.

  1. Explain Web Services.

Web services are programmable business logic components that provide access to functionality through the Internet. Standard protocols like HTTP can be used to access them. Web services are based on the Simple Object Access Protocol (SOAP), which is an application of XML. Web services are given the .asmx extension.

  1. Explain Windows Forms.

Windows Forms is employed for developing Windows GUI applications. It is a class library that gives developers access to Windows Common Controls with rich functionality. It is a common GUI library for all the languages supported by the .NET Framework.

  1. What is Postback?

When an action occurs (like button click), the page containing all the controls within the tag performs an HTTP POST, while having itself as the target URL. This is called Postback.

  1. Explain the differences between server-side and client-side code?

Server side scripting means that all the script will be executed by the server and interpreted as needed. 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. Since the code is included in the HTML page, anyone can see the code by viewing the page source. It also poses as a possible security hazard for the client computer.

  1. Enumerate the types of Directives.
    • @ Page directive
    • @ Import directive
    • @ Implements directive
    • @ Register directive
    • @ Assembly directive
    • @ OutputCache directive
    • @ Reference directive
  2. What is Code-Behind?

Code-Behind is a concept where the contents of a page are in one file and the server-side code is in another. This allows different people to work on the same page at the same time and also allows either part of the page to be easily redesigned, with no changes required in the other. An Inherits attribute is added to the @ Page directive to specify the location of the Code-Behind file to the ASP.NET page.

  1. Describe the difference between inline and code behind.

Inline code is written along side the HTML in a page. There is no separate distinction between design code and logic code. Code-behind is code written in a separate file and referenced by the .aspx page.

  1. List the ASP.NET validation controls?
    • RequiredFieldValidator
    • RangeValidator
    • CompareValidator
    • RegularExpressionValidator
    • CustomValidator
    • ValidationSummary
  2. What is Data Binding?

Data binding is a way used to connect values from a collection of data (e.g. DataSet) to the controls on a web form. The values from the dataset are automatically displayed in the controls without having to write separate code to display them.

  1. Describe Paging in ASP.NET.

The DataGrid control in ASP.NET enables easy paging of the data. The AllowPaging property of the DataGrid can be set to True to perform paging. ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set for PagerStyle.Mode.

  1. Should user input data validation occur server-side or client-side? Why?

All user input data validation should occur on the server and minimally on the client-side, though it is a good way to reduce server load and network traffic because we can ensure that only data of the appropriate type is submitted from the form. It is totally insecure. The user can view the code used for validation and create a workaround for it. Secondly, the URL of the page that handles the data is freely visible in the original form page. This will allow unscrupulous users to send data from their own forms to your application. Client-side validation can sometimes be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.

  1. What is the difference between Server.Transfer and Response.Redirect?
    • Response.Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.
    • Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.

Wednesday, November 14, 2007

Oracle Job Interview Questions Part-9

  1. How do you implement postback with a text box? What is postback and usestate?
    Make AutoPostBack property to true
  2. How can you debug an ASP page, without touching the code?
  3. What is SQL injection?
    An SQL injection attack "injects" or manipulates SQL code by adding unexpected SQL to a query.
    Many web pages take parameters from web user, and make SQL query to the database. Take for instance when a user login, web page that user name and password and make SQL query to the database to check if a user has valid name and password.
    Username: ' or 1=1 ---
    Password: [Empty]
    This would execute the following query against the users table:
    select count(*) from users where userName='' or 1=1 --' and userPass=''
  4. How can u handle Exceptions in Asp.Net?
  5. How can u handle Un Managed Code Exceptions in ASP.Net?
  6. Asp.net - How to find last error which occurred?
    A: Server.GetLastError();
    [C#]
    Exception LastError;
    String ErrMessage;
    LastError = Server.GetLastError();
    if (LastError != null)
    ErrMessage = LastError.Message;
    else
    ErrMessage = "No Errors";
    Response.Write("Last Error = " + ErrMessage);

7. How to do Caching in ASP?
A: <%@ OutputCache Duration="60" VaryByParam="None" %>

VaryByParam value

Description

none

One version of page cached (only raw GET)

*

n versions of page cached based on query string and/or POST body

v1

n versions of page cached based on value of v1 variable in query string or POST body

v1;v2

n versions of page cached based on value of v1 and v2 variables in query string or POST body

<%@ OutputCache Duration="60" VaryByParam="none" %>
<%@ OutputCache Duration="60" VaryByParam="*" %>
<%@ OutputCache Duration="60" VaryByParam="name;age" %>

The OutputCache directive supports several other cache varying options

    • VaryByHeader - maintain separate cache entry for header string changes (UserAgent, UserLanguage, etc.)
    • VaryByControl - for user controls, maintain separate cache entry for properties of a user control
    • VaryByCustom - can specify separate cache entries for browser types and version or provide a custom GetVaryByCustomString method in HttpApplicationderived class
  1. What is the Global ASA(X) File?
  1. Any alternative to avoid name collisions other then Namespaces.
    A scenario that two namespaces named N1 and N2 are there both having the same class say A. now in another class i ve written
    using N1;using N2;
    and i am instantiating class A in this class. Then how will u avoid name collisions?
    Ans: using alias
    Eg:
    using MyAlias = MyCompany.Proj.Nested;
  2. Which is the namespace used to write error message in event Log File?
  3. What are the page level transaction and class level transaction?
  4. What are different transaction options?
  5. What is the namespace for encryption?
  6. What is the difference between application and cache variables?
  7. What is the difference between control and component?
  8. You ve defined one page_load event in aspx page and same page_load event in code behind how will prog run?
  9. Where would you use an IHttpModule, and what are the limitations of any approach you might take in implementing one?
  10. Can you edit data in the Repeater control? Which template must you provide, in order to display data in a Repeater control? How can you provide an alternating color scheme in a Repeater control? What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
  11. What is the use of web.config? Difference between machine.config and Web.config?
    ASP.NET configuration files are XML-based text files--each named web.config--that can appear in any directory on an ASP.NET Web application server. Each web.config file applies configuration settings to the directory it is located in and to all virtual child directories beneath it. Settings in child directories can optionally override or modify settings specified in parent directories. The root configuration file--WinNT\Microsoft.NET\Framework\\config\machine.config—provides default configuration settings for the entire machine. ASP.NET configures IIS to prevent direct browser access to web.config
    files to ensure that their values cannot become public (attempts to access them will cause ASP.NET to return 403: Access Forbidden).
    At run time ASP.NET uses these web.config configuration files to hierarchically compute a unique collection of settings for each incoming URL target request (these settings are calculated only once and then cached across subsequent requests; ASP.NET automatically watches for file changes and will invalidate the cache if any of the configuration files change).

What is the use of sessionstate tag in the web.config file?
Configuring session state:
Session state features can be configured via the section in a web.config file. To double the default timeout of 20 minutes, you can add the following to the web.config file of an application:



Note: Above interview questions are same if your are looking for

No comments: