Learn ASP MCQs
Prepare ASP MCQs (Multiple choice Questions) for exam and job interviews.
What will the following code output: Response.Write(1 + "1")?
1) 11
2) 2
3) Error
4) 1 1
Answer : 11
How do you declare a variable in ASP?
1) Dim variableName
2) Var variableName
3) Let variableName
4) Declare variableName
Answer : Dim variableName
Which function is used to trim whitespace from a string in ASP?
1) Trim()
2) LTrim()
3) RTrim()
4) All of the above
Answer : All of the above
How do you handle errors in ASP?
1) On Error Resume Next
2) Try Catch
3) Error Handling
4) Handle Errors
Answer : On Error Resume Next
What does the Session.Timeout property specify?
1) Duration of the session
2) Session ID length
3) User inactivity period
4) Maximum number of sessions
Answer : Duration of the session
How do you redirect to another page in ASP?
1) Response.Redirect("page.asp")
2) Redirect("page.asp")
3) Response.Goto("page.asp")
4) Response.Change("page.asp")
Answer : Response.Redirect("page.asp")
Which method is used to write a cookie in ASP?
1) Response.Cookies("name")
2) Request.Cookies("name")
3) Session.Cookies("name")
4) Set-Cookie
Answer : Response.Cookies("name")
What is the function of the Server.MapPath method?
1) To get the physical path of a file
2) To redirect the user
3) To create a new file
4) To write to a file
Answer : To get the physical path of a file
How do you create a session variable in ASP?
1) Session("variable") = value
2) Dim Session("variable") = value
3) Set Session("variable") = value
4) Create Session("variable") = value
Answer : Session("variable") = value
What does the Application object store?
1) Global variables
2) User-specific data
3) Session variables
4) Cookies
Answer : Global variables