Web Application Development MCQs with Answers
Practice important Web Application Development MCQs with answers and explanations.
Multiple Choice Questions
Q71: What is the output of <?php $a = array(1, 2, 3); foreach ($a as $value) { echo $value; } ?>?
- A: 123
- B: 1 2 3
- C: Array
- D: 1,2,3
View Answer
A
Q72: Fill in the blank: The do-while loop executes the code block _______ checking the condition.
- A: after
- B: before
- C: every iteration
- D: in a loop
View Answer
A
Q73: What will be the output of <?php $i = 0; for (; $i < 3; $i++) { echo $i . " "; } ?>?
- A: 0 1 2
- B: 1 2 3
- C: 0 1 2 3
- D: 1 2 3
View Answer
A
Q74: Fill in the blank: The while loop will continue executing as long as the _______ is true.
- A: initialization
- B: condition
- C: increment/decrement
- D: code block
View Answer
B
Q75: What does the include statement in PHP do?
- A: Executes code from another file
- B: Defines a new variable
- C: Deletes a file
- D: Formats date/time
View Answer
A
Q76: Fill in the blank: The date() function in PHP can format a timestamp to a more _______.
- A: readable date and time
- B: secure format
- C: encrypted format
- D: machine-readable format
View Answer
A
Q77: What is the output of <?php echo date("Y-m-d"); ?> if today’s date is September 1, 2024?
- A: 45536
- B: 45300
- C: 45536
- D: 45536
View Answer
A
Q78: Fill in the blank: To automatically update the copyright year on a website, use date("Y") with _______.
- A: © 2010-
- B: © 2024-
- C: © 2000-
- D: © 1990-
View Answer
A
Q79: What is the purpose of the date_default_timezone_set() function in PHP?
- A: To set the default timezone for date/time functions
- B: To format date and time
- C: To create a new cookie
- D: To include another PHP file
View Answer
A
Q80: Fill in the blank: Cookies in PHP are used to _______ users.
- A: identify
- B: delete
- C: format dates
- D: include files
View Answer
A