Exam 7: Object-Oriented Design
Exam 1: Introduction65 Questions
Exam 2: Data and Expressions77 Questions
Exam 3: Using Classes and Objects58 Questions
Exam 4: Writing Classes56 Questions
Exam 5: Conditionals and Loops37 Questions
Exam 6: More Conditionals and Loops36 Questions
Exam 7: Object-Oriented Design76 Questions
Exam 8: Arrays70 Questions
Exam 9: Inheritance71 Questions
Exam 10: Polymorphism70 Questions
Exam 11: Exceptions68 Questions
Exam 12: Recursion68 Questions
Exam 13: Collections68 Questions
Select questions type
The size and shape of a GUI container is based on the layout manager selected and the type and number of items added to the container.
Free
(True/False)
4.9/5
(33)
Correct Answer:
True
Which of the following is not a method of the Object class?
Free
(Multiple Choice)
4.9/5
(43)
Correct Answer:
B
To take 2 borders and use one as an outer border and the other as an inner border, you would create a
Free
(Multiple Choice)
4.9/5
(44)
Correct Answer:
A
Which of the following methods is a static method? The class in which the method is defined is given in parentheses following the method name.
(Multiple Choice)
4.7/5
(45)
Explain the difference between implementing an interface and a derived class.
(Essay)
4.9/5
(34)
The activities of the development cycle are generally thought to
(Multiple Choice)
4.8/5
(42)
Define an interface class that contains two int constants, X = 5 and Y = 10 and one int method called useXY which receives no parameters. Call your interface class XYClass
(Essay)
4.8/5
(35)
Provide code to generate the following JFrame. Each lettered item is a JButton. Hint: Create several JPanels, each one having two or more JButtons and taken up a portion of the JFrame.


(Essay)
4.8/5
(46)
In order to implement Comparable in a class, what method(s) must be defined in that class?
(Multiple Choice)
4.9/5
(40)
Assume a class Foo implements Comparable. Without knowing anything else about the Foo class, write an equal method that returns True if the Foo parameter passed to this Foo is equal to this Foo as determined by using the implementation of Comparable.
(Essay)
5.0/5
(38)
The term "test case" is used to express a set of inputs (or user actions) and the expected outputs to be used in testing out software.
(True/False)
4.7/5
(39)
To implement Comparable for the ChessPiece class, the current ChessPiece's type is compared to a ChessPiece passed as a parameter. The method should return 0 if the types are equal, -1 if this piece's type is a lesser piece than the parameter's type, and 1 if this piece's type is a greater piece than the parameter's type. Pieces are ordered as follows: "Pawn" is a lesser piece to a "Knight" and a "Bishop", "Knight" and "Bishop" are equivalent for this example, both are lesser pieces to a "Rook" which is a lesser piece to a "Queen" which is a lesser piece to a "King." Write the proper method to implement Comparable for this class.
(Essay)
4.8/5
(33)
Write a static method that is passed two ChessPieces and determines if the two pieces are owned by the same player. It should return True or false.
(Essay)
4.8/5
(43)
In order to display three components vertically in a container, you could use all but which of the following layout managers?
(Multiple Choice)
4.8/5
(36)
For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The variable type will store "King", "Queen", "Bishop", etc and the int player will store 0 or 1 depending on whose piece it is. We wish to implement Comparable for the ChessPiece class. Assume that, the current ChessPiece is compared to a ChessPiece passed as a parameter. Pieces are ordered as follows: "Pawn" is a lesser piece to a "Knight" and a "Bishop", "Knight" and "Bishop" are equivalent for this example, both are lesser pieces to a "Rook" which is a lesser piece to a "Queen" which is a lesser piece to a "King."
-Which of the following would not be considered an algorithm?
(Multiple Choice)
4.8/5
(46)
Draw the JFrame as you think it would appear given the following set of code:
JButton jb1 = new JButton("A");
JButton jb2 = new JButton("B");
JButton jb3 = new JButton("C");
JButton jb4 = new JButton("D");
JButton jb5 = new JButton("E");
JButton jb6 = new JButton("F");
JButton jb7 = new JButton("G");
JButton jb8 = new JButton("H");
JButton jb9 = new JButton("I");
JPanel jp1 = new JPanel(new BorderLayout( ));
jp1.add(jb1, BorderLayout.NORTH);
jp1.add(jb2, BorderLayout.WEST);
jp1.add(jb3, BorderLayout.EAST);
JPanel jp2 = new JPanel(new BorderLayout( ));
jp2.add(jb4, BorderLayout.WEST);
jp2.add(jb5, BorderLayout.SOUTH);
jp2.add(jb6, BorderLayout.EAST);
JPanel jp3 = new JPanel(new BorderLayout( ));
jp3.add(jb7, BorderLayout.WEST);
jp3.add(jb8, BorderLayout.NORTH);
jp3.add(jb9, BorderLayout.EAST);
JPanel jp4 = new JPanel(new BorderLayout( ));
jp4.add(jp1, BorderLayout.NORTH);
jp4.add(jp2, BorderLayout.EAST);
jp4.add(jp3, BorderLayout.SOUTH);
JFrame jf = new JFrame( );
jf.getContentPane( ).add(jp4);
jf.pack( );
jf.setVisible(True );
(Essay)
4.9/5
(39)
In which phase of program development would you expect the programmer(s) to determine the classes and objects needed?
(Multiple Choice)
4.8/5
(38)
Why should the add( ), subtract( ), multiply( ), divide( ) methods in the RationalNumber class in the textbook be declared to be public, while the gcd( ) method is declared to be private?
(Essay)
4.9/5
(37)
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
(True/False)
4.8/5
(26)
Showing 1 - 20 of 76
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)