Deck 7: Object-Oriented Design

ملء الشاشة (f)
exit full mode
سؤال
In order to create a constant, you would use which of the following Java reserved words?

A) private
B) static
C) int
D) final
E) class
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
During program development, software requirements specify

A) how the program will accomplish the task
B) what the task is that the program must perform
C) how to divide the task into subtasks
D) how to test the program when it is done
E) all of the above
سؤال
It is easier to correct errors found in a program if

A) they are identified early in the development cycle
B) they are identified during testing
C) they are identified during program use
D) they are identified during maintenance
E) all of the above are equally True, errors are easily corrected in any of these stages
سؤال
The idea of having programmers and developers meet in order to critique a software design or implementation is known as

A) an interview
B) a walkthrough
C) prototyping
D) aggregation
E) evolutionary development
سؤال
Static methods cannot

A) reference instance data
B) reference non-static instance data
C) reference other objects
D) invoke other static methods
E) invoke non-static methods
سؤال
A bad programming habit is to build an initial program and then spend a great deal of time modifying the code until it is acceptable. This is known as

A) the prototyping approach
B) the waterfall model
C) iterative development
D) the recursive approach
E) the build-and-fix approach
سؤال
In general, spending more time in development to ensure better software will

A) shorten testing time
B) slightly reduce maintenance efforts
C) slightly increase maintenance efforts
D) greatly reduce maintenance efforts
E) not alter the time it takes for any other stage whatsoever
سؤال
Of the various phases in software development, which of the following is usually the lengthiest?

A) specification
B) design
C) implementation
D) testing
E) maintenance
سؤال
Which of the following is not a method of the Object class?

A) clone
B) compareTo
C) equals
D) toString
E) all of the above are methods of the Object class
سؤال
Abstract methods are used when defining

A) interface classes
B) derived classes
C) classes that have no constructor
D) arrays
E) classes that have no methods
سؤال
An example of an aggregation relationship is

A) parent and child
B) animal and dog
C) teacher and computer
D) phone and fax machine
E) all of the above
سؤال
An object that refers to part of itself within its own methods can use which of the following reserved words to denote this relationship?

A) inner
B) i
C) private
D) this
E) static
سؤال
Once we have implemented the solution, we are not done with the problem because

A) the solution may not be the best (most efficient)
B) the solution may have errors and need testing and fixing before we are done
C) the solution may, at a later date, need revising to handle new specifications
D) the solution may, at a later date, need revising because of new programming language features
E) all of the above
سؤال
Inheritance through an extended (derived) class supports which of the following concepts?

A) interfaces
B) modulary
C) information hiding
D) code reuse
E) correctness
سؤال
Java does not support multiple inheritance, but some of the abilities of multiple inheritance are available by

A) importing classes
B) implementing interfaces
C) overriding parent class methods
D) creating aliases
E) using public rather than protected or private modifiers
سؤال
The idea that an object can exist separate from the executing program that creates it is called

A) transience
B) static
C) persistence
D) serialization
E) finality
سؤال
Which of the following interfaces would be used to implement a class that represents a group (or collection) of objects?

A) Iterator
B) Speaker
C) Comparable
D) MouseListener
E) KeyListener
سؤال
Modifying a program in order to eliminate deficiencies is done in the ________ phase of the development cycle.

A) design
B) implementation
C) testing
D) use
E) maintenance
سؤال
The activities of the development cycle are generally thought to

A) be strictly linear
B) be rigidly ordered
C) overlap
D) have optional steps
E) both A and B are True
سؤال
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.

A) equals (String)
B) toUpperCase (String)
C) sqrt (Math)
D) format (DecimalFormat)
E) paint (Applet)
سؤال
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?

A) a recipe
B) a computer program
C) pseudocode
D) a shopping list
E) travel directions
سؤال
The JFrame below has a JBorder created using which of the following BorderFactory formats?
<strong>The JFrame below has a JBorder created using which of the following BorderFactory formats?  </strong> A) TitledBorder B) MatteBorder C) EtchedBorder D) RaisedBevelBorder E) LoweredBevelBorder <div style=padding-top: 35px>

A) TitledBorder
B) MatteBorder
C) EtchedBorder
D) RaisedBevelBorder
E) LoweredBevelBorder
سؤال
Which Layout Manager is used by default if you do not specify a Layout Manager for your GUI container?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
سؤال
What is wrong with the following message to create a BoxLayout for the JPanel jp?
Jp)setLayout(new BoxLayout(BoxLayout.X_AXIS));

A) X_AXIS is not a valid constant for BoxLayout, it should instead be HORIZONTAL
B) Aside from X_AXIS, the constructor also requires a Dimension to determine the size of the Box
C) Aside from X_AXIS, the constructor also needs a command regarding horizontal glue as in createHorizontalGlue( )
D) The BoxLayout constructor is lacking a reference to the container that the BoxLayout manager will govern
E) There is nothing wrong with it at all
سؤال
In order to implement Comparable in a class, what method(s) must be defined in that class?

A) equals
B) compares
C) both lessThan and greaterThan
D) compareTo
E) both compares and equals
سؤال
In order to display three components vertically in a container, you could use all but which of the following layout managers?

A) FlowLayout
B) BoxLayout
C) GridLayout
D) BorderLayout
E) you could use any of the above
سؤال
Which Layout Manager type would you use if you want GUI components to be placed at the North, South, East, West and Center of the container?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
سؤال
Arranging components in a GUI container is accomplished by using which of the following?

A) Layout manager
B) Listener interface
C) String array
D) Event generator
E) JComboBox
سؤال
In which phase of program development would you expect the programmer(s) to determine the classes and objects needed?

A) software requirements
B) software design
C) software implementation
D) software testing
E) could occur in any of the above
سؤال
Having multiple class methods of the same name where each method has a different number of or type of parameters is known as

A) encapsulation
B) information hiding
C) tokenizing
D) importing
E) method overloading
سؤال
Which of the following is considered a top-level container?

A) Panel
B) Frame
C) Box
D) Layout Manager
E) A, B, and C
سؤال
In using the BoxLayout, adding space between components in a container can be accomplished by

A) including TabbedPanes
B) including JButtons that have no names and thus will appear invisible
C) adding invisible components
D) inserting IconImages of blank images
E) any of the above
سؤال
To take 2 borders and use one as an outer border and the other as an inner border, you would create a

A) compound border
B) nested border
C) split border
D) border factory
E) matte border
سؤال
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 method headers would properly define the method needed to make this class Comparable?

A) public boolean comparable(Object cp)
B) public int comparable(Object cp)
C) public int compareTo(Object cp)
D) public int compareTo( )
E) public boolean compareTo(Object cp)
سؤال
It is important to dissect a problem into manageable pieces before trying to solve the problem because

A) most problems are too complex to be solved as a single, large activity
B) most problems are solved by multiple people and it is easy to assign each piece to a separate person
C) it is easier to integrate small pieces of a program into one program than it is to integrate one big chunk of code into one program
D) our first solution may not solve the problem correctly
E) all of the above
سؤال
Which Layout Manager type would you use if you want GUI components to be placed in 2 columns over 5 rows?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
سؤال
The goal of testing is to

A) ensure that the software has no errors
B) find syntax errors
C) find logical and run-time errors
D) evaluate how well the software meets the original requirements
E) give out-of-work programmers something to do
سؤال
In which phase of program development would you expect the programmer(s) to create the pseudocode?

A) Software requirements
B) Software design
C) Software implementation
D) Software testing
E) Could occur in any of the above
سؤال
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 pieces of logic could be used in the method that implements Comparable? Assume that the method is passed Object a, which is really a ChessPiece. Also assume that ChessPiece has a method called returnType which returns the type of the given piece. Only one of these answers has correct logic.

A) if (this.type < a.returnType( )) return -1;
B) if (this.type = = a.returnType( )) return 0;
C) if (this.type.equals(a.returnType( )) return 0;
D) if (a.returnType( ).equals("King")) return -1;
E) if (a.returnType( ).equals("Pawn")) return 1;
سؤال
Which of the following GUI classes requires that it have a LayoutManager before any GUI components are added to it?

A) JButton
B) JSlider
C) JPanel
D) JFrame
E) both C and D but not A or B
سؤال
Provide a reason why an instance data would be declared static.
سؤال
Defining formal parameters requires including each parameters type.
سؤال
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.
سؤال
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
سؤال
Interface classes cannot be extended but classes that implement interfaces can be extended.
سؤال
Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use the Math class, you pass messages directly to the class name, as in Math.abs( ) or Math.sqrt( ).
سؤال
Provide a reason why a method would be declared static.
سؤال
All objects implement Comparable.
سؤال
Any class can implement an interface, but no classes can implement more than a single interface.
سؤال
If classes C1 and C2 both implement an interface Cint, which has a method whichIsIt, and if C1 c = new C1( ); is performed at one point of the program, then a later instruction c.whichIsIt( ); will invoke the whichIsIt method defined in C1.
سؤال
A JPanel can itself contain JPanels.
سؤال
If a programmer follows the four phases of program development as intended, which of the four phases should require the least amount of creativity?

A) software requirements
B) software design
C) software implementation
D) software testing
E) none of the above, all four levels would require equal creativity
سؤال
If a GUI container is resized by the user, all components of the GUI are automatically increased or decreased by the same fraction to fit in the newly sized container.
سؤال
The most important decisions regarding the development of a system are made during the implementation phase while code is actively being written.
سؤال
It is not possible to test out any single method or class of a system until the entire system has been developed, and so all testing is postponed until after the implementation phase.
سؤال
In black-box testing, the tester should already know something about how the program is implemented so that he/she can more carefully identify what portion(s) of the software are leading to errors.
سؤال
All parts of a container in BorderLayout must be used.
سؤال
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.
سؤال
Assume that the class Bird has a static method fly( ). If b is a Bird, then to invoke fly, you could do Bird.fly( );.
سؤال
A border can be put around any Swing component with the exception of a JButton and JScrollPane component.
سؤال
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.
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.  <div style=padding-top: 35px>
سؤال
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.
سؤال
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 );
سؤال
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?
سؤال
In what way is black-box testing better than glass-box testing?
In what way is glass-box testing better than black-box testing?
سؤال
Explain the difference between implementing an interface and a derived class.
سؤال
Write code to create a JPanel with 4 JCheckBox GUI components and two JLabels for output, one that says "Current cost is" and the other that outputs the computed cost based on which of the food items has been selected.
سؤال
Why was the Y2K problem a problem of software maintenance and not a problem of software testing?
سؤال
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");
JButton jb10 = new JButton("J");
JButton jb11 = new JButton("K");
JButton jb12 = new JButton("L");
JPanel jp1 = new JPanel( );
jp1.add(jb1);
jp1.add(jb2);
jp1.add(jb3);
jp1.add(jb4);
JPanel jp2 = new JPanel(new GridLayout(4, 1));
jp2.add(jb5);
jp2.add(jb6);
jp2.add(jb7);
jp2.add(jb8);
JPanel jp3 = new JPanel(new GridLayout(2, 2));
jp3.add(jb9);
jp3.add(jb10);
jp3.add(jb11);
jp3.add(jb12);
JPanel jp4 = new JPanel(new BorderLayout( ));
jp4.add(jp1, BorderLayout.NORTH);
jp4.add(jp2, BorderLayout.EAST);
jp4.add(jp3, BorderLayout.WEST);
JFrame jf = new JFrame( );
jf.getContentPane( ).add(jp4);
jf.pack( );
jf.setVisible(True);
سؤال
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");
JPanel jp1 = new JPanel(new GridLayout(3, 3));
jp1.add(jb1);
jp1.add(jb2);
jp1.add(jb3);
jp1.add(jb4);
jp1.add(jb5);
jp1.add(jb6);
jp1.add(jb7);
JFrame jf = new JFrame( );
jf.getContentPane( ).add(jp1);
jf.pack( );
jf.setVisible(True);
سؤال
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.
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.  <div style=padding-top: 35px>
سؤال
Write a set of code that will allow a user to select an input image and then place this image in a JLabel lab1 and add lab1 to a JPanel as the northern component in a JFrame using BorderLayout. The JFrame has already been instantiated as jf and the BorderLayout already established. Hint: a JFileChooser returns a File and JLabel requires the String name of a file as an argument. A File can return its name using File class' method getAbsolutePath( )
سؤال
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.
سؤال
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.
سؤال
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.
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.  <div style=padding-top: 35px>
سؤال
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
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/76
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Object-Oriented Design
1
In order to create a constant, you would use which of the following Java reserved words?

A) private
B) static
C) int
D) final
E) class
D
Explanation: D) The reserved word final indicates that this is the final value that will be stored in this variable, thus making it unchangeable, or constant. While constants can be of type int, constants can be of any other type as well. It is the final reserved word that makes the value unchangeable.
2
During program development, software requirements specify

A) how the program will accomplish the task
B) what the task is that the program must perform
C) how to divide the task into subtasks
D) how to test the program when it is done
E) all of the above
B
Explanation: B) The specification phase is to understand the problem at hand so that the programmer can determine what needs to be done to solve the problem. The other efforts listed above are part of the design phase (A, C) and testing phase (D).
3
It is easier to correct errors found in a program if

A) they are identified early in the development cycle
B) they are identified during testing
C) they are identified during program use
D) they are identified during maintenance
E) all of the above are equally True, errors are easily corrected in any of these stages
A
Explanation: A) Errors introduced early in the development cycle often cause tremendous problems if not caught early on. Therefore, errors found in testing, use or maintenance phases may be too embedded in the systems' design to be easily corrected. But if found early on, the errors can be completely eliminated.
4
The idea of having programmers and developers meet in order to critique a software design or implementation is known as

A) an interview
B) a walkthrough
C) prototyping
D) aggregation
E) evolutionary development
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
5
Static methods cannot

A) reference instance data
B) reference non-static instance data
C) reference other objects
D) invoke other static methods
E) invoke non-static methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
6
A bad programming habit is to build an initial program and then spend a great deal of time modifying the code until it is acceptable. This is known as

A) the prototyping approach
B) the waterfall model
C) iterative development
D) the recursive approach
E) the build-and-fix approach
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
7
In general, spending more time in development to ensure better software will

A) shorten testing time
B) slightly reduce maintenance efforts
C) slightly increase maintenance efforts
D) greatly reduce maintenance efforts
E) not alter the time it takes for any other stage whatsoever
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
8
Of the various phases in software development, which of the following is usually the lengthiest?

A) specification
B) design
C) implementation
D) testing
E) maintenance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following is not a method of the Object class?

A) clone
B) compareTo
C) equals
D) toString
E) all of the above are methods of the Object class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
10
Abstract methods are used when defining

A) interface classes
B) derived classes
C) classes that have no constructor
D) arrays
E) classes that have no methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
11
An example of an aggregation relationship is

A) parent and child
B) animal and dog
C) teacher and computer
D) phone and fax machine
E) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
12
An object that refers to part of itself within its own methods can use which of the following reserved words to denote this relationship?

A) inner
B) i
C) private
D) this
E) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
13
Once we have implemented the solution, we are not done with the problem because

A) the solution may not be the best (most efficient)
B) the solution may have errors and need testing and fixing before we are done
C) the solution may, at a later date, need revising to handle new specifications
D) the solution may, at a later date, need revising because of new programming language features
E) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
14
Inheritance through an extended (derived) class supports which of the following concepts?

A) interfaces
B) modulary
C) information hiding
D) code reuse
E) correctness
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
15
Java does not support multiple inheritance, but some of the abilities of multiple inheritance are available by

A) importing classes
B) implementing interfaces
C) overriding parent class methods
D) creating aliases
E) using public rather than protected or private modifiers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
16
The idea that an object can exist separate from the executing program that creates it is called

A) transience
B) static
C) persistence
D) serialization
E) finality
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following interfaces would be used to implement a class that represents a group (or collection) of objects?

A) Iterator
B) Speaker
C) Comparable
D) MouseListener
E) KeyListener
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
18
Modifying a program in order to eliminate deficiencies is done in the ________ phase of the development cycle.

A) design
B) implementation
C) testing
D) use
E) maintenance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
19
The activities of the development cycle are generally thought to

A) be strictly linear
B) be rigidly ordered
C) overlap
D) have optional steps
E) both A and B are True
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
20
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.

A) equals (String)
B) toUpperCase (String)
C) sqrt (Math)
D) format (DecimalFormat)
E) paint (Applet)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
21
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?

A) a recipe
B) a computer program
C) pseudocode
D) a shopping list
E) travel directions
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
22
The JFrame below has a JBorder created using which of the following BorderFactory formats?
<strong>The JFrame below has a JBorder created using which of the following BorderFactory formats?  </strong> A) TitledBorder B) MatteBorder C) EtchedBorder D) RaisedBevelBorder E) LoweredBevelBorder

A) TitledBorder
B) MatteBorder
C) EtchedBorder
D) RaisedBevelBorder
E) LoweredBevelBorder
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which Layout Manager is used by default if you do not specify a Layout Manager for your GUI container?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
24
What is wrong with the following message to create a BoxLayout for the JPanel jp?
Jp)setLayout(new BoxLayout(BoxLayout.X_AXIS));

A) X_AXIS is not a valid constant for BoxLayout, it should instead be HORIZONTAL
B) Aside from X_AXIS, the constructor also requires a Dimension to determine the size of the Box
C) Aside from X_AXIS, the constructor also needs a command regarding horizontal glue as in createHorizontalGlue( )
D) The BoxLayout constructor is lacking a reference to the container that the BoxLayout manager will govern
E) There is nothing wrong with it at all
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
25
In order to implement Comparable in a class, what method(s) must be defined in that class?

A) equals
B) compares
C) both lessThan and greaterThan
D) compareTo
E) both compares and equals
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
26
In order to display three components vertically in a container, you could use all but which of the following layout managers?

A) FlowLayout
B) BoxLayout
C) GridLayout
D) BorderLayout
E) you could use any of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which Layout Manager type would you use if you want GUI components to be placed at the North, South, East, West and Center of the container?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
28
Arranging components in a GUI container is accomplished by using which of the following?

A) Layout manager
B) Listener interface
C) String array
D) Event generator
E) JComboBox
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
29
In which phase of program development would you expect the programmer(s) to determine the classes and objects needed?

A) software requirements
B) software design
C) software implementation
D) software testing
E) could occur in any of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
30
Having multiple class methods of the same name where each method has a different number of or type of parameters is known as

A) encapsulation
B) information hiding
C) tokenizing
D) importing
E) method overloading
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following is considered a top-level container?

A) Panel
B) Frame
C) Box
D) Layout Manager
E) A, B, and C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
32
In using the BoxLayout, adding space between components in a container can be accomplished by

A) including TabbedPanes
B) including JButtons that have no names and thus will appear invisible
C) adding invisible components
D) inserting IconImages of blank images
E) any of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
33
To take 2 borders and use one as an outer border and the other as an inner border, you would create a

A) compound border
B) nested border
C) split border
D) border factory
E) matte border
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
34
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 method headers would properly define the method needed to make this class Comparable?

A) public boolean comparable(Object cp)
B) public int comparable(Object cp)
C) public int compareTo(Object cp)
D) public int compareTo( )
E) public boolean compareTo(Object cp)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
35
It is important to dissect a problem into manageable pieces before trying to solve the problem because

A) most problems are too complex to be solved as a single, large activity
B) most problems are solved by multiple people and it is easy to assign each piece to a separate person
C) it is easier to integrate small pieces of a program into one program than it is to integrate one big chunk of code into one program
D) our first solution may not solve the problem correctly
E) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which Layout Manager type would you use if you want GUI components to be placed in 2 columns over 5 rows?

A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
E) TabbedPane
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
37
The goal of testing is to

A) ensure that the software has no errors
B) find syntax errors
C) find logical and run-time errors
D) evaluate how well the software meets the original requirements
E) give out-of-work programmers something to do
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
38
In which phase of program development would you expect the programmer(s) to create the pseudocode?

A) Software requirements
B) Software design
C) Software implementation
D) Software testing
E) Could occur in any of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
39
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 pieces of logic could be used in the method that implements Comparable? Assume that the method is passed Object a, which is really a ChessPiece. Also assume that ChessPiece has a method called returnType which returns the type of the given piece. Only one of these answers has correct logic.

A) if (this.type < a.returnType( )) return -1;
B) if (this.type = = a.returnType( )) return 0;
C) if (this.type.equals(a.returnType( )) return 0;
D) if (a.returnType( ).equals("King")) return -1;
E) if (a.returnType( ).equals("Pawn")) return 1;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following GUI classes requires that it have a LayoutManager before any GUI components are added to it?

A) JButton
B) JSlider
C) JPanel
D) JFrame
E) both C and D but not A or B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
41
Provide a reason why an instance data would be declared static.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
42
Defining formal parameters requires including each parameters type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
43
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
44
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
45
Interface classes cannot be extended but classes that implement interfaces can be extended.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
46
Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use the Math class, you pass messages directly to the class name, as in Math.abs( ) or Math.sqrt( ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
47
Provide a reason why a method would be declared static.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
48
All objects implement Comparable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
49
Any class can implement an interface, but no classes can implement more than a single interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
50
If classes C1 and C2 both implement an interface Cint, which has a method whichIsIt, and if C1 c = new C1( ); is performed at one point of the program, then a later instruction c.whichIsIt( ); will invoke the whichIsIt method defined in C1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
51
A JPanel can itself contain JPanels.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
52
If a programmer follows the four phases of program development as intended, which of the four phases should require the least amount of creativity?

A) software requirements
B) software design
C) software implementation
D) software testing
E) none of the above, all four levels would require equal creativity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
53
If a GUI container is resized by the user, all components of the GUI are automatically increased or decreased by the same fraction to fit in the newly sized container.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
54
The most important decisions regarding the development of a system are made during the implementation phase while code is actively being written.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
55
It is not possible to test out any single method or class of a system until the entire system has been developed, and so all testing is postponed until after the implementation phase.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
56
In black-box testing, the tester should already know something about how the program is implemented so that he/she can more carefully identify what portion(s) of the software are leading to errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
57
All parts of a container in BorderLayout must be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
58
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
59
Assume that the class Bird has a static method fly( ). If b is a Bird, then to invoke fly, you could do Bird.fly( );.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
60
A border can be put around any Swing component with the exception of a JButton and JScrollPane component.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
61
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.
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
62
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
63
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 );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
64
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
65
In what way is black-box testing better than glass-box testing?
In what way is glass-box testing better than black-box testing?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
66
Explain the difference between implementing an interface and a derived class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
67
Write code to create a JPanel with 4 JCheckBox GUI components and two JLabels for output, one that says "Current cost is" and the other that outputs the computed cost based on which of the food items has been selected.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
68
Why was the Y2K problem a problem of software maintenance and not a problem of software testing?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
69
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");
JButton jb10 = new JButton("J");
JButton jb11 = new JButton("K");
JButton jb12 = new JButton("L");
JPanel jp1 = new JPanel( );
jp1.add(jb1);
jp1.add(jb2);
jp1.add(jb3);
jp1.add(jb4);
JPanel jp2 = new JPanel(new GridLayout(4, 1));
jp2.add(jb5);
jp2.add(jb6);
jp2.add(jb7);
jp2.add(jb8);
JPanel jp3 = new JPanel(new GridLayout(2, 2));
jp3.add(jb9);
jp3.add(jb10);
jp3.add(jb11);
jp3.add(jb12);
JPanel jp4 = new JPanel(new BorderLayout( ));
jp4.add(jp1, BorderLayout.NORTH);
jp4.add(jp2, BorderLayout.EAST);
jp4.add(jp3, BorderLayout.WEST);
JFrame jf = new JFrame( );
jf.getContentPane( ).add(jp4);
jf.pack( );
jf.setVisible(True);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
70
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");
JPanel jp1 = new JPanel(new GridLayout(3, 3));
jp1.add(jb1);
jp1.add(jb2);
jp1.add(jb3);
jp1.add(jb4);
jp1.add(jb5);
jp1.add(jb6);
jp1.add(jb7);
JFrame jf = new JFrame( );
jf.getContentPane( ).add(jp1);
jf.pack( );
jf.setVisible(True);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
71
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.
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
72
Write a set of code that will allow a user to select an input image and then place this image in a JLabel lab1 and add lab1 to a JPanel as the northern component in a JFrame using BorderLayout. The JFrame has already been instantiated as jf and the BorderLayout already established. Hint: a JFileChooser returns a File and JLabel requires the String name of a file as an argument. A File can return its name using File class' method getAbsolutePath( )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
73
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
74
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
75
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.
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
76
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.