Web Application Development MCQs with Answers

Practice important Web Application Development MCQs with answers and explanations.

Multiple Choice Questions

Q161: What must be set in php.ini to allow file uploads in PHP?
  • A: file_uploads = Off
  • B: file_uploads = On
  • C: upload_max_filesize = 10M
  • D: max_execution_time = 30
View Answer
B

Q162: Which directory should be created to store uploaded files according to the PHP file upload example?
  • A: uploads
  • B: files
  • C: temp
  • D: images
View Answer
A

Q163: What is checked first in the PHP file upload script to ensure a file is an image?
  • A: The file size
  • B: The file extension
  • C: The file's MIME type
  • D: The file's name
View Answer
C

Q164: What message is displayed if a file already exists in the upload directory?
  • A: "File uploaded successfully."
  • B: "File is too large."
  • C: "Sorry, file already exists."
  • D: "File type not allowed."
View Answer
C

Q165: What PHP function checks if a file is an actual image or not?
  • A: getimagesize()
  • B: pathinfo()
  • C: file_exists()
  • D: move_uploaded_file()
View Answer
A

Q166: What is the purpose of the fwrite() function in PHP?
  • A: To create a file
  • B: To write data to a file
  • C: To delete a file
  • D: To read data from a file
View Answer
B

Q167: What does the "try" block in PHP exception handling do?
  • A: Catches exceptions
  • B: Throws exceptions
  • C: Contains code that may throw exceptions
  • D: Defines custom exception classes
View Answer
C

Q168: How does a custom exception class in PHP differ from the standard Exception class?
  • A: It includes additional methods
  • B: It cannot be used to throw exceptions
  • C: It is not extendable
  • D: It changes the way exceptions are caught
View Answer
A

Q169: Which method in a custom exception class provides a custom error message?
  • A: getMessage()
  • B: errorMessage()
  • C: getCode()
  • D: getFile()
View Answer
B

Q170: What does the move_uploaded_file() function do in the PHP file upload process?
  • A: Moves the file to a temporary location
  • B: Moves the file to the final destination
  • C: Deletes the file after upload
  • D: Validates the file type
View Answer
B

Test Your Knowledge

Take a timed quiz on Web Application Development

🚀 Start Quiz Now