ASP Grade B
1. <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. 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 <OBJECT> tag. 8. How to handle Error in ASP A. Using On Error Goto <ErrorPart> 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 Users 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 <OBJECT> tag. · Static collection contains all the objects created with the <OBJECT> 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.