Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q731: Which statement about PHP constants is TRUE?
- A: Constants can change during execution
- B: Constants are not case-sensitive
- C: Constants follow variable naming rules
- D: Constants must start with a number
View Answer
C
Q732: What will $foo contain after the following code? $foo = 'A'; $bar = &$foo; $bar = 'B';
- A: A
- B: B
- C: Error
- D: NULL
View Answer
B
Q733: In PHP, which function is used to retrieve the current key-value pair of an array?
- A: key()
- B: value()
- C: each()
- D: pointer()
View Answer
C
Q734: What does the & symbol before a variable in a foreach loop do?
- A: Assigns by reference
- B: Concatenates strings
- C: Checks equality
- D: Declares a constant
View Answer
A
Q735: What does the break statement do in PHP?
- A: Exits a loop structure
- B: Skips the current iteration
- C: Restarts the loop
- D: None of the above
View Answer
A
Q736: How many levels of nested structures can break exit in PHP?
- A: Only one
- B: Unlimited
- C: A specified number using an argument
- D: None of the above
View Answer
C
Q737: What will the PHP script output if the case 10 in the switch is reached?
- A: "At 5"
- B: "At 10; quitting"
- C: "Case 10 executed"
- D: None of the above
View Answer
B
Q738: The continue statement is used to:
- A: Exit the loop
- B: Skip the current iteration
- C: Repeat the current iteration
- D: None of the above
View Answer
B
Q739: In PHP, the switch statement is considered a looping structure for:
- A: break
- B: continue
- C: Both break and continue
- D: Neither
View Answer
B
Q740: What syntax is used for PHP's alternative control statements?
- A: Curly braces
- B: Colon : and end keywords
- C: Parentheses
- D: None of the above
View Answer
B