Skip to main content

Web Application Development MCQs with Answers

Practice important Web Application Development MCQs with answers and explanations.

Multiple Choice Questions

Q81: What will be the output of <?php setcookie("user", "Ahmed"); echo $_COOKIE["user"]; ?> after setting the cookie?
  • A: Ahmed
  • B: Empty
  • C: "user"
  • D: Error
View Answer
A

Q82: What happens if you use setcookie() with an expiration date in the past?
  • A: The cookie is deleted
  • B: The cookie value is unchanged
  • C: The cookie value is modified
  • D: An error occurs
View Answer
A

Q83: Fill in the blank: To check if cookies are enabled, count the number of elements in the _______.
  • A: $_COOKIE
  • B: $_SESSION
  • C: $_POST
  • D: $_GET
View Answer
A

Q84: What is the output of <?php date_default_timezone_set("Asia/Karachi"); echo date("h:i:sa"); ?>?
  • A: The current time in Asia/Karachi timezone
  • B: The current time in GMT
  • C: An error message
  • D: The time in UTC
View Answer
A

Q85: Fill in the blank: The setcookie() function must be called _______ the <html> tag.
  • A: before
  • B: after
  • C: during
  • D: at the end
View Answer
A

Q86: What will be the output of <?php $cookie_name = "user"; setcookie($cookie_name, "Ahmed", time() - 3600); ?>?
  • A: Cookie 'user' is deleted
  • B: Cookie 'user' is set
  • C: Error
  • D: No output
View Answer
A

Q87: Fill in the blank: The date() function can format time using characters like h, i, and s for _______.
  • A: hours, minutes, seconds
  • B: dates and years
  • C: day of the week
  • D: URL encoding
View Answer
A

Q88: What function is used to start a session in PHP?
  • A: session_start()
  • B: start_session()
  • C: begin_session()
  • D: init_session()
View Answer
A

Q89: Fill in the blank: Session variables in PHP are stored in _______ and are used across several pages.
  • A: the server
  • B: the user’s computer
  • C: a database
  • D: a file
View Answer
A

Q90: How do you access session variable values on a new page?
  • A: Use $_SESSION global variable
  • B: Use session_get()
  • C: Use session_value()
  • D: Use get_session()
View Answer
A

Test Your Knowledge

Take a timed quiz on Web Application Development

🚀 Start Quiz Now