Web Application Development MCQs with Answers
Practice important Web Application Development MCQs with answers and explanations.
Multiple Choice Questions
Q51: What will be the output of <?php $x = 10; $y = 5; $z = $x - $y; echo $z; ?>?
- A: 5
- B: 10
- C: 15
- D: 20
View Answer
A
Q52: Fill in the blank: To decrement a variable in PHP, use the _______ operator.
- A: --
- B: ++
- C: =
- D: .
View Answer
A
Q53: What does the if statement do in PHP?
- A: Executes code based on multiple conditions
- B: Executes code if the condition is true
- C: Executes code if the condition is false
- D: Executes code in all cases
View Answer
B
Q54: Fill in the blank: In PHP, the if statement should enclose multiple statements within _______.
- A: parentheses
- B: square brackets
- C: curly braces
- D: angle brackets
View Answer
C
Q55: Which PHP control structure is used to select one of several blocks of code to be executed?
- A: if statement
- B: switch statement
- C: multiple if statements
- D: while loop
View Answer
B
Q56: Fill in the blank: The switch statement in PHP is used to avoid _______ of if elseif else statements.
- A: repetition
- B: debugging
- C: concatenation
- D: complexity
View Answer
A
Q57: What will be the output of <?php $num = 10; if ($num > 5) echo "Greater"; else echo "Smaller"; ?>?
- A: Greater
- B: Smaller
- C: Nothing
- D: Error
View Answer
A
Q58: Fill in the blank: The elseif statement is used to _______ in PHP.
- A: execute code if no prior conditions are true
- B: execute code based on the first condition
- C: handle multiple conditions
- D: handle no conditions
View Answer
C
Q59: What will be the output of <?php $signal = 'Y'; switch($signal) { case 'R': echo "Red"; break; case 'Y': echo "Yellow"; break; default: echo "Invalid"; } ?>?
- A: Red
- B: Yellow
- C: Invalid
- D: Nothing
View Answer
B
Q60: Fill in the blank: Multiple if statements evaluate each condition _______.
- A: sequentially
- B: simultaneously
- C: randomly
- D: in reverse order
View Answer
A