ASP Programming Interview Questions and Answers

1. What is ASP?
ASP stands for Active Server Pages. It is a server side technology which is used to display dynamic content on web pages. For example you could write code that would give your visitors different information, different images or even a totally different page depending on what browser version they are using.
2. How can you disable the browser to view the code?
Writing codes within the Tag
3. 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.
4. Give the comment Tags for the following?
VBScript : REM & ‘(apostrophe)
JavaScript : // (single line comment)
/* starting multi line comments
(Multi-line comments)
ending multi line comments */
5. Which is the default Scripting Language of ASP (server-side)?
default Scripting Language of ASP is VBScript
6. Which is the default Data types in VBScript?
Variant is the default data type in VBScript, which can store a value of any type.
7. What is a variable in ASP?
Variable is a memory location through which the actual values are stored/retrieved. Its value can be changed.
8. What is the maximum size of an array in ASP?
Maximum size of an array in ASP is up to 60 dimensions.
9. What is Querystring collection in ASP?
Querystring 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
10. 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
11. What are the methods in Session Object in ASP?
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.
12. What is ServerVariables collection in ASP?
The ServerVariables collection in ASP holds the entire HTTP headers and also additional items of information about the server.
13. What is the difference between Querystring collection and Form collection?
The main difference is that the Querystring collection in ASP gets appended to a URL.
14. What is a Form collection in ASP?
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.
15. What are the ASP Scripting Objects?
The Objects in ASP are Dictionary object, the FileSystemObject object, TextStream object.
16. What happens to a HTML page in ASP?
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. How can you change the primary scripting language for a page?
Specify yourself
19. What is application Object in ASP?
Application Object in ASP shares information among users of an application. Gives a notification when an application starts or ends.
20. 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.
21. What is the command to display characters to the HTML page in ASP?
Command to display characters to the HTML page in ASP is:
Response.Write(“www.interview4All.com”)
22. Explain the POST & GET Method or Explain the difference between them in ASP?
POST METHOD in ASP:
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 in ASP:
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.
23. How many global.asa files can an Application have in ASP?
Only one global.asa file and it’s placed in the virtual directory’s root in ASP.
24. What are Scripting Objects in ASP?
Scripting Objects that can enhance the application are known as the Scripting Objects.
25. What is the Order of precedence for LOGICAL Operators in ASP?
Order of precedence for LOGICAL Operators in ASP are as under:
NOT, AND, OR, XOR, EQV, IMP
26. 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.
27. What is the maximum size of an array?
Up to 60 dimensions
28. What is Collection?
Collection is a set of name/value pairs where the information supplied by the client is stored.
29. What is Request Object?
It 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.
30. What is Extranet?
Extranet is an area of a web site available only to a set of registered visitors.
31. 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.
32. Which is the default Scripting Language of ASP (server-side)?
VBScript
33. What is Query string collection?
This collection stores any values that are provided in the URL.
This can be generated by three methods:
34. How many global.asa files can an Application have?
Only one global.asa file and it’s placed in the virtual directory’s root.
35. 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.
36. What is a variable?
Variable is a memory location through which the actual values are stored/retrieved. Its value can be changed.
37. Explain the POST and 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 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.
38. What is Server Variables collection?
The Server Variables collection holds the entire HTTP headers and also additional items of information about the server.
39. How to include Active x controls in ASP code?
You can include Activex Control using OBJECT tag.
Syntax for including Activex control is
40. 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.
41. What is the difference between client-side script and server-side script?
Scripts executed only by the browser without contacting the server are called as 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.
42. How to handle Error in ASP
A. Using On Error Goto
B. Using On Error Resume
C. Using On Error Resume Next (Answer)
D. Using On Error Goto 0
43. How to Display images using Response object?
A. Contenttype=Application/Brush
B. Contenttype=Image/JPG (Answer)
C. Contenttype=Application/paint
D. Contenttype=Image/WMF
44. What is Application-scope?
Application-scope means that variables (and objects) can be accessed from any ASP pages that are part of the application.
45. What is Server Object?
Server Object controls the ASP execution environment. It can set the amount of time script can run before an error occurs. It 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.
46. How will you delete a Cookie?
By setting its Expires property to any date prior to today Response.Cookies (“cookie name”).Expires = Date? 1.
47. 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
48. 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.
49. 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
50. Name the ASP Objects?
1. Session Object
2. Application Object
3. Server Object
4. Request Object
5. Response Object
6. Object Context
7. Error Object
51. 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.
52. 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.
53. What is the difference between Server-side validation and Client-side validation?
Client-side is faster than server-side as the networking time from client to server is saved
server-side is done on the server. Then the server converts the data into an html page and sends to the browser. Server-side is more secure as the user cannot see the code even he does a view-source.
54. What are the differences between ASP and ASP.NET and is ASP.NET backward compatible to ASP?
ASP page is non compiled version i.e. the ASP compiler (interpreter) executes each line of ASP page when the request for a particular page is made, where as ASP.NET page is the pre-compiled version. When we compile the ASP.NET page, the .NET compiler compiles the ASP.NET page to the UI assembly.
55. What is an Err Object?
The ASP Error object is used to display detailed information of any error that occurs in scripts in an ASP page.
56. What are the event handlers of Session Object?
Session _On Start? 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.
57. What is the difference between Cookies collection and Form/Querystring 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/Querystring cookie each value has to be referred using an index value.
58. What is an .ASP file?
It is a Text File that contains the combination of the following:
Text
HTML tags
Script Commands
59. 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. (Answer)
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.
60. What is Global.asa file?
It is text file that contains details about an ASP application, such as when it should begin and end.
61. 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.
An ASP file can contain text, HTML tags. And scripts. Scripts in an ASP file are executed on the server.
62. How Many Types of Cookies?
3
63. What is Session Object?
It stores information about a User’s session. It gives a notification when a user session begins or ends.
64. 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.
65. What are the tasks performed by
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
66. What are Scripting Objects?
Objects that can enhance the application are known as the Scripting Objects.
67. 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
The ASP Response object is used to send output to the user from the server.
68. Can be Arrays resized by using the keyword REDIM?
Yes, we can resize using the word redim.
69. What is the function of Buffer in Response Object?
Buffer controls the HTML output stream manually.
70. What is the command to display characters to the HTML page?
Typically, a servlet class is instantiated the first time it is invoked. The same instance will be used over several client requests, so all members that are declared in that servlet are shared across clients. That is What is meant by multi threaded model, multiple clients that access the same instance.
There are situations where you want to protect your servlet member variables from being modified by different clients. In this case, you can have your servlet implement the marker interface SingleThreadModel. Every time a client makes a request to a servlet that implements this interface, the engine will create a new instance of the servlet. For performance reasons, the engine can also maintain an instance pool, handing out instances as they are needed. Or it could also serialize client requests, executing one after another.
71. How to insert the records in a database table by using ASP?
<%
‘Open a Connection with database
Dim DSN
DSN=”Provider=SQLOLEDB.1; Persist security info=false; user id=sa; password=main; initial catalog=database name Data Source=localhost”
set objCon=Server.CreateObject(“ADODB.Connection”)
objCon.Open DSN
%>
<%
‘Get the Query
Dim SQL
SQL=”insert into tablename values(‘a’,’b’,’c’)”
%>
<%
‘Insert Into Database
objCon.Execute(SQL)
%>
72. What is http header?
HTTP headers expose a great deal of information about your client as well as the server you are working, the application you are designing, as well as the environment you are in (SSL, etc.).The functionality for this is held in “Request.ServerVariables”, so you only need to access that. For example, Request.ServerVariables(“ALL_HTTP”) or Request.ServerVariables(“HTTP_USER_AGENT”). You need to know the specific name of the header that you want.
It is extremely simple to display all the HTTP headers in ASP. Here’s a code snippit that will do it for you: < % for each header in Request.ServerVariables response.write header & ” = ” & Request.ServerVariables (header) & ” < br>< br> ” next % >Just delete the spaces near the angle brackets and run it on IIS. You’ll get a list of all the HTTP headers along with the actual value for the header. Make sure to try this with different browsers and on different computers with different operating systems if you can. You’ll immediately see the differences.
73. What is MSMQ? What is N-tier System?
Microsoft Message Queuing is a window’s component.
74. Explain life cycle of ASP page.
Active server pages are executed with the help of compiler and then it sent to the MSIL (MICROSOFT INTERMEDIATE LANGUAGE) and then it is sent to cache memory and finally it will be executed in the portable device. Cache will be used between the MSIL to increase the speed of the process. This is the process of the ASP life cycle.
75. What are the tools used for editing in IIS?
The MetaEdit 2.2 utility is used to help to troubleshoot issues and to modify IIS metabase values. MtaEdt22.exe file is a downloadable, self-extracting file that contains the IIS MetaEdit 2.2 utility.
76. What are the special sub-types in VBScript?
Subtype Explanation
Empty Variant is not initialized. Value is either zero for numeric variables or a zero-length string (“”) for string variables.
Null Variant intentionally contains no valid data.
Boolean Contains either True or False.
Byte Contains integer in the range zero to 255
Integer Contains integer in the range -32,768 to 32,767
Long Contains integer in the range -2,147,483,648 to 2,147,483,647
Single Contains a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.
Double Contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values
Date (Time) Contains a number that represents a date between January 1, 100 to December 31, 9999
String Contains a variable-length string that can be up to about 2 billion characters in length
Object Contains an OLE Automation object.
Error contains an error number.
77. What is a File System Object object?
The File System Object is used to access the file system on the server. This object can manipulate files, folders, and directory paths. It is also possible to retrieve file system information with this object.
78. What does Server.Map Path 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.
Add Header, Append To Log, Binary Write, Clear, End, Flush, Write
79. What is Querystring 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
it allows you to extract data sent to the server using a GET request.
80. 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 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
81. 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.
82. What is application Object?
Shares information among users of an application. Gives a notification when an application starts or ends.
83. What is the Order of precedence for LOGICAL Operators.
NOT, AND, OR, XOR, EQV, IMP
84. Which is the default Scripting Language on the client side?
JavaScript
85. 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.
86. 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.
87. 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.
88. 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.
89. 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)
90. What is ClientCertificate collection?
A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. These stores details of any security certificates included with the request.
91. What do you need to run ASP?
A browser and a Web server
92. What is the order of execution for an ASP application?
1) Global.asa
2) Server-side Includes
3) Jscript scripts tagged within
93. 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
94. 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
95. Name the ASP Objects?
Request Object
Response Object
Server Object
Session Object
Application Object
96. 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
97. 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.
98. 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)
99. 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.
100. 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

Related

Interview Questions 3961503122334019114

Post a Comment

emo-but-icon

item