Learn ASP MCQs
Prepare ASP MCQs (Multiple choice Questions) for exam and job interviews.
How can you include a server-side script in an ASP page?
1) <!--#include virtual="file.asp" -->
2) <script src="file.asp"></script>
3) <import src="file.asp">
4) <link href="file.asp">
Answer : <!--#include virtual="file.asp" -->
What is the purpose of the Response.AddHeader method?
1) To add HTTP headers to the response
2) To redirect the user
3) To output content
4) To modify session data
Answer : To add HTTP headers to the response
How do you retrieve the user’s IP address in ASP?
1) Request.ServerVariables("REMOTE_ADDR")
2) Request.UserIP
3) Request.IPAddress
4) Request.GetRemoteAddr()
Answer : Request.ServerVariables("REMOTE_ADDR")
What is the use of the Response.Flush method?
1) To send the current buffer to the client
2) To end the response
3) To clear the buffer
4) To start a new response
Answer : To send the current buffer to the client
How can you write a message to the error log in ASP?
1) Server.LogError("error message")
2) Response.WriteError("error message")
3) Application.Log("error message")
4) Err.Raise("error message")
Answer : Application.Log("error message")
Which method is used to send a file to the client in ASP?
1) Response.BinaryWrite
2) Response.SendFile
3) Response.WriteFile
4) Response.OutputFile
Answer : Response.BinaryWrite
What is the purpose of the Session.Timeout property?
1) To set the duration of the session
2) To limit user access
3) To control application variables
4) To handle file uploads
Answer : To set the duration of the session
Which statement is used to create a new session in ASP?
1) Session("variable") = value
2) CreateSession("variable") = value
3) NewSession("variable") = value
4) StartSession("variable") = value
Answer : Session("variable") = value
How do you access the current page’s URL in ASP?
1) Request.ServerVariables("SCRIPT_NAME")
2) Request.Url
3) Server.CurrentPageUrl()
4) Request.GetCurrentUrl()
Answer : Request.ServerVariables("SCRIPT_NAME")
What does the Response.Write method do in ASP?
1) Writes data to the HTTP response
2) Creates a new session
3) Sends an email
4) Processes form data
Answer : Writes data to the HTTP response