ASP Interview Questions
ASP Interview Questions
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.
/* */ (Multi-line comments)
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.
Up to 60 dimensions.
methods:
By clicking on an anchor tag By sending a form to the server by the GET method Through user-
9. What are the attributes of the tags? What are their functions?
The ACTION gives the name of the ASP file that should be opened next by which this file can access
The METHOD determines which of the two ways (POST or GET) the browser can send the
The Session Object has only one method, which is Abandon. It destroys all the objects stored in a
The Server Variables collection holds the entire HTTP headers and also additional items of
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.
The Form collection holds the values of the form elements submitted with the POST method. This is
The browser makes a HTTP request; the server gives a HTTP response to the browser and the
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
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.
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
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.
Only one global.asa file and it’s placed in the virtual directory’s root.
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.
JavaScript
It’s a method by which web pages can be built and generally used for formatting and linking text.
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.
It stores information about a User’s session. Gives a notification when a user session begins or
ends.
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
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.
It permits to create more interactive Web Pages. Validation, formatting of web pages can be done.
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.
It is text file that contains details about an ASP application, such as when it should begin and end.
Text
HTML tags
Script Commands
It controls the information sent to the user. The various methods are:
Response. Redirect - Directs a user to a URL other than the requested URL
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
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.
Gets information from the user. It has five collections by which values can be accessed. They are:
OBJECT:
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
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
error occurs. Converts a virtual path to a physical path on the server. Takes a user supplied string
Collection is a set of name/value pairs where the information supplied by the client is stored.
By setting its Expires property to any date prior to today Response.Cookies("cookie name"). Expires
= Date 1.
ASP provides scripting engines that execute the corresponding scripting languages on the server
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.
Arrays are variables that store items of similar information. DIM ARRAY1(4) (declares an array with
Application-scope means that variables (and objects) can be accessed from any ASP pages that is
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
%>
C. 0
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
A. This cannot be done. The anchor is on the client and the variable is on the server.
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
B. A string description.
D. NULL.
E. An enumerator.
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.
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
64. Which will NOT set the scope of an Active Server Component?
E. Using thetag.
A. Server
B. Response
C. Request
D. ObjectContext
A. Server
B. Response
C. Request
D. Session
67. What should be used in order to determine if the cookie "FavoriteFlavors" in the
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
A. Properties
B. Records
C. Fields
D. Errors
E. Parameters
B. Both files, since Server Side Includes are processed before ASP interpreting.
D. Neither file, since Server Side Includes are processed before ASP interpreting.
71. Which line of code would instantiate the Browser Capabilities component?
A. objBrowser = Server.CreateObject("MSWC.BrowserType")
A. Key()
B. CompareMode
C. Item ()
D. Exists ()
E. Count
73. What does Internet Information Server (IIS) assume to be the default language for
A. Jscript
B. JavaScript
C. JAVA
D. VBScript
E. ECMAScript
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
accomplish?
A. It sends the browser the line of sample code, and the browser executes it.
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
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.
D. It locks the Application object, preventing other clients from reading any values in the Content
collection.
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
strSex = rbSex(cnt).value
exit for
End If
Next
B. strSex = Request("rbSex").selected.value
D. strSex = Request.rbSex.value
If rbSex.selected = true
strSex = value
exit for
Next
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?
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)
A. C:InetPUb
B. C:InetPUbWWWroot
C. C:InetPUbwwwrootMAT
D. Error
A. Application only.
B. Session only.
C. Server only.
85. The FileSystemObject provides an object interface to drives, directories, and files for
A. Any local or mapped drive on either the server or the client. (Answer)
A. After every request for an application document, since web servers are stateless servers.
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. ADO
B. RDO
C. RDS
D. OLEDB
A. 3
B. 2
C. 1
D. 4
A. 20 Sec
B. 30 Sec
C. 60 Sec
D. 90 Sec
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
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?
C. D. (Answer)
E.
A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. This stores
1) It informs each page what session the request belongs to when a user accesses during a session.
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.
2) Server-side Includes
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
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
Session _OnStart This event will be fired when a new user begins a session with the web site.
Request Object
Response Object
Server Object
Session Object
Application Object
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
Unlock removes the lock from variables stored in the Application object.
106. What are the browsers that can access ASP pages?
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?
Flush sends previous buffered output to the client immediately, but continues processing the script.
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
Contents collection contains all the variables established for a session without using the tag.
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.
- 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
Application_OnStart- This event will be fired when the first visitor hits the page.
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.
114. What are the tasks performed by < FORM > tags?
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
121. What is the Order of precedence for ARITHMETIC Operators. ^, -(negation), *or /, ,
mod, + or – WHY?
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
Syntax : Server.Transfer(PATH)
The Map Path method maps the specified relative or virtual path to the corresponding physical
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,