ASP Interview Questions | Frequently
Asked Questions (FAQs)
1. How can you disable the browser to view the code?
Writing codes within the Tag
2. What is a "Virtual Directory"?
Virtual directories are aliases for directory paths on the server. It allows moving 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.
3. Give the comment Tags for the following?
VBScript : REM & ‘(apostrophe)
JavaScript : // (single line comment)
/* */ (Multi-line comments)
4. Which is the default Scripting Language of ASP (server-side)?
VBScript
5. Which is the default Data types in VBScript?
Variant is the default data type in VBScript, which can store a value of any type.
6. What is a variable?
Variable is a memory location through which the actual values are stored/retrieved. Its value can be
changed.
7. What is the maximum size of an array?
Up to 60 dimensions.
8. What is Query string collection?
This collection stores any values that are provided in the URL. This can be generated by three
methods:
By clicking on an anchor tag By sending a form to the server by the GET method Through user-
typed HTTP address
9. What are the attributes of the tags? What are their functions?
The two attributes are ACTION and METHOD
The ACTION gives the name of the ASP file that should be opened next by which this file can access
the information given in the form
The METHOD determines which of the two ways (POST or GET) the browser can send the
information to the server
10. 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.
11. What is Server Variables collection?
The Server Variables collection holds the entire HTTP headers and also additional items of
information about the server.
12. What is the difference between Query string collection and Form collection?
The main difference is that the Query string collection gets appended to a URL.
13. What is a Form collection?
The Form collection holds the values of the form elements submitted with the POST method. This is
the only way to generate a Form collection.
14. What are the ASP Scripting Objects?
The Dictionary object, the FileSystemObject object, Text Stream object.
15. 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.
16. What happens to ASP pages?
The browser makes a HTTP request; the server does the processing and gives a HTML response to
the browser.
17. How can you change the primary scripting language for a page?
Specify
18. What is application Object?
Shares information among users of an application. Gives a notification when an application starts or
ends.
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. What is the command to display characters to the HTML page?
Response. Write
Top
21. Explain the POST & GET Method or Explain the difference between them?
POST METHOD:
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.
GET METHOD:
The GET method sends information by appending it to the URL (with a question mark) and stored as
A Query string collection. The Query string collection is passed to the server as name/value pair.
The length of the URL should be less than 255 characters.
22. How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
23. What are Scripting Objects?
Objects that can enhance the application are known as the Scripting Objects.
24. What is the Order of precedence for LOGICAL Operators.
NOT, AND, OR, XOR, EQV, IMP
25. What is an Err Object?
Name it’s properties and methods.
26. 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 all scripts can refer the variable.
27. Which is the default Scripting Language on the client side?
JavaScript
28. 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.
29. 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.
30. What is Session Object?
It stores information about a User’s session. Gives a notification when a user session begins or
ends.
31. 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.
32. 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.
33. 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.
34. 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.
35. What is Global.asa file?
It is text file that contains details about an ASP application, such as when it should begin and end.
36. What is an .ASP file?
It is a Text File that contains the combination of the following:
Text
HTML tags
Script Commands
37. 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. Content Type - Controls the type of content sent
Response. Cookies - Sets cookie values
Response. Buffer - To Buffer information
38. 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
39. What is a Text Stream object?
It allows you to access read/write) the contents of text files stored on the web server.
Top
41. 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.
42. What is Request Object?
Gets information from the user. It has five collections by which values can be accessed. They are:
Query string, Form, Cookies, Server Variables & Client Certificate
43. What are the special sub-types in VBScript?
EMPTY: has no value
NULL: Value does not exist (conjunction with database)
OBJECT:
44. What is Cookies collection?
Cookies are text files that store information about the user by which the web server identifies and
marks each different visitor to a web site and determines where a user has been before. A cookie
can store information only when the user sends it. Individual cookies are limited to 4KB of data. The
maximum number of cookies allowed is 300.
Cookies are stored on client’s machine.
45. What is the difference between Cookies collection and Form/Query string collection?
Cookie collection does not have the Count property. Cookies can have multiple values for the same
cookie name but each value can be referred using a key whereas in a Form/Query string cookie
each value has to be referred using an index value.
46. What is Server Object?
Controls the ASP execution environment. It can set the amount of time script can run before an
error occurs. Converts a virtual path to a physical path on the server. Takes a user supplied string
and encode it into proper format for a URL string.
47. What is Collection?
Collection is a set of name/value pairs where the information supplied by the client is stored.
48. How will you delete a Cookie?
By setting its Expires property to any date prior to today Response.Cookies("cookie name"). Expires
= Date 1.
49. What is the function of Buffer in Response Object?
Buffer controls the HTML output stream manually.
50. 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.
51. 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.
52. 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)
53. What is Application-scope?
Application-scope means that variables (and objects) can be accessed from any ASP pages that is
part of the application.
54. What is Extranet?
An area of a web site available only to a set of registered visitors.
55 What is the use of following Statement Response. Expires=120?
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
56 What is the use of following Statement Response. Expires=120?
A. Using On Error Goto
B. Using On Error Resume
C. Using On Error Resume Next (
D. Using On Error Goto 0
57 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.asa file, in which the event handler is located.
E. Upon the first request for an. html or .asp document from an application by client
58 <%
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"
Top
59 < %
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 use?
A. This cannot be done. The anchor is on the client and the variable is on the server.
B. href="Encode.asp?name=" > click here
60. 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 option.E. Requires all variables be cast as specific
DataTypes.
61. <% varType = rsTest("field1").type %>,br> 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.
D. NULL.
E. An enumerator.
62. How are sessions maintained?
A. The browser sends a cookie to the server with each request.
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.
63. 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.
64. 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 handler.
D. Instantiating the component in the global.asa file.
E. Using thetag.
65. Client Certificate is a collection of
A. Server
B. Response
C. Request
D. ObjectContext
66. IsClientConnected is a property of
A. Server
B. Response
C. Request
D. Session
67. 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
68. ADO is an object model for accessing which of the following?
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.
69. Which choice is NOT an ADO collection?
A. Properties
B. Records
C. Fields
D. Errors
E. Parameters
70. < %@ Language=VBScript % >
< %If false then >
< !-- #INCLUDE FILE="FunctionOne.inc"-->
< %Else >
< !-- #INCLUDE FILE="FunctionTwo.inc"-->
< %End If >
What would the above code load?
A. Only the FunctionTwo.inc file into the ASP page.
B. Both files, since Server Side Includes are processed before ASP interpreting.
C. Only the FunctionOne.inc 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.
71. 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")
72. Which choice is NOT a property of Dictionary Object?
A. Key()
B. CompareMode
C. Item ()
D. Exists ()
E. Count
73. What does Internet Information Server (IIS) assume to be the default language for
Active Server Pages?
A. Jscript
B. JavaScript
C. JAVA
D. VBScript
E. ECMAScript
74. < % Set Application("Thing") = Server.CreateObject("THINGDOER.thingy") % > The
above code appears in the global.asa file. What would it accomplish?
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 Static Objects 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.
75. < % Response.Redirect("http://www.sql.com") % > 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 "http://www.matsystems.com" 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.
Top
76. What purpose is served by the Application. Lock method?
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 collection.
77. How long is a SessionID guaranteed to be unique?
A. It is unique for the web server, whether it is restarted or not.
B. Only until the web server is restarted.
C. It is like a GUID in that it is for any web server at any time.
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
78. Which of the following are Server Object methods ( Choose Two)
A. HTMLEncode,MapPath --
B. URLEncode,ScriptTimeout
C. URLEncode,CreateObject -- (
D. ScriptTimeout,Abandon
79. 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
80. < input type=radio name=rbSex value="M" > Male <Input type=radio name=rbSex
value="F">Female 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
Next
B. strSex = Request("rbSex").selected.value
C. strSex = Request("rbSex") (Answer)
D. strSex = Request.rbSex.value
E. For Each value in rbSex
If rbSex.selected = true
strSex = value
exit for
Next
81. How to Display images using Response object?
A. Contenttype=Application/Brush
B. Contenttype=Image/JPG (Answer)
C. Contenttype=Application/paint
D. Contenttype=Image/WMF
82. 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.
(Answer)
83. Following is the code Server.MapPath (".") consider the path is
C:InetpubWWWRootMATDefault.asp. What will be the output
A. C:InetPUb
B. C:InetPUbWWWroot
C. C:InetPUbwwwrootMAT
D. Error
84. ‘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.
85. 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 client. (Answer)
B. Only files and subdirectories in the web site’s home directory.
C. Any local physical drive or mapped drive on the web server.
D. Any file system physically located on the web server.
E. The client’s computer.
86. When does the application On End event handler fire?
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 document.
C. When the web server is stopped in an orderly fashion. (Answer)
D. Twenty minutes after the last request for a document in the application.
E. When there are no application requests for the amount of time defined by the Session Timeout
variable.
87. What is the program ID (ProgID) for ActiveX Data Objects in 2-tier and 3-tier
database applications?
A. ADO
B. RDODB
C. ADODB (Answer)
D. RDS
E. OLEDB
88. What should the developer use in order to have an Active Server Page (ASP) invokes
a stored procedure on a SQL Server database?
A. ADO
B. RDO
C. RDS
D. OLEDB
E. None of the above.
88. How Many Types of Cookies?
A. 3
B. 2
C. 1
D. 4
89. What is the Default ScriptTimeOut for Server Object?
A. 20 Sec
B. 30 Sec
C. 60 Sec
D. 90 Sec
90. How many Max Cookies can we create in Server?
A. 10
B. 20
C. 30
D. 40
91. < SCRIPT LANGUAGE="VBScript" RUNAT=Server > a = 1 < /SCRIPT > < SCRIPT
LANGUAGE="VBScript" > a = 2 < /SCRIPT > < % Response.Write a % < In the sample
code shown above, what will be written to the screen?
A. 1
B. 2
C. 1, 2
D. 1&2
E. Nothing. (Answer)
Top
92. < % 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 (Answer)
93. Which-code sample will report whether the client’s browser supports cookies?
A. B. You can only use JavaScript for this.
C. D. (Answer)
E.
94. What is a session?
A user accessing an application is known as a session.
95. What is ClientCertificate collection?
A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. This stores
details of any security certificates included with the request.
96. What do you need to run ASP?
A browser and a Web server
97. What do you need to run ASP?
1) It informs each page what session the request belongs to when a user accesses during a session.
2) It retrieves all the session information stored on the server.
3) Cookies can persist for a much longer period of time than session that has a timeout value
usually of 20 minutes and hence can store information even when a user is off the site.
98. What is the order of execution for an ASP application?
1) Global.asa
2) Server-side Includes
3) Jscript scripts tagged within
99. 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
100. 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
101. What are the event handlers of Session Object?
Session _OnStart This event will be fired when a new user begins a session with the web site.
Session_OnEnd This event is called whenever a session terminates.
102. Name the ASP Objects?
Request Object
Response Object
Server Object
Session Object
Application Object
103. 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 machine
Provides improved security measures since the script cannot be viewed by the browser
104. 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.
105. What are the methods in Application Object?
Internet Information Server (IIS) on Windows NT
Personal Web Server (PWS) on Windows 95
Peer Web Services on Windows NT
106. 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)
107. How does the server identify and execute the server-side scripts within HTML code?
Including the RUNAT=SERVER attribute in the
108. 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.
109. What are the methods by which output stream is controlled?
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 expires.
Expires Absolute sets the date and time at which a page cached on a browser expires.
Top
110. 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
111. 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
112. 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.
113. 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
114. What are the tasks performed by < FORM > tags?
tags provides space for the user to input values
the form has a button to submit information back to the server
It transfers control to another ASP page
It carries the information in the fields to another ASP page
115. What are the tags necessary to be present within the <FORM > tag?
-----tag: Provides input spaces (text boxes, combo boxes, radio button, etc.) on a form called fields.
It has three attributes TYPE, NAME and VALUE. TYPE provides the characteristics of the field and the
NAME specifies a name to the field by which it can be referred.
116. How will you set the values for cookies?
117. 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
118. Arrays can be resized by using the keyword REDIM?
119. What are Constants? How will you declare a constant?
120. Where will you code OPTION EXPLICIT in an ASP application?
121. What is the Order of precedence for ARITHMETIC Operators. ^, -(negation), *or /, ,
mod, + or – WHY?
122. What is diffrence between Server.transfer and Response.redirect?
The Redirect method causes the browser to redirect the client to a different URL.
Syntax : Response.Redirect(URL)
The Transfer method sends all of the information that has been assembled for processing by one
.asp file to a second .asp file.
Syntax : Server.Transfer(PATH)
123. What does Server.MapPath do?
The Map Path method maps the specified relative or virtual path to the corresponding physical
directory on the server.
Name at least three methods of response object other than Redirect
AddHeader,AppendToLog,BinaryWrite,Clear,End,Flush,Write
Name at least three methods of server(typo in the question) object other than Transfer
CreateObject,Execute,GetLastError,HTMLEncode,MapPath,URLEncode,