Friday, July 25, 2008

ASP FAQ's 3


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
option.
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
C. JAVA
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?

A. ADO
B. RDO
C. RDS
D. OLEDB
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
Object


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

10. How many Max Cookies can we Create in
Server


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
machine
· 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)?

VBScript

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

JavaScript

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

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

REDIM

30. What is the maximum size of an array?

Up to 60 dimensions.

ASP OBJECTS

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

ASP FAQ's 2

1. 


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

2. <%
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 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.
D. NULL.
E. An enumerator.

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


A. ADO
B. RDODB
C. ADODB

D. RDS
E. OLEDB


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


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
C:\Inetpub\WWWRoot\MAT\Default.asp
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.

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.

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

Response.Write

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)
OBJECT:

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

NOT, AND, OR, XOR, EQV, IMP

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
expires.
· 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.

ASP FAQ's 1

 

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
use?


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%>

<%Else%>

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


3. <% 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.


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

5. When does the application OnEnd 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.

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
SessionTimeout variable.

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

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
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")

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

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

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.

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

11. How to Display images using Response
object


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

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


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


13. Which choice is NOT a property of Dictionary
Object?


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

Some Limitation or Disadvantage of XML?
XML markup has a few disadvantages:
It can be verbose unless element and attribute names are chosen with care. In large documents the markup overhead need not be large, but in short messages it can be significantly more than the actual data, especially when the element or attribute names are concocted by machine.

Overlapping markup is not permitted (an element cannot start inside one element and end inside another): element markup must nest hierarchically.

How to add in XML document through XSL ?
XSL (the eXtensible Stylesheet Language) is far more sophisticated than CSS. One way to use XSL is to transform XML into HTML before it is displayed by the browser as demonstrated in these examples:
Below is a fraction of the XML file. The second line,
, links the XML file to the XSL file:




Belgian Waffles
$5.95

two of our famous Belgian Waffles

650



How do I convert my existing HTML documents into XML?
Tidy is a command-line utility which runs on a wide variety of operating systems; it uses various command-line switches (parameters) to control its processing. At a minimum, it simply cleans up your HTML by ensuring that elements are properly nested and so on; it also warns you if your HTML uses non-standard code that's likely to cause cross-browser compatibility problems. One of the most useful command-line options is -asxml ("as XML," see?), which does what you seem to be asking. It will properly balance elements, per usual, but it also adds some extra information to the document. For instance, it tacks on an XML declaration, , and a statement, which unambiguously mark this as an XML document. To the root html element it also adds a namespace-declaring attribute that identifies all elements in the document as conforming to the specific XML vocabulary known as XHTML. It even forces all element names to lowercase, since the XHTML standard requires it.

If you're asking about converting HTML to a less generic form of XML than XHTML, your task may turn out to be quite complex. For example, if you've been using HTML to mark up customer invoices, not only the customer's name but also their number, item(s) ordered, quantity, and price are probably all wrapped up inside

and

tags. How do you know which "kind of paragraph" contains a given kind of information, so you can turn one instance of the p element into a custname element, another into custnumber, another into price, and so on? If you've been using CSS for styling your HTML, you may have supplied the different p elements with class="custname" (etc.) attributes and so on; if that's the case, you may be able to generate meaningful XML using an XSLT stylesheet. There may also be customized software to do the sort of conversion you want. Otherwise you're probably looking down the barrel of an ugly gun.


What is a schema? What are the limitations of a DTD?
SCHEMA is nothing but METADATA. The schema holds all the information of the xml file that is to be deployed in the project. Metatdata is nothing about data about data since we know that xml is used for data representation language we will be able to understand what metadata is. Metadata includes the tags that is going to be exchanged to and fro from another xml file. DTD (DATA TYPE DEFINITION ) which supervises two conditions namely well formedness and closeness of the xml file. So the user should be aware of what tags he was put into use of this xml file 'A' should be intimated to another application's XML file 'B', by then our xml file will interact with the another xml file, this is the major limitat ion and mandatory issue that the developers should follow.