MCQ Bank
Which of the following is NOT true about paintComponent( ) method?
- A) It performs custom painting (drawing circle, rectangles etc.)
- B) It is a main method for painting
- C) Tells the components border (if any) to paint.
- D) By default, it first paints the background
The following code creates and starts a timer that fires an action event once per ______. Timer t = new Timer (1000, this); t.start();
- A) Minute
- B) Second
- C) Hour
- D) Day
Which interface must a class implement to be serializable in Java?
- A) Serializable
- B) Externalizable
- C) SerializableObject
- D) Serialize
FTP (File Transmission Protocol) works on _________ port.
- A) 23
- B) 21
- C) 80
- D) 84
During deserialization in Java, which casting is required to recreate the original object type?
- A) Down-casting
- B) Right-casting
- C) Left-casting
- D) Up-casting
Which Java package is used for socket programming?
- A) java.net
- B) java.sql
- C) java.lang
- D) java.util
Which of the following methods is called only once during the life cycle of an Applet?
- A) destroy()
- B) start( )
- C) paint()
- D) stop()
To deserialize an object in Java, we typically use _____________________ .
- A) ClassOutputStream
- B) ObjectInputStream
- C) ObjectOutputStream
- D) ClassInputStream
How many methods are there in the Serializable Interface?
- A) One
- B) Two
- C) Zero
- D) Three
In the context of Java Graphics, which of the following methods we should override while painting?
- A) paintChildern( )
- B) paintComponet( )
- C) paint( )
- D) paintBorder( )
How many simultaneous connections can be opened using TCP and UDP ports?
- A) 64
- B) 128k
- C) 64k
- D) 128
If a JPanel has a triangle drawn on it then which of the following methods will display it?
- A) paint( )
- B) paintComponet( )
- C) paintChildern( )
- D) paintBorder( )
A port is a __________________ to which processes can listen for connections request.
- A) Client Address
- B) Server Address
- C) Local Address
- D) Transport Address
Timers are constructed by specifying both a delay parameter and a/an _________ Listener.
- A) Mouse
- B) Action
- C) Key
- D) Window
Which of the following methods of an Applet is called every time when page is minimized?
- A) stop()
- B) start()
- C) destroy()
- D) init()
int i = (int)( Math.random() * 5 ); // will generate random numbers between__________ .
- A) 1 & 5
- B) 0 & 4
- C) 1 & 4
- D) 0 & 5
Which method is called when an applet is about to be removed from memory?
- A) destroy()
- B) start()
- C) init()
- D) stop()
If you want the timer to fire only the first time and then stop, invoke ______________.
- A) setOnce(true)
- B) setOnce(false)
- C) setRepeats(true)
- D) setRepeats(false)
TELNET works on _______ port.
- A) 23
- B) 80
- C) 84
- D) 21
How many ports are available for UDP socket?
- A) 64k
- B) 64
- C) 128k
- D) 128