JavaScript OOP MCQ Test

🧠 JavaScript OOP MCQ Test (25 Questions)

🟢 Basic Level

1. What is OOP?

A. Programming with loops
B. Programming with objects
C. Programming with HTML
D. None
👉 Answer: B


2. Which keyword is used to create a class?

A. function
B. object
C. class
D. define
👉 Answer: C


3. What is an object?

A. Function
B. Instance of class
C. Loop
D. Variable
👉 Answer: B


4. Which method runs automatically when object is created?

A. init()
B. start()
C. constructor()
D. create()
👉 Answer: C


5. What does this refer to?

A. Global object
B. Current object
C. Function
D. Class
👉 Answer: B


🟡 Intermediate Level

6. Which keyword is used for inheritance?

A. inherit
B. extends
C. super
D. prototype
👉 Answer: B


7. What is encapsulation?

A. Looping
B. Hiding data
C. Printing output
D. Debugging
👉 Answer: B


8. Private fields are declared using?

A. _
B. $
C. #
D. @
👉 Answer: C


9. What is polymorphism?

A. Same function, different behavior
B. Same output
C. Same variable
D. Same loop
👉 Answer: A


10. Which method overrides parent method?

A. Same name method in child
B. New method
C. Static method
D. Private method
👉 Answer: A


11. What is prototype?

A. Loop
B. Object mechanism for inheritance
C. Function
D. Array
👉 Answer: B


12. What is super used for?

A. Create object
B. Call parent class
C. Delete object
D. Print value
👉 Answer: B


13. Which is correct?

A. JS supports class-based inheritance only
B. JS uses prototype-based inheritance
C. JS has no inheritance
D. None
👉 Answer: B


14. What is a method?

A. Property
B. Function inside object/class
C. Loop
D. Variable
👉 Answer: B


15. Which creates object?

A. new
B. create
C. make
D. object
👉 Answer: A


🔴 Advanced Level

16. Static methods belong to?

A. Object
B. Class
C. Function
D. Array
👉 Answer: B


17. Getters are used to?

A. Set values
B. Get values
C. Delete values
D. Loop values
👉 Answer: B


18. Setters are used to?

A. Get values
B. Set values
C. Print values
D. Loop values
👉 Answer: B


19. What is abstraction?

A. Showing all details
B. Hiding complexity
C. Looping
D. Debugging
👉 Answer: B


20. JavaScript supports multiple inheritance?

A. Yes
B. No
C. Sometimes
D. Only in ES5
👉 Answer: B


21. What is method chaining?

A. Calling methods in sequence
B. Looping
C. Debugging
D. None
👉 Answer: A


22. __proto__ refers to?

A. Class
B. Object reference
C. Loop
D. Variable
👉 Answer: B


23. Classes in JS are?

A. Real classes
B. Syntactic sugar
C. Functions only
D. Variables
👉 Answer: B


24. Which is NOT OOP concept?

A. Inheritance
B. Encapsulation
C. Looping
D. Polymorphism
👉 Answer: C


25. Which is correct syntax?

A. class = Person {}
B. class Person {}
C. Person class {}
D. define class Person {}
👉 Answer: B