0% found this document useful (0 votes)
9 views2 pages

Java Script

JavaScript MCQ
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)
9 views2 pages

Java Script

JavaScript MCQ
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/ 2

1. **Which package provides AWT classes in Java?

**
- **Answer:** a. java.awt

2. **Which of the following architecture does the Swing framework use?**


- **Answer:** a. MVC

3. **What is an event in the delegation event model used by Java programming language?**
- **Answer:** a. An event is an object that describes a state change in a source

4. **Which of the following is not a component in AWT?**


- **Answer:** c. Table

5. **Which of these methods are used to register a mouse motion listener?**


- **Answer:** c. addMouseMotionListner()

6. **A ____ control is a dialogue window that allows the user to pick a file?**
- **Answer:** d. JFileChooser

7. **Which method is used to add a component to a container in AWT?**


- **Answer:** a. add()

8. **Which method is used to remove a component from a container in AWT?**


- **Answer:** a. remove()

9. **____ are classes that act as a connection point between event listeners and event
sources?**
- **Answer:** a. Event adapters

10. **What is a listener in context to event handling?**


- **Answer:** b. A listener is an object that is notified when an event occurs

11. **How many layout managers are defined in the java.awt package?**
- **Answer:** c. 5

13. **Which method is used to place some text in the text field?**
- **Answer:** B. setText(String str)

14. **What is Swing in Java?**


- **Answer:** c. A graphical user interface (GUI) toolkit

15. **Which of these events will be notified if the scrollbar is manipulated?**


- **Answer:** c. AdjustmentEvent

16. **Which is the container that doesn't contain a title bar and MenuBars but it can have
other components like a button, textfield, etc?**
- **Answer:** c. Panel
17. **Which of these events will be generated if we close an applet’s window?**
- **Answer:** d. WindowEvent

18. **Which of the following components can display images?**


- **Answer:** d. JLabel

19. **These two ways are used to create a Frame by creating the object of Frame class
(association) by extending Frame class (inheritance)**
- **Answer:** a. True

20. **Which layout manager places components in one of five regions: north, south, east,
west, and center?**
- **Answer:** c. BorderLayout

21. **What is the purpose of the repaint() method in Java Swing?**


- **Answer:** d. To redraw a component on the screen

22. **Which of these functions is called to display the output of an applet?**


- **Answer:** b. paint()

23. **Which class is used to display a list of selectable items in Java Swing?**
- **Answer:** d. JList

24. **Which of these events is generated when the component is added or removed?**
- **Answer:** b. ContainerEvent

25. **Which of the following methods is used to create a new JMenuBar object?**
- **Answer:** a. new JMenuBar()

26. **Which of these methods is a part of the Abstract Window Toolkit (AWT)?**
- **Answer:** c. drawString()

27. **The order of the three top-level elements of the java source file is___.**
- **Answer:** c. Package, Import, Class

28. **Which is the container that doesn't contain a title bar and MenuBars but it can have
other components like a button, textfield, etc?**
- **Answer:** c. Panel

29. **AWT has more powerful components like tables, lists, scroll panes, color chooser,
tabbed pane, etc.**
- **Answer:** b. False

30. **Which are passive controls that do not support any interaction with the user?**
- **Answer:** c. Labels

You might also like