• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 15 pages
Exam (elaborations)

CS 1102 Programming Self Quiz 6 Answers- University of the People 2022

Document preview thumbnail
Preview 2 out of 15 pages

CS 1102 Programming Self Quiz 6 Answers- University of the People 2022/CS 1102 Programming Self Quiz 6 Answers- University of the People 2022/CS 1102 Programming Self Quiz 6 Answers- University of the People 2022/CS 1102 Programming Self Quiz 6 Answers- University of the People 2022/CS 1102 Programming Self Quiz 6 Answers- University of the People 2022/CS 1102 Programming Self Quiz 6 Answers- University of the People 2022

Content preview

Question 1
Correct
Mark 1.00 out of 1.00




Flag question

Question text

Consider the following Java program. Which one of the following is an interface?


import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener {
MouseWhisperer() {
super("COME CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }
public void mousePressed(MouseEvent e) { setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }
public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); }
public static void main(String[] args) { new MouseWhisperer(); }
}

Select one:

a. java.awt.event

b. JFrame

c. MouseEvent

d. MouseListener



e. this

Feedback

Your answer is correct.
See Section 6.3.1.
The correct answer is: MouseListener

, Question 2
Correct
Mark 1.00 out of 1.00




Flag question

Question text

Consider the following Java program. What is the superclass of "Clicker"?
import java.awt.event.*;
import javax.swing.*;
public class Clicker extends JFrame implements ActionListener {
int count;
JButton button;
Clicker() {
super("Click Me");
button = new JButton(String.valueOf(count));
add(button);
button.addActionListener(this);
setSize(200,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
count++;
button.setText(String.valueOf(count));
}
public static void main(String[] args) { new Clicker(); }
}

Select one:

a. ActionEvent

b. ActionListener

c. JButton

d. JFrame



e. this

Feedback

Your answer is correct.
See Section 5.5.2.

Document information

Uploaded on
August 15, 2022
Number of pages
15
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers
$16.48

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Timeless2024
3.9
(683)
Sold
3673
Followers
3137
Items
2121
Last sold
1 month ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions