Object Oriented Programming in Java MCQ with Answers

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 2024. 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