Learn ASP MCQs
Prepare ASP MCQs (Multiple choice Questions) for exam and job interviews.
What will the following code output: Response.Write(5 & 2)?
1) 7
2) 52
3) Error
4) 5 2
Answer : 52
Which method is used to create a new session in ASP?
1) Session("variable") = value
2) CreateSession("variable") = value
3) Session.Create("variable")
4) NewSession("variable") = value
Answer : Session("variable") = value
What is the default scope of a session variable in ASP?
1) Session
2) Application
3) Global
4) Local
Answer : Session
How can you access the current user`s IP address in ASP?
1) Request.ServerVariables("REMOTE_ADDR")
2) Request.UserHostAddress
3) Client.IPAddress
4) Request.IP
Answer : Request.ServerVariables("REMOTE_ADDR")
Which event is triggered when a session starts in ASP?
1) Session_OnStart
2) Application_OnStart
3) Session_OnEnd
4) Application_OnEnd
Answer : Session_OnStart
How do you include an ASP file within another ASP file?
1) <!--#include file="filename.asp" -->
2) <import src="filename.asp">
3) <link href="filename.asp">
4) <script src="filename.asp"></script>
Answer : <!--#include file="filename.asp" -->
What is the correct syntax to create a constant in ASP?
1) Const ConstantName = value
2) Let ConstantName = value
3) Dim ConstantName = value
4) Define ConstantName = value
Answer : Const ConstantName = value
Which statement is used to set a response header in ASP?
1) Response.AddHeader
2) Response.Headers.Add
3) Response.SetHeader
4) Response.Add
Answer : Response.AddHeader
What is the default data type for a variable in ASP?
1) Variant
2) String
3) Integer
4) Boolean
Answer : Variant
How do you convert a string to an integer in ASP?
1) CInt("string")
2) Convert.ToInt("string")
3) Integer("string")
4) ParseInt("string")
Answer : CInt("string")