CSE271 Final Exam
1. Which of the following statements about abstract methods is true?
a.) An abstract method has a name, parameters, and a return type, but no code in the body of the
method.
b.) An abstract method has only a name and a return type, but no parameters or code in its body.
c.) An abstract method has parameters, a return type, and code in its body, but has no defined name.
d.) An abstract method has a name, a return type, and code in its body, but has no parameters.: a.)
An abstract method has a name, parameters, and a return type, but no code in the body of the
method.
2. If a class has an abstract method, which of the following statements is NOT true?
a.) You cannot construct an object from this class.
b.) You can construct an object from this class.
c.) All non-abstract subclasses of this class must implement this method.
d.) You can inherit from this class.: b.) You can construct an object from this class
3. Which of the following statements about classes is NOT true?
a.) You can create an object from a class declared with the keyword final.
b.) You can override methods in a class declared with the keyword final.
c.) You cannot extend a class declared with the keyword final.
d.) You cannot create subclasses from a class declared with the keyword final.: b.) You can
override methods in a class declared with the keyword final.
4. The reserved word in a class definition ensures that subclasses cannot be created from this
class.
a.) final
b.) static
c.) anonymous
d.) abstract: d.) abstract
5. A/an object contains methods that describe the actions to be taken when a user clicks
a user-interface graphical object.
a.) Action Listener
b.) Event source
c.) Action method
d.) Event Listener: d.) Event Listener
6. To respond to a button event, a listener must supply instructions for the
method of ActionListener interface.
, CSE271 Final Exam
a.) actionEvent
b.) eventAction
, CSE271 Final Exam
c.) actionPerformed
d.) eventResponse: d.) actionPerformed
7. Which of the following statements about event listeners is true?
a.) A program must have separate event listener for each type of event to which it wishes to respond
b.) A single event listener can be used to respond to multiple types of events to which the program
wishes to respond.
c.) A program can have only one listener which covers all events
d.) To install a listener, you do not need to know the event source.: b.) A single event listener can
be used to respond to multiple types of events to which the program wishes to respond.
8. An event listener for a button must implement the interface.
a.) ActionPerformed
b.) EventListener
c.) ActionEvent
d.) ActionListener: d.) ActionListener
9. What's the difference between a text field and a text area?
a.) A text field is for a single line of text and a text area is for multiple lines of text.
b.) A text field can be edited by the user, but a text area cannot.
c.) A text area can have scroll bars but a text field cannot.
d.) A text field is used for input only and a text area is used for output only.: a.) A text field is for a
single line of text and a text area is for multiple lines of text.
10.Place drawing instruction inside the method, which is called when- ever the
component needs to be repainted.
a.) paint
b.) draw
c.) paintComponent
d.) drawComponent: c.) paintComponent
11.To build a user interface that contains multiple graphical components, the components .
a.) Must each be added to a separate panel.
b.) Must be added directly to a frame component.
c.) Must be added to a frame that is contained within a panel.
d.) Must be added to a panel that is contained within a frame.: d.) Must be added to a panel that is
contained within a frame.
12.What is the default layout manager of JPanel?
1. Which of the following statements about abstract methods is true?
a.) An abstract method has a name, parameters, and a return type, but no code in the body of the
method.
b.) An abstract method has only a name and a return type, but no parameters or code in its body.
c.) An abstract method has parameters, a return type, and code in its body, but has no defined name.
d.) An abstract method has a name, a return type, and code in its body, but has no parameters.: a.)
An abstract method has a name, parameters, and a return type, but no code in the body of the
method.
2. If a class has an abstract method, which of the following statements is NOT true?
a.) You cannot construct an object from this class.
b.) You can construct an object from this class.
c.) All non-abstract subclasses of this class must implement this method.
d.) You can inherit from this class.: b.) You can construct an object from this class
3. Which of the following statements about classes is NOT true?
a.) You can create an object from a class declared with the keyword final.
b.) You can override methods in a class declared with the keyword final.
c.) You cannot extend a class declared with the keyword final.
d.) You cannot create subclasses from a class declared with the keyword final.: b.) You can
override methods in a class declared with the keyword final.
4. The reserved word in a class definition ensures that subclasses cannot be created from this
class.
a.) final
b.) static
c.) anonymous
d.) abstract: d.) abstract
5. A/an object contains methods that describe the actions to be taken when a user clicks
a user-interface graphical object.
a.) Action Listener
b.) Event source
c.) Action method
d.) Event Listener: d.) Event Listener
6. To respond to a button event, a listener must supply instructions for the
method of ActionListener interface.
, CSE271 Final Exam
a.) actionEvent
b.) eventAction
, CSE271 Final Exam
c.) actionPerformed
d.) eventResponse: d.) actionPerformed
7. Which of the following statements about event listeners is true?
a.) A program must have separate event listener for each type of event to which it wishes to respond
b.) A single event listener can be used to respond to multiple types of events to which the program
wishes to respond.
c.) A program can have only one listener which covers all events
d.) To install a listener, you do not need to know the event source.: b.) A single event listener can
be used to respond to multiple types of events to which the program wishes to respond.
8. An event listener for a button must implement the interface.
a.) ActionPerformed
b.) EventListener
c.) ActionEvent
d.) ActionListener: d.) ActionListener
9. What's the difference between a text field and a text area?
a.) A text field is for a single line of text and a text area is for multiple lines of text.
b.) A text field can be edited by the user, but a text area cannot.
c.) A text area can have scroll bars but a text field cannot.
d.) A text field is used for input only and a text area is used for output only.: a.) A text field is for a
single line of text and a text area is for multiple lines of text.
10.Place drawing instruction inside the method, which is called when- ever the
component needs to be repainted.
a.) paint
b.) draw
c.) paintComponent
d.) drawComponent: c.) paintComponent
11.To build a user interface that contains multiple graphical components, the components .
a.) Must each be added to a separate panel.
b.) Must be added directly to a frame component.
c.) Must be added to a frame that is contained within a panel.
d.) Must be added to a panel that is contained within a frame.: d.) Must be added to a panel that is
contained within a frame.
12.What is the default layout manager of JPanel?