MCQ Bank
In Java, Serializable Interface can be found under _________ package.
- A) java.net
- B) java.io
- C) java.util
- D) java.sql
Which of the following commands is used to invoke an Applet named Test from command line interpreter?
- A) appletviewer Test.html
- B) appletrunner Test.html
- C) appletviewer Test.java
- D) appletrunner Test.java
In order to include graphics in your Java program, it is mandatory to extend from _________ class.
- A) JPanel
- B) JButton
- C) JLabel
- D) JFrame
In Java Graphics, while painting a swing component, which of the following functions is invoked first?
- A) paintBorder( )
- B) paintChildern( )
- C) paint( )
- D) paintComponet( )
Which of the following statements is true regarding paintComponent() method?
- A) It first performs custom painting and then paints the background.
- B) It tells any components contained by this component to paint themselves.
- C) It first paints the background and then performs custom painting.
- D) It tells the component to paint its border.
Which of the following objects is passed as an argument to paintComponent() method?
- A) Graphics object
- B) JPanel object
- C) Image object
- D) JFrame object
Which Java graphics method would you use to draw a filled circle on a graphics context g2 at position (50, 50) with a diameter of 20 pixels?
- A) g2.drawCircle(50, 50, 20, 20);
- B) g2.drawOval(50, 50, 20, 20);
- C) g2.fillOval(50, 50, 20, 20);
- D) g2.fillCircle(50, 50, 20, 20);
In Java, Serializable Interface can be found under _________ package.
- A) java.util
- B) java.io
- C) java.net
- D) java.sql
How many ports are available for TCP socket?
- A) 64k
- B) 128
- C) 128k
- D) 64
What is the purpose of the transient keyword in Java serialization?
- A) It indicates that an object cannot be serialized.
- B) It indicates that a variable should not be serialized.
- C) It indicates that a class cannot be serialized.
- D) It indicates that a method cannot be serialized.
In the context of Java Graphics, which of the following methods we should override while painting?
- A) paint( )
- B) paintChildern( )
- C) paintComponet( )
- D) paintBorder( )
Socket is a ___________ commnunication channel between hosts.
- A) multi-directional
- B) uni-directional
- C) bi-directional
- D) tri-directional
Which Java graphics method would you use to draw a filled circle on a graphics context g2 at position (50, 50) with a diameter of 20 pixels?
- A) g2.drawCircle(50, 50, 20, 20);
- B) g2.fillOval(50, 50, 20, 20);
- C) g2.drawOval(50, 50, 20, 20);
- D) g2.fillCircle(50, 50, 20, 20);
Which of the following methods of an Applet is called every time when page is minimized?
- A) start()
- B) destroy()
- C) init()
- D) stop()
Which of the following methods is called only once during the life cycle of an Applet?
- A) start( )
- B) destroy()
- C) paint()
- D) stop()
Which of the following statements is true regarding paintComponent() method?
- A) It tells any components contained by this component to paint themselves.
- B) It tells the component to paint its border.
- C) It first paints the background and then performs custom painting.
- D) It first performs custom painting and then paints the background.
Which method is called first when an applet is loaded?
- A) start()
- B) stop()
- C) destroy()
- D) init()
To serialize an object in Java, we typically use _____________________ .
- A) ObjectOutputStream
- B) ObjectInputStream
- C) ClassInputStream
- D) ClassOutputStream
During deserialization in Java, which casting is required to recreate the original object type?
- A) Down-casting
- B) Up-casting
- C) Left-casting
- D) Right-casting
How many methods are there in the Serializable Interface?
- A) Zero
- B) One
- C) Two
- D) Three