Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q711: What does unset($arr) do in PHP?
- A: Deletes the last element of the array
- B: Deletes a specific key
- C: Deletes the entire array
- D: Deletes the array structure only
View Answer
C
Q712: In the array $arr = array("foo" => "bar", 12 => true);, what is the value of $arr["foo"]?
- A: 1
- B: bar
- C: foo
- D: 1
View Answer
B
Q713: PHP is especially suited for which of the following?
- A: Mobile app development
- B: Web development
- C: Desktop software development
- D: Game development
View Answer
B
Q714: PHP supports which type of comments?
- A: C-style only
- B: HTML-style only
- C: C++-style and single-line comments
- D: Python-style comments
View Answer
C
Q715: Which of the following is the correct output for $foo = 2 + "10.5"; in PHP?
- A: 12
- B: 12.5
- C: 105
- D: Error
View Answer
B
Q716: What will be the type of $foo = 1 + "10 Small Cats";
- A: Integer
- B: String
- C: Float
- D: Boolean
View Answer
A
Q717: Which syntax is correct for defining an array in PHP?
- A: array()
- B: ArrayList()
- C: list()
- D: hash()
View Answer
A
Q718: The echo statement in PHP is used for:
- A: Declaring variables
- B: Outputting text
- C: Running server scripts
- D: Calling functions
View Answer
B
Q719: What does the add_item method in the Cart class do?
- A: Removes items from the cart
- B: Adds items to the cart
- C: Updates the item quantity
- D: Clears the cart
View Answer
B
Q720: In PHP, what symbol is used to assign by reference?
- A: @
- B: &
- C: #
- D: %
View Answer
B