Wednesday, November 12, 2008

Interview Questions ASP.NET

Interview Questions
1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the
page loading process. inetinfo.exe is theMicrosoft IIS server running, handling
ASP.NET requests among other things.When an ASP.NET request is received
(usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care
of it by passing the request tothe actual worker process aspnet_wp.exe.
2. What’s the difference between Response.Write()
andResponse.Output.Write()? The latter one allows you to write
3. What methods are fired during the page load? Init() - when the pageis
instantiated, Load() - when the page is loaded into server memory,PreRender() -
the brief moment before the page is displayed to the user asHTML, Unload() -
when page finishes loading.
4. Where does the Web page belong in the .NET Framework class
5. Where do you store the information about the user’s locale?
6. What’s the difference between Codebehind="MyCode.aspx.cs"
andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET
7. What’s 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 eventhandlers, allowing the main
DataGrid event handler to take care of its constituents.
8. Suppose you want a certain ASP.NET function executed on MouseOver
overa certain button. Where do you add an event handler? It’s the
Attributesproperty, the Add function inside that property. So
9. What data type does the RangeValidator control support? Integer,String and
10. Explain the differences between Server-side and Client-side code? Serverside
code runs on the server. Client-side code runs in the clients’ browser.
11. What type of code (server or client) is found in a Code-Behind class?
Server-side code.
12. Should validation (did the user enter a real date) occur server-side or
client-side? Why? Client-side. This reduces an additional request to the server
to validate the users input.
13. What does the "EnableViewState" property do? Why would I want it on or
off? It enables the viewstate on the page. It allows the page to save the users
input on a form.
14. What is the difference between Server.Transfer and Response.Redirect?
Why would I choose one over the other? Server.Transfer is used to post a
form to another page. Response.Redirect is used to redirect the user to another
page or site.
15. Can you explain the difference between an ADO.NET Dataset and an ADO
· A DataSet can represent an entire relational database in memory,
complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to
the original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on
· There's no concept of cursor types in a DataSet.
· DataSets have no current record pointer You can use For Each
loops to move through the data.
· You can store many edits in a DataSet, and write them to the
original data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in
different versions for different data sources.
16. Can you give an example of what might be best suited to place in the
Application_Start and Session_Start subroutines? This is where you can set
the specific variables for the Application and Session objects.
17. If I’m developing an application that must accommodate multiple security
levels though secure login and my ASP.NET web application is spanned
across three web-servers (using round-robin load balancing) what would be
the best approach to maintain login-in state for the users? Maintain the login
state security through a database.
18. Can you explain what inheritance is and an example of when you might use
it? When you want to inherit (use the functionality of) another class. Base Class
Employee. A Manager class could be derived from the Employee base class.
19. Whats an assembly? Assemblies are the building blocks of the .NET
framework. Overview of assemblies from MSDN
20. Describe the difference between inline and code behind. Inline code written
along side the html in a page. Code-behind is code written in a separate file and
referenced by the .aspx page.
21. Explain what a diffgram is, and a good use for one? The DiffGram is one of
the two XML formats that you can use to render DataSet object contents to
XML. For reading database data to an XML file to be sent to a Web Service.
22. Whats MSIL, and why should my developers need an appreciation of it if
at all? MSIL is the Microsoft Intermediate Language. All .NET compatible
languages will get converted to MSIL.
23. Which method do you invoke on the DataAdapter control to load your
generated dataset with data? The .Fill() method
24. Can you edit data in the Repeater control? No, it just reads the information
from its data source
25. Which template must you provide, in order to display data in a Repeater
control? ItemTemplate
26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate
27. 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?
You must set the DataSource property and call the DataBind method.
28. What base class do all Web Forms inherit from? The Page class.
29. Name two properties common in every validation control?
ControlToValidate property and Text property.
30. What tags do you need to add within the asp:datagrid tags to bind columns
manually? Set AutoGenerateColumns Property to false on the datagrid tag
31. What tag do you use to add a hyperlink column to the DataGrid?

32. What is the transport protocol you use to call a Web service? SOAP is the
preferred protocol.
33. True or False: A Web service can only be written in .NET? False
34. What does WSDL stand for? (Web Services Description Language)
35. Where on the Internet would you look for Web services?
36. Which property on a Combo Box do you set with a column name, prior to
setting the DataSource, to display data in the combo box? DataTextField
37. Which control would you use if you needed to make sure the values in two
different controls matched? CompareValidator Control
38. True or False: To test a Web service you must create a windows application
or Web application to consume this service? False, the webservice comes
with a test page and it provides HTTP-GET method to test.
39. How many classes can a single .NET DLL contain? It can contain many

Monday, October 20, 2008


ASP.NET is a set of technologies in the Microsoft .NET Framework for building Web applications and XML Web Services. ASP.NET pages execute on the server and generate markup such as HTML, WML or XML that is sent to a desktop or mobile browser. ASP.NET pages use a compiled, event-driven programming model that improves performance and enables the separation of application logic and user interface. ASP.NET pages and ASP.NET XML Web Services files contain server-side logic (as opposed to client side logic) written in Visual Basic .NET, C# .NET, or any .NET compatible language. Web applications and XML Web Services take advantage of the features of the common language runtime, such as type safety, inheritance, language interoperability, versioning, and integrated security.

What is the .NET Framework?

The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET.

Runtime Technical Questions


What is the common language runtime (CLR)?

The common language runtime is the execution engine for .NET Framework applications.

It provides a number of services, including the following:

Code management (loading and execution)

Application memory isolation

Verification of type safety

Conversion of IL to native code

Access to metadata (enhanced type information)

Managing memory for managed objects

Enforcement of code access security

Exception handling, including cross-language exceptions

Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)

Automation of object layout

Support for developer services (profiling, debugging, and so on)

What is the common type system (CTS)?

The common type system is a rich type system, built into the common language runtime, that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages.

What is the Common Language Specification (CLS)?

The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime.

What is the Microsoft Intermediate Language (MSIL)?

MSIL 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.

Combined with metadata and the common type system, MSIL allows for true cross-language integration.

Prior to execution, MSIL is converted to machine code. It is not interpreted.

What is managed code and managed data?

Managed code is code that is written to target the services of the common language runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).

Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.


What is an assembly?

An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit.

Assemblies are self-describing by means of their manifest, which is an integral part of every assembly. The manifest:

Establishes the assembly identity (in the form of a text name), version, culture, and digital signature (if the assembly is to be shared across applications).

Defines what files (by name and file hash) make up the assembly implementation.

Specifies the types and resources that make up the assembly, including which are exported from the assembly.

Itemizes the compile-time dependencies on other assemblies.

Specifies the set of permissions required for the assembly to run properly.

This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The runtime can determine and locate the assembly for any running object, since every type is loaded in the context of an assembly. Assemblies are also the unit at which code access security permissions are applied. The identity evidence for each assembly is considered separately when determining what permissions to grant the code it contains.

The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.

What are private assemblies and shared assemblies?

A private assembly is used only by a single application, and is stored in that application's install directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than one application. In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private assembly name need only be unique within the application that uses it.

By making a distinction between private and shared assemblies, we introduce the notion of sharing as an explicit decision. Simply by deploying private assemblies to an application directory, you can guarantee that that application will run only with the bits it was built and deployed with. References to private assemblies will only be resolved locally to the private application directory.

There are several reasons you may elect to build and use shared assemblies, such as the ability to express version policy. The fact that shared assemblies have a cryptographically strong name means that only the author of the assembly has the key to produce a new version of that assembly. Thus, if you make a policy statement that says you want to accept a new version of an assembly, you can have some confidence that version updates will be controlled and verified by the author. Otherwise, you don't have to accept them.

For locally installed applications, a shared assembly is typically explicitly installed into the global assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version management features of the .NET Framework is that downloaded code does not affect the execution of locally installed applications. Downloaded code is put in a special download cache and is not globally available on the machine even if some of the downloaded components are built as shared assemblies.

The classes that ship with the .NET Framework are all built as shared assemblies.

If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?

Building a shared assembly does involve working with cryptographic keys. Only the public key is strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide command line options (or use custom attributes) for supplying the public key when building the assembly. It is common to keep a copy of a common public key in a source database and point build scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).

Strong name signing does not involve certificates like Authenticode does. There are no third party organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for verifying a strong name is much less than it is for Authenticode. However, strong names do not make any statements about trusting a particular publisher. Strong names allow you to ensure that the contents of a given assembly haven't been tampered with, and that the assembly loaded on your behalf at run time comes from the same publisher as the one you developed against. But it makes no statement about whether you can trust the identity of that publisher.

What is the difference between a namespace and an assembly name?

A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

Application Deployment and Isolation

What options are available to deploy my .NET applications?

The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of applications feasible. Because all requests are resolved first to the private application directory, simply copying an application's directory files to disk is all that is needed to run the application. No registration is required.

This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism. An example is when the application has little private code and relies on the availability of shared assemblies, or when the application is not locally installed (but rather downloaded on demand). For these cases, the .NET Framework provides extensive code download services and integration with the Windows Installer. The code download support provided by the .NET Framework offers several advantages over current platforms, including incremental download, code access security (no more Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't affect other applications). The Windows Installer is another powerful deployment mechanism available to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and application repair will be available to .NET applications in Windows Installer 2.0.

I've written an assembly that I want to use in more than one application. Where do I deploy it?

Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:

gacutil /i myDll.dll

Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.

How can I see what assemblies are installed in the global assembly cache?

The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.

What is an application domain?

An application domain (often AppDomain) is a virtual process that serves to isolate an application. All objects created within the same application scope (in other words, anywhere along the sequence of object activations beginning with the application entry point) are created within the same application domain. Multiple application domains can exist in a single operating system process, making them a lightweight means of application isolation.

An OS process provides isolation by having a distinct memory address space. While this is effective, it is also expensive, and does not scale to the numbers required for large web servers. The Common Language Runtime, on the other hand, enforces application isolation by managing the memory use of code running within the application domain. This ensures that it does not access memory outside the boundaries of the domain. It is important to note that only type-safe code can be managed in this way (the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).

Garbage Collection

What is garbage collection?

Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the one used by .NET, compact memory and therefore decrease your program's working set.

How does non-deterministic garbage collection affect my code?

For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set.

Can I avoid using the garbage collected heap?

All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.

The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.

Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.

For additional information about Garbage Collection see:

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework

Garbage Collection, Part 2: Automatic Memory Management in the Microsoft .NET Framework

Back to Top


How do in-process and cross-process communication work in the Common Language Runtime?

There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.

Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.

If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.

If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about what channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:

HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls)

TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))

When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any remotable component.

Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.


Can I use COM objects from a .NET Framework program?

Yes. Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.

Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.

Can .NET Framework components be used from a COM program?

Yes. Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.

Depending on the language used to write the managed type, it may or may not be visible by default.

Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.

Can I use the Win32 API from a .NET Framework program?

Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.

Here is an example of C# calling the Win32 MessageBox function:

using System;

using System.Runtime.InteropServices;

class MainApp {

[DllImport("user32.dll", EntryPoint="MessageBox")]

public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);

public static void Main()


MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );



Tuesday, August 26, 2008

Testing .aspx Script from Console Prompt

Platform: Windows NT 4.0 or Windows 2000

Version : VS.NET Beta 2 only

Requirements : Favorite editor (whether SDI or MDI )

Method : Simply write the following code into a file and save it as MyTest.exe , then try this out, perform the following steps:

  1. Copy The MyTest.cs and Test.aspx files to a local directory.

  2. Compile MyTest.exe by typing csc MyTest.cs /r:System.Web.dll within a command prompt in the directory.

  3. Type MyTest.exe Test.aspx

One interesting use of this functionality is to pre-process dynamic ASP.NET requests saving the output as static .htm files that you then prop onto a server. You can do this with MyTest.exe by pipeing the output automatically to a static file. For example:

      MyTest.exe Test.aspx > Test.htm


using System ;
using System.IO ;
using System.Web ;
using System.Web.Hosting ;

public class MyExeHost : MarshalByRefObject
public void ProcessRequest ( String page ) 
HttpRuntime.ProcessRequest ( new SimpleWorkerRequest ( page, null, Console.Out ) ) ;
public static void Main ( String[ ] args ) 
MyExeHost host = ( MyExeHost )ApplicationHost.CreateApplicationHost ( typeof ( MyExeHost ),

"/foo", Directory. CurrentDirectory ) ;
foreach ( String page in args ) 
host.ProcessRequest ( page ) ;


Hi checking it out ! <%=Now%>

Friday, July 25, 2008


1. What is the result of using Option Explicit?

A. This applies only to Visual Basic, not VBScript.
B. All variables must be dimensioned before use.
C. All variables are dimensioned at run-time.
D. Forces all controls to have a SELECTED
E. Requires all variables be cast as specific datatypes.

2. What should be used in order to determine if the cookie
"FavoriteFlavors" in the request object contains more than one entry?

A. Request.Cookies("FavoriteFlavors").HasItems
B. Request.Cookies("FavoriteFlavors").Collection.Count
C. Request.Cookies("FavoriteFlavors").Dictionary
D. Request.Cookies("FavoriteFlavors").HasKeys
E. Request.Cookies("FavoriteFlavors").Count

3. When is the Session_OnStart event fired?

A. Upon every request from an application by a client for an
.asp document.
B. Upon the first request from an application by a client for
any file in the application.
C. Upon the first request for an .asp document from an
application by a client.
D. Upon the first request for the global.asp file, in which the
event handler is located.
E. Upon the first request for an .htm or .asp document from an
application by client

4. What does Internet Information Server (IIS) assume to be the
default language for Active Server Pages?

A. Jscript
B. JavaScript
D. VBScript
E. ECMAScript

5. What should the developer use in order to have an Active
Server Page (ASP) invoke a stored procedure on a SQL Server database?

E. None of the above.

6. ‘onStart' and 'onEnd' are events of what object(s)?

A. Application only.
B. Session only.
C. Server only.
D. Application and Session only.
E. Application, Session, and Server.

7. What must be installed on an IIS4 machine to use the CDONTS
e-mail server object?

A. FTP service
B. SMTP service
C. IIS administrator
D. Exchange Server
E. IPX/SPX protocol

8. Which line of code would instantiate the Browser
Capabilities component?

A. objBrowser = Server.CreateObject("MSWC.BrowserType")
B. Set objBrowser = Server.CreateObject("MSWC.BrowserType")
C. var objBrowser = Server.CreateObject("MSWC.BrowserType")
D. var objBrowser = CreateObject("MSWC.BrowserType")
E. var objBrowser = Server.CreateObject("BrowserType")

9. What is the Default ScriptTimeOut for Server

A. 20 Sec
B. 30 Sec
C. 60 Sec
D. 90 Sec

10. How many Max Cookies can we Create in

A. 10
B. 20
C. 30
D. 40

11. How Many Types of Cookies

A. 3
B. 2
C. 1
D. 4

12.What is ASP(Active Server Pages)?

ASP is a server side scripting environment for building dynamic and
interactive web pages. Since the scripts run on the server side,
the web server does all the processing.

13. What are the advantages of using ASP?

· Minimizes network traffic by limiting the need for the browser and server
to talk to each other
· Makes for quicker loading time since HTML pages are only downloaded
· Allows to run programs in languages that are not supported by the browser
· Can provide the client with data that does not reside on the client’s
· Provides improved security measures since the script cannot be viewed by
the browser

14. What is HTML(Hypertext Markup Language)?

It’s a method by which web pages can be built and generally used for formatting and linking text.

15. What are the types of HTML?

· Static HTML – Browser uses HTTP to request
HTML file from the Web Server
· Dynamic HTML – Browser uses HTTP to request an executable
application rather than a Static HTML file

16. What is the difference between ASP and HTML? Or Why ASP
is better than HTML?

· ASP executes code on the server side whereas the browser interprets HTML.
· ASP can use any scripting languages
· Gets feedback from the user and return information to the user
· Create pages that will be customized to display only things that will be of
interest to a particular user
· Can edit contents of a web page by updating a text file or a database
rather than the HTML code itself

17. What is a Web Server?

It’s a Computer that provides Web services on the Internet or on a local
Intranet. It is designed to locate, address and send out simple HTML
pages to all other users who access these pages.

18. What is IIS?

IIS is a Web Server that provides Web services, not only for web pages
but also for ftp sites and video and audio services. It integrates
with the database facilities of SQL Server.

19. What do you need to run ASP?

A browser and a Web server.

20. What is a Scripting Language?

It permits to create more interactive Web Pages. Validation, formatting
of web pages can be done. VBScript, JavaScript are some examples.

21. Which is the default Scripting Language of ASP (server-side)?


22. Which is the default Scripting Language on the client side?


23. What is Global.asa file?

It is text file that contains details about an ASP application, such as
when it should begin and end.

24. Which is the default Data types in VBScript?

Variant is the default data type in VBScript, which can store a value of any

25. What is the Order of precedence for ARITHMETIC Operators.

^, -(negation), *or /, \, mod, + or –

26. Where will you code OPTION EXPLICIT in an ASP application? WHY?

It should be the first statement before the tag because ASP script is
processed before the HTML statements.

27. What are Constants? How will you declare a constant?

Constants have values that do not change during the execution of the program.
It can be declared using the term CONST. (e.g) Const pi = 3.143

28. What are ARRAYS?

Arrays are variables that store items of similar information.
DIM ARRAY1(4) (declares an array with the name array1 with 5 elements)

29. Arrays can be resized by using the keyword


30. What is the maximum size of an array?

Up to 60 dimensions.


31. Name the ASP Objects?

· Request Object
· Response Object
· Server Object
· Session Object
· Application Object

32. What is Request Object?

Gets information from the user. It has five collections by which values can be accessed. They are:
QueryString, Form, Cookies, Server Variables & ClientCertificate

33. What is Collection?

Collection is a set of name/value pairs where the information supplied by the client is stored.

34. What is application Object?

Shares information among users of an application. Gives a notification when an application starts or ends.

35. What is Application-scope?

Application-scope means that variables (and objects) can be accessed from
any ASP pages that is part of the application.

36. How many global.asa files can an Application have?

Only one global.asa file and it’s placed in the virtual directory’s root.

37. What are the collections of Application Object?

* Contents collection – contains all variables added via scripts in global.asa.
* Static collection – contains the names of all objects added via the
tag in global.asa.

Thursday, July 24, 2008



Response.Write a
In the sample code shown above, what will be written to the

A. 1
B. 2
C. 1, 2
D. 1&2
E. Nothing.

2. <%
Set Application("Thing") =

The above code appears in the global.asa file. What would it

A. It would create a "Thing" object and place it in Contents Collection of
the Application object.
B. It would create a "Thing" object and place it in StaticObjects
Collection of the Application object.
C. It would create a "Thing" object and place it in the Application.Buffer
Collection Of the Application object.
D. It would create an application-level variable named "Thing" with the
value of the object property "THINGDOER.thingy".

E. It would fail to create a "Thing" object because the code requires the
Application.Lock and Application.Unlock methods.

3. <% iPos = Instr("Hello World","r") %>
Referring to the above, what is the value of iPos?

A. 0
B. 1
C. 2
D. 8
E. 9

4. <% varType = rsTest("field1").type %>

In the database table, if the datatype for field1 (shown
above) is Number, what is the value of varType?

A. The field value.
B. A string description.

C. The field name.
E. An enumerator.

5. What is the program ID (ProgID) for ActiveX Data Objects
in 2-tier and 3-tier database applications?



6. Which choice is NOT an ADO collection?

A. Properties
B. Records

C. Fields
D. Errors
E. Parameters

7. Which will NOT set the scope of an Active Server Component?

A. Setting the [component name].scope property.

B. Using the Server.CreateObject method.
C. Placing it in the Session or Application OnStart event
D. Instantiating the component in the global.asa file.
E. Using the tag.

8. How to handle Error in ASP

A. Using On Error Goto
B. Using On Error Resume
C. Using On Error Resume Next

D. Using On Error Goto 0

9. <%
intA = 3
sStrA = "Hello World"
sStrB = "Hello World" + intA
Response.Write sStrB

What would be the result of the above code?

A. Type mismatch error

B. "Hello World, Hello World, Hello World"
C. 0
D. "Hello World 3"
E. "Hello World"

10. What happens when a client submits a form which changes the
value of an Application variable?

A. Client actions cannot change Application variables.
B. The change is not visible to any client until the application is stopped
and started.
C. The change is only visible to future requests made by that
client during their current session.
D. The change is visible to all clients, but only after they
complete their current sessions and begin a new session.
E. The change is visible to all clients immediately after the
form is processed by the server.

11. ADO is an object model for accessing which of the

A. Relational data via Jet.
B. Local or SQL data via Jet.
C. Relational data via ODBC.
D. Non-relational data via DSN-less ODBC.
E. All types of data via OLE DB.

12. Which of the following are Server Object methods ( Choose Two)

A. HTMLEncode,MapPath

B. URLEncode,ScriptTimeout
C. URLEncode,CreateObject

D. ScriptTimeout,Abandon

13. Following is the code Server.MapPath(".") consider the path is
What will be the output

A. C:\InetPUb
B. C:\InetPUb\WWWroot
C. C:\InetPUb\wwwroot\MAT

D. Error

14. ClientCertificate is a collection of

A. Server
B. Response
C. Request

D. ObjectContext

15. IsClientConnected is a property of

A. Server
B. Response

C. Request
D. Sesssion

16) What happens to a HTML page?

The browser makes a HTTP request; the server gives a HTTP response to the browser and the browser converts into a HTML page.

17) What happens to ASP pages?

The browser makes a HTTP request; the server does the processing and gives a HTML response to the browser.

18) What are the Web Servers supporting ASP?

· Internet Information Server (IIS) on Windows NT
· Personal Web Server (PWS) on Windows 95
· Peer Web Services on Windows NT

19) Explain the POST & GET Method or Explain the difference between them.

The POST method generates a FORM collection, which is sent as a HTTP
request body. All the values typed in the form will be stored in the
FORM collection.

The GET method sends information by appending it to the URL(with
a question mark) and stored as a Querystring collection. The
Querystring collection is passed to the server as name/value pair.
The length of the URL should be less than 255 characters.

20) What is the command to display characters to the HTML page?


21) What is a variable?

Variable is a memory location through which the actual values are
stored/retrieved. Its value can be changed.

22) What are LOCAL and GLOBAL variables?

Local variables lifetime ends when the Procedure ends.Global variables
lifetime begins at the start of the script and ends at the end of the
script and it can be used by any procedure within the script. Declaring
a variable by using the keyword PRIVATE makes the variable global within
the script, but if declared using PUBLIC, then the variable can be
referred by all scripts.

23) Naming constraints for a variable.

It can be up to 255 characters
Must start with an alphabet
Must not contain an embedded period or full-stop

24) VBScript is case- insensitive

JavaScript is case sensitive

25) What are the special sub-types in VBScript?

EMPTY: has no value
NULL : Value does not exists (conjunction with database)

26) What is the Order of precedence for LOGICAL Operators.


27) What is Response Object?

It controls the information sent to the user. The various methods are:
Response.write – Sends information directly to a browser
Response.Redirect – Directs a user to a URL other than the requested URL
Response.ContentType – Controls the type of content sent
Response.Cookies – Sets cookie values
Response.Buffer – To Buffer information

28) How will you set the values for cookies?

<% Response.Cookies("variable name ")="value" %>.

29) What is the function of Buffer in Response Object?

Buffer controls the HTML output stream manually.

30) What are the methods by which output stream is controlled?

· Flush – sends previous buffered output to the client immediately, but
continues processing the script.
· Clear – erases any already-buffered HTML.
· End – causes the server to stop processing the script.

31) What are the properties used to control the expiration of the page?

· Expires – specifies the number of minutes before a page cached on a browser
· ExpiresAbsolute – sets the date and time at which a page cached on a browser expires.

32) What are the methods in Application Object?

· Lock – prevents clients from modifying the variables stored in the Application object.
· Unlock – removes the lock from variables stored in the Application object.

33) What are the event handlers of Application Object?

· Application_OnStart – This event will be fired when the first visitor hits the page.
· Application_OnEnd – This event runs when the server is stopped.

34) What is Session Object?

It stores information about a User’s session. Gives a notification when a user session begins or ends.

35) What is a session?

A user accessing an application is known as a session.

36) What are the collections of Session Object?

· Contents collection – contains all the variables established for a session without using the tag.
· Static collection – contains all the objects created with the tag within session scope.

37) What are the properties of Session Object?

· SessionID – returns the session identification number for each user.
· Timeout – sets the timeout period assigned to the Session object for any application, in minutes.
· CodePage – determines the code page that will be used to display content.
· LCID – a locale identifier, which determines time-zone and language, rules for the system.

38) What are the methods in Session Object?

The Session Object has only one method, which is Abandon. It destroys all the objects stored in a Session Object and releases the server resources they occupied.

39) Name some of the ASP components?

· Ad Rotator component – a way to manage advertisements
on the web site.
· Content Linker component – a technique to direct users through a set
of pages on a web site by creating a list of URLs and description of
the next and previous pages.
· Browser Capabilities component – allows to customize the page to the
ability of the browser viewing it.
· Database Access component – allows to access data from the database

40) What are Scripting Objects?

Objects that can enhance the application are known as the Scripting Objects.

41) What are the ASP Scripting Objects?

The Dictionary object, the FileSystemObject object, TextStream object.

42) What is a Dictionary object?

It lets you store and retrieve information in a flexible data
structure. Each value or information stored in a Dictionary is
associated with a key through which the information can be retrieved.

43) What is a FileSystemObject object?

It provides access to the physical file system of the web server.
It gets and manipulates information about all drives in a server,
folders and sub-folders on a drive and files inside a folder.

44) What is Server-Side includes?

It provides extra information by which it makes the site easier to manage.
It can include text files using the #include statement, retrieve the size
and last modification date of a file, defines how variables and error
messages are displayed and inserts the values of HTTP variables in the
page sent back to the browser.



1. <%
strName="John Smith"
Referring to the above, if you want to pass the contents of
the strName variable in a hyperlink, which line of code would you

A. This cannot be done. The anchor is on the client and the
variable is on the server.
B. href="Encode.asp?name=<%=Server.URLPathEncode(strName)%>">click here
C. ">click here
D. ">click here
E. ">click here

2. <%@ Language=VBScript %>
<%If false Then%>


<%End If%>
What would the above code load?

A. Only the file into the ASP

B. Both files, since Server Side Includes are processed
before ASP interpreting.
C. Only the file into the ASP page.
D. Neither file, since Server Side Includes are processed
before ASP interpreting.
E. Neither file, since the #INCLUDE statements are commented out.

3. <% Response.Redirect("") %>
What does the above code accomplish?

A. It sends the browser the line of sample code, and the browser executes it.
B. It sends the response to "" instead of to the
Requesting browser.
C. It sends a redirection header back to the browser, and the browser then
requests the new target document.

D. The redirection occurs on the server-side, and the first response the
browser gets is the head and body of the new target document.
E. It causes the server to send a request to the target URL and passes the
response to the requesting browser.

4. How are sessions maintained?

A. The browser sends a cookie to the server with each

B. The browser sends a QueryString variable to the server with
each request.
C. The browser sends a hidden Form variable to the server with
each request.
D. The browser sends a long variable to the server in the BODY
of each request.
E. None of the above.

5. When does the application OnEnd event handler

A. After every request for an application document, since web servers are
stateless servers.
B. As soon as there are no open connections to any application
C. When the web server is stopped in an orderly fashion.

D. Twenty minutes after the last request for a document in the
E. When there are no application requests for the amount of
time defined by the
SessionTimeout variable.

6. How long is a sessionID guaranteed to be

A. It is unique for the web server, whether it is restarted or
B. Only until the web server is restarted.
C. It is like a GUID in that it is for any web server at any
D. Only until the session expires, then it can be reissued to
another client.

E. It is unique per client. A client cannot have two sessions
with the same sessionID

7.Which code sample will report whether the client's browser
supports cookies?

A. <% var objFSO = Server.CreateObject("Scripting.FileSystemObject")
response.write objFSO.cookiesSupported
B. You can only use JavaScript for this.
C. <% var objFSO = Server.CreateObject("Scripting.FileSystemObject")
response.write objFSO.cookies
D. <% var objBrowser = Server.CreateObject("MSWC.BrowserType")
response.write objBrowser.cookies

E. <% var objBrowser = Server.CreateObject("MSWC.BrowserType")
response.write objBrowser.cookiesSupported

8. Male
Referring to the above, which line of code would retrieve the
selected radio button value?

A. For cnt=0 to rbSex.count - 1
If rbSex(cnt).value = selected Then
strSex = rbSex(cnt).value
exit for
End If
B. strSex = Request("rbSex").selected.value
C. strSex = Request("rbSex")

D. strSex = Request.rbSex.value
E. For Each value in rbSex
If rbSex.selected = true
strSex = value
exit for

9. The FileSystemObject provides an object interface to drives,
directories, and files for which of the following?

A. Any local or mapped drive on either the server or the

B. Only files and subdirectories in the web site's home
C. Any local physical drive or mapped drive on the web
D. Any file system physically located on the web server.
E. The client's computer.

10. What purpose is served by the Application.lock

A. It locks the Application object, preventing other clients from altering
any values in the Contents collection.

B. It locks the application, preventing the server from responding to any
requests for application documents.
C. It locks the application, preventing non-SSL requests from
being processed.
D. It locks the Application object, preventing other clients from reading any
values in the Content collection.
E. It locks other clients from reading the Contents

11. How to Display images using Response

A. Contenttype=Application/Brush
B. Contenttype=Image/JPG

C. Contenttype=Application/paint
D. Contenttype=Image/WMF

12.What is the use of following Statement

A.The page will be removed form cache after 120 Hours
B.The page will be removed form cache after 120 Sec
C.The page will be removed form cache before 120 Min
D.The page will be removed form cache after 2 Hours

13. Which choice is NOT a property of Dictionary

A. Key()
B. CompareMode
C. Item ()
D. Exists ()

E. Count

14. Using VBScript, which of the following Scripting Object(s)
is NOT available from scrrun.dll?

A. TextStream
B. Dictionary Object
C. Err Object
D. FileSystemObject
E. All are available from scrrun.dll.

15. What is an .ASP file?

It is a Text File that contains the combination of the following:
· Text
· HTML tags
· Script Commands

16.How are scripts executed?

ASP provides scripting engines that execute the corresponding
scripting languages on the server side. Scripts should be encoded within the
<% ….%> delimiters.

17. What are the browsers that can access ASP pages?

· Internet Explorer (supports VBScript, JavaScript)
· Netscape Communicator/ Navigator (supports only JavaScript, Vbscript can be also added too)

18. What is a "Virtual Directory"?

Virtual directories are aliases for directory paths on the server.
It allows to move files on the disk between different folders, drives or even
servers without changing the structure of web pages. It avoids typing an extremely
long URL each time to access an ASP page.

19. What is the difference between client-side script and server-side script?

Scripts executed only by the browser without contacting the
server is called client-side script. It is browser dependent. The scripting
code is visible to the user and hence not secure. Scripts executed by the
web server and processed by the server is called server-side script.

20. Give the comment Tags for the following:

VBScript : REM & ‘(apostrophe)
JavaScript : // (single line comment)
/* */ (Multi-line comments)

21.How can you disable the browser to view the code?

Writing codes within the Tag.

22. How does the server identify and execute the server-side scripts within HTML code?

· Including the RUNAT=SERVER attribute in the