COMP 274 Week 8 Final Exam

COMP 274 Week 8 Final Exam

Author: Christine Farr


1. (TCO 1) The javac command produces a file which(Points : 6)
2. (TCO 1) The JVM executes a Java application by(Points : 6)
3. (TCO 1) Which method call converts the value in variable stringVariable to a double?(Points : 6)
4. (TCO 1) What output does the following code generate?
int a = 10;
double d = 123.456;
String s = “Hi there!”;
System.out.printf(“%s %d %.2f”, s, a, d);(Points : 6)
5. (TCO 1) Which of the following gets a double value from the user?(Points : 6)
6. (TCO 1) When a Java method is passed an array as a parameter, how does the method know how many elements the array has?(Points : 6)
7. (TCO 2) Non-static methods of a class(Points : 6)
8. (TCO 2) What is a primary difference between inheritance in Java and inheritance in C++?(Points : 6)
9. (TCO 3) How would you set the layout of a JFrame to create 64 equal sized areas arranged like a chess board?(Points : 6)
10. (TCO 3) One way to display a set of three JButtons horizontally arranged on the top of the display is to add the buttons to a JPanel with(Points : 6)
11. (TCO 3) Given a JFrame object named frame with a default layout manager, what would the display look like given the following code?
frame.add(button1, BorderLayout.NORTH);
frame.add(button2, BorderLayout.NORTH);(Points : 6)
12. (TCO 4) To handle the event generated by typing the enter key in a JTextField, you would need to (Points : 6)
13. (TCO 4) What can you say about the following Java class definition?

public class MyClass extends JFrame
private class RadioButtonHandler implements ItemListener { … }
}(Points : 6)
14. (TCO 3) Which of the following is true for a JLabel?(Points : 6)
15. (TCO 3) A JTextArea(Points : 6)

See More
Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

Begin Free Trial
No credit card required

26 Sophia partners guarantee credit transfer.

226 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 21 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.