1.
What is it called when a program is written to respond to the button clicks, menu selections, and other actions of the user in whatever order the user does them?
Correct Answer
A. Event-driven programming.
Explanation
Event-driven programming is the correct answer because it refers to the programming paradigm where the flow of the program is determined by events or actions triggered by the user, such as button clicks, menu selections, or other user interactions. In event-driven programming, the program is designed to respond to these events in whatever order the user performs them, allowing for a more interactive and dynamic user experience. This approach is commonly used in graphical user interfaces (GUI) and allows for a flexible and responsive application.
2.
The fundamental classes for GUI programming are contained in the:
Correct Answer
B. Abstract Windowing Toolkit
Explanation
The Abstract Windowing Toolkit (AWT) is the correct answer because it is a set of classes in Java that provide the foundation for creating graphical user interfaces (GUIs). It includes classes for creating windows, buttons, menus, and other GUI components. The AWT is a part of the Java Foundation Classes (JFC) and is platform-independent, meaning it can be used to create GUIs that work on different operating systems. It is often used in conjunction with the Swing toolkit, which provides more advanced GUI components.
3.
The three main parts of a GUI program are:
Correct Answer
D. Frames, Code, Events
Explanation
The correct answer is Frames, Code, Events. In a GUI program, frames are the main windows that contain all the visual components. Code refers to the programming logic and instructions that define the behavior and functionality of the GUI program. Events are actions or occurrences that trigger specific responses or behaviors in the GUI program, such as button clicks or mouse movements. These three components work together to create a functional and interactive GUI program.
4.
What is the one component that nearly all GUI programs will have?
Correct Answer
A. Window
Explanation
Nearly all GUI programs will have a window component. The window serves as the main container for the program's user interface, displaying the various elements and allowing users to interact with them. It provides a visual representation of the program and can be resized, minimized, or closed. Without a window, GUI programs would not have a graphical interface for users to interact with.
5.
What is a container object in GUI programming?
Correct Answer
D. A container is a GUI component that has other GUI components placed inside of it.
Explanation
A container object in GUI programming refers to a GUI component that contains other GUI components within it. It acts as a parent or holder for other components, allowing them to be organized and displayed together. This helps in structuring the user interface and managing the layout of the components.
6.
When the user clicks on a button, what is generated?
Correct Answer
A. An Event.
Explanation
When the user clicks on a button, an event is generated. This event is a signal or notification that informs the program that the button has been clicked. The program can then respond to this event by executing a specific action or set of instructions. Events are commonly used in programming to enable interactivity and allow users to interact with the application or website.
7.
What is the name for a method that responds to events?
Correct Answer
C. A listener method.
Explanation
A listener method is the correct answer because it is a method that is designed to respond to events. It is commonly used in programming to handle user interactions or system events, allowing the program to react and perform certain actions based on these events.
8.
The class that is the ultimate ancestor of all the other classes is the class called...
Correct Answer
C. Object
Explanation
The class called "Object" is the ultimate ancestor of all other classes in Java. This means that every class in Java is either directly or indirectly derived from the Object class. The Object class provides a set of common methods and behaviors that are inherited by all other classes, such as toString(), equals(), and hashCode(). Therefore, Object is considered the root of the class hierarchy in Java.
9.
Which of the following is the class that is derived from Container and is one of the base classes of Swing?
Correct Answer
D. JComponent
Explanation
JComponent is the correct answer because it is a class that is derived from Container and is one of the base classes of Swing. It provides a lightweight, platform-independent component that can be used to create user interfaces in Java applications. JComponent inherits many useful methods and properties from its parent classes, making it a versatile and commonly used class in Swing development.
10.
What letter do many Swing class names start with?
Correct Answer
B. J
Explanation
Many Swing class names start with the letter "J".