Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q741: PHP allows functions to be defined:
  • A: Only inside classes
  • B: Inside other functions
  • C: At the global scope only
  • D: Inside arrays
View Answer
B

Q742: Which of the following languages do not support defining functions inside functions?
  • A: PHP
  • B: JavaScript
  • C: C
  • D: C and descendants of Algol
View Answer
C

Q743: What keyword is used for inheritance in PHP?
  • A: extend
  • B: extends
  • C: implements
  • D: None of the above
View Answer
B

Q744: How can you pass a parameter by reference in PHP?
  • A: Using an asterisk (*)
  • B: Using a dollar sign ($)
  • C: Using an ampersand (&)
  • D: None of the above
View Answer
C

Q745: PHP classes support:
  • A: Single inheritance only
  • B: Multiple inheritance
  • C: Both single and multiple inheritance
  • D: None of the above
View Answer
A

Q746: Fill in the blank: The default method for passing arguments to functions in PHP is ______.
  • A: By reference
  • B: By value
  • C: By copy
  • D: By pointer
View Answer
B

Q747: Fill in the blank: In PHP, the new keyword is used to create a ______.
  • A: Function
  • B: Variable
  • C: Object
  • D: None of the above
View Answer
C

Q748: Fill in the blank: PHP's support for databases is implemented through _____.
  • A: ODBC
  • B: REST
  • C: GraphQL
  • D: SOAP
View Answer
A

Q749: What will the following PHP code output? $conn=odbc_connect('northwind','','');
  • A: An object
  • B: A resource
  • C: A database connection
  • D: An error
View Answer
C

Q750: What is the purpose of the <script> tag in JavaScript?
  • A: To style HTML elements
  • B: To interpret JavaScript content
  • C: To link CSS styles
  • D: To create a database query
View Answer
B

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now