Object Oriented Programming in Java MCQ with Answers

Object Oriented Programming in Java MCQ with Answers for the preparation of IT academic and competitive exams of various Institutes.

Are you a Java programmer looking to enhance your understanding of Object Oriented Programming (OOP) concepts? As the world of software development continues to evolve, it becomes increasingly important for developers to possess a strong foundation in OOP principles. One effective way to solidify your knowledge is by practicing with Multiple Choice Questions (MCQs).

In this article, we will provide you with a comprehensive collection of Object Oriented Programming in Java MCQs along with their answers, specifically designed for the year 2023.

Whether you are preparing for an interview or certification exam, or simply seeking self-improvement, these MCQs will serve as a valuable resource to test your comprehension and reinforce key OOP concepts in Java.

Object Oriented Programming in Java MCQ with Answers

1. Which of the following is an object encapsulated inside the System class?
A) out
B) println
C) Both A and B
D) None of the above

2. Employee emp = ___ Employee (); Pick a suitable word from the list so that an object of the class Employee is created.
A) object
B) class
C) run
D) new

3. What is the output for the following code: System.out.println (“Hello World”);
A) Shows error
B) Hello World
C) “Hello World”
D) None of the above

4. ___ provides a standard interface to common system resources.
A) new
B) API
C) System
D) None of the above

5. Which of the following is also known as SDK:
A) devkit
B) JVM
C) JDK
D) None of the above

6. Which feature of Java is used to dynamically link code in a safe and expedient manner:
A) Secure
B) Distributed
C) Dynamic
D) Robust

7. Which of the following additional package is included by JDK:
A) java.awt
B) sun.addtools.debug
C) java.util
D) sun.tools.debug

8. Which among the following is not a feature of Java:
A) Portable
B) Structured
C) Distributed
D) High Performance

9. ___ is a Java run-time system that chooses to execute the JAVA Bytecode:
A) SDK
B) JDK
C) JVM
D) None of the above

10. Which of the following operators are used to compare two values and give the results:
A) Increment and Decrement
B) Logical
C) Comparison
D) Arithmetic

11. What is the result of the expression: 10+5*8-15/5
A) 3
B) 47
C) 7
D) 21

12. ___ is a common programming construct that is based upon a sequence of nested if:
A) switch
B) nested if
C) if-else-if ladder
D) None of the above

13. ___ statement is Java’s multi-way branch statement.
A) switch
B) nested if
C) break
D) if-else-if ladder

14. Which loop always executes its body at least once, even though the condition is not true:
A) for
B) do-while
C) while
D) continue

15. ___ is used to exit from a loop:
A) continue
B) quit
C) break
D) None of the above

16. Which of the following method can be used to set the size of the buffer:
A) ensureCapacity( )
B) length( )
C) capacity( )
D) setLength( )

17. Which of the following method returns the reversed object on which it is called:
A) insert( )
B) replace( )
C) delete( )
D) reverse( )

18. String indexes begin at:
A) 1
B) 3
C) 0
D) 2

19. Which of the following is a special operator to allocate memory:
A) New
B) Old
C) ++
D) –

20. Both the String and StringBuffer classes are defined in ____ package:
A) java.awt
B) java.io
C) java.lang
D) java.util

21. Method used to extract a single character from a String:
A) toCharArray( )
B) getChars( )
C) getBytes( )
D) charAt( )

22. Human Being and Elephant fall under which of the following relationship:
A) Kind-Of
B) Is-A
C) Part-Of
D) Has-A

23. Which of the following allows the creation of hierarchical classifications?
A) Interface
B) Inheritance
C) Package
D) Polymorphism

24. A class member that has been declared as private will be ___ to its class.
A) Friendly
B) Public
C) Protected
D) Private

25. Which of the following keywords is used to prevent inheritance:
A) final
B) catch
C) extends
D) super

26. Java supports ___ access specifiers.
A) 1
B) 2
C) 3
D) 4

27. ___ is used as a base class to derive specific classes of the same kind.
A) private
B) friend class
C) abstract class
D) superclass

28. Writing the same code in different places, leading to unnecessary replication of code:
A) Code extensibility
B) Code redundancy
C) Code reusability
D) None of the above

29. Which of the following blocks can be nested:
A) catch
B) finally
C) try
D) None of the above

30. Number of final blocks that are there for an exception-handler.
A) 1
B) 2
C) 3
D) 4

31. The ___ statement takes an object of an exception class as a parameter.
A) try
B) if
C) catch
D) finally

32. DataInputStream and DataOutputStream classes are:
A) Abstract streams
B) Mode streams
C) Markable streams
D) Filter streams

33. Unicode is used to represent data such that each character is represented by:
A) 8 bits
B) 16 bits
C) 64 bits
D) 32 bits

34. Java provides ___ to perform I/O operations at specified locations within a file:
A) InputStreamReader
B) RandomAccessFile
C) DataInputStream
D) DataOutputStream

35. Which of the following is not a method of DataInputStream class:
A) void writeInt (int v )
B) int readInt ()
C) byte readByte ()
D) char readChar ()

36. Which of the following class lays the foundation for the output class hierarchy:
A) Reader
B) InputStream
C) OutputStream
D) None of the above

37. InputStream class method is:
A) open( )
B) skip( )
C) flush( )
D) write( )

38. The streams that are read from or written to a specific place like a disk file or memory:
A) Markable streams
B) ByteArray streams
C) Mode streams
D) Filter streams

39. Graphics class is a part of :
A) java.applet package
B) java.util package
C) java.io package
D) java.awt package

Important MCQs on High-Speed Networks

40. Which of the methods is called immediately after the init() is called:
A) destroy( )
B) start( )
C) paint( )
D) stop( )

41. Context can be retrieved using which of the following method:
A) getNum( )
B) getGraphics( )
C) getAppletContext( )
D) getText( )

42. Which of the following methods is defined by the AWT Component class:
A) paint( )
B) init( )
C) stop( )
D) start( )

43. The argument temporaryFlag is set to true if the focus event is:
A) temporary
B) gained
C) lost
D) retrieved

44. ___ object is generated when the mouse is used.
A) AdjustmentEvent
B) MouseEvent
C) PaintEvent
D) TextEvent

45. Which of the following is at the top of the event class hierarchy:
A) java.awt.AWTEvent
B) java.awt.EventObject
C) java.util.EventObject
D) None of the above

46. In Java, events are represented by:
A) Objects
B) Anonymous classes
C) Inner classes
D) Classes

47. Which of the following class has empty methods:
A) Anonymous class
B) Adapter class
C) Nested class
D) None of the above

48. The method that returns the event ID that represents the nature of the event:
A) getId( )
B) getNature( )
C) getName( )
D) getValue( )

49. Which of the following Swing Components hierarchically extends the AWT applet:
A) JTree
B) JToolTip
C) JApplet
D) JPanel

50. ___ components allow the editing of multiline plain text.
A) Tree
B) Text area
C) Text field
D) Toggle

Object Oriented Programming in C++ MCQ with Answers

Conclusion

This article has provided a comprehensive overview of Object Oriented Programming in Java through the form of Multiple Choice Questions with Answers for 2023. We have covered various important concepts including encapsulation, inheritance, polymorphism, and abstraction, which are fundamental to understanding OOP in Java.

By practicing these MCQs, readers can assess their knowledge and enhance their understanding of the subject. It is crucial to grasp these concepts thoroughly as they form the backbone of Java programming. So, keep practicing and exploring the world of OOP in Java to become a proficient programmer. Happy coding!

Thanks for preparing for your exams from our blogs, if you like the post on Object Oriented Programming in Java MCQ with Answers, please share on social media.

Share on Social Media

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top