Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q721: A variable that holds the address of another variable is called a ______.
- A: pointer
- B: variable variable
- C: constant
- D: alias
View Answer
B
Q722: Which operator in PHP is used for string concatenation?
- A: .
- B: +
- C: &
- D: =
View Answer
A
Q723: In PHP, which logical operator has the highest precedence?
- A: and
- B: or
- C: xor
- D: &&
View Answer
D
Q724: What does the foreach loop primarily work on?
- A: Strings
- B: Arrays
- C: Constants
- D: Variables
View Answer
B
Q725: What will the following code output? $a = "Hello"; $b = $a . " World!"; echo $b;
- A: Hello
- B: HelloWorld
- C: Hello World!
- D: Error
View Answer
C
Q726: What is the purpose of the switch statement in PHP?
- A: Repeat a block of code
- B: Branch based on multiple conditions
- C: Declare variables
- D: Define constants
View Answer
B
Q727: The === operator in PHP checks for ______.
- A: Equality of values only
- B: Equality of type only
- C: Both value and type equality
- D: None of the above
View Answer
C
Q728: Which array operator in PHP appends the second array to the first without overwriting duplicated keys?
- A: +
- B: ==
- C: ===
- D: !=
View Answer
A
Q729: In the Cart class, what happens when remove_item is called and the quantity becomes zero?
- A: The item is retained
- B: The item is removed from the cart
- C: An error is returned
- D: The cart is reset
View Answer
B
Q730: Which PHP control statement is used to iterate over arrays?
- A: for
- B: if
- C: foreach
- D: switch
View Answer
C