Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views5 pages

Java Unit 3 4 5 QnA With Options

The document contains a series of questions and answers related to Java programming, covering topics such as thread execution, event handling, AWT, and Swing components. Key concepts include thread states, listener interfaces, applet execution, and layout managers. It also addresses the characteristics of Java applications and the use of various Java classes and methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Java Unit 3 4 5 QnA With Options

The document contains a series of questions and answers related to Java programming, covering topics such as thread execution, event handling, AWT, and Swing components. Key concepts include thread states, listener interfaces, applet execution, and layout managers. It also addresses the characteristics of Java applications and the use of various Java classes and methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Unit 3

1. 1. Which method is used to start a thread execution?

Answer: B. start()

2. 2. Which of the following is not a valid thread state in Java?

Answer: D. Running

3. 3. Which interface must be implemented to create a thread by implementing it directly?

Answer: B. Runnable

4. 4. What is the base class of all enums in Java?

Answer: B. Enum

5. 5. The process of converting a primitive type into an object is called

Answer: Boxing

6. 6. Wrapper classes are found in the ____________________________ package.

Answer: java.lang

7. 7. Every Java application has at least one thread.

Answer: True

8. 8. The wait() method must be called from a synchronized context.

Answer: True
Unit 4
1. 1. Which of these is not an event class in Java?

Answer: C. KeyListener

2. 2. Which listener interface is used to detect window closing events?

Answer: B. WindowListener

3. 3. Which method of ActionListener interface must be implemented?

Answer: C. actionPerformed()

4. 4. What happens if you don't override all methods of a listener interface?

Answer: B. Runtime error

5. 5. What is the Delegation Event Model in Java based on?

Answer: C. Event Source and Event Listener

6. 6. Which of the following is not a valid Java adapter class?

Answer: C. ActionAdapter

7. 7. AWT is based on which type of GUI?

Answer: B. Heavyweight

8. 8. Which class is used to create a window in AWT?

Answer: C. Frame

9. 9. AWT layouts are part of the ____________________________ package.

Answer: java.awt

10. 10. ____________________________ is the default layout for a Panel in AWT.

Answer: FlowLayout

11. 11. The layout that allows placing components in North, South, East, West, and Center regions

is

Answer: BorderLayout

12. 12. To use a layout manager in AWT, we call the method __________________ on a container.
Answer: setLayout()

13. 13. AWT stands for Abstract Window Toolkit and is used to create GUI.

Answer: True

14. 14. AWT components are lightweight and do not rely on native platform resources.

Answer: False

15. 15. The FlowLayout manager places components at fixed positions in a container.

Answer: False

16. 16. A listener in Java is an interface that is used to handle events such as button clicks or key

presses.

Answer: True
Unit 5
1. 1. Which method is used to stop an applet execution in Java?

Answer: A. stop()

2. 2. Which tag is used to embed an applet in an HTML page?

Answer: C. <applet>

3. 3. In which method should you place the code to draw an applet's graphics?

Answer: C. paint()

4. 4. An Applet in Java is a:

Answer: C. Java program that runs in a web browser

5. 5. The root container for all Swing applications is:

Answer: B. JFrame

6. 6. Which of the following is the default layout manager for a JPanel in Swing?

Answer: A. FlowLayout

7. 7. Which of the following Swing components is used to create a button?

Answer: C. JButton

8. 8. Which method is used to add components to a Swing container?

Answer: B. add()

9. 9. ____________ is the top-level container used to create a window in Swing.

Answer: JFrame

10. 10. A JList allows the selection of one or multiple ____________________________

Answer: items

11. 11. The ____________________________ class is used to handle text input in a password

field.

Answer: JPasswordField

12. 12. A JLabel can be used to display both ______________ and ______________.
Answer: text, images

13. 13. An applet is a Java program that can run inside a web browser.

Answer: True

14. 14. The init() method is called every time an applet is minimized and restored.

Answer: False

You might also like