Deck 7: Object-Oriented Design

ملء الشاشة (f)
exit full mode
سؤال
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 may lead to errors.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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 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
سؤال
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.
سؤال
During program development, software requirements specify

A) how the program will accomplish the task
B) what task 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 these
سؤال
The most important decisions regarding the development of a system are made during the implementation phase while code is actively being written.
سؤال
Once we have implemented the solution, we are not done with the problem because

A) the solution may not be the best or 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 these
سؤال
Any class can implement an interface, but no classes can implement more than a single interface.
سؤال
Assume that the class Bird has a static method fly(). If b is a Bird, then to invoke fly, you could do Bird.fly();.
سؤال
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
سؤال
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
سؤال
The graphical effect caused when a shape seems to resize as the mouse is dragged is known as rubberbanding.
سؤال
Unlike the String class where you must pass a message to an object (instance) of the class, in order to use the Math class, you pass messages directly to the class name, as in Math.sqrt().
سؤال
Interface classes cannot be extended but classes that implement interfaces can be extended.
سؤال
All objects implement Comparable.
سؤال
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
سؤال
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
سؤال
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 at any of these stages
سؤال
The versions of an overloaded method are distinguished by the number, type, and order of their parameters.
سؤال
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
سؤال
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
سؤال
Explain the difference between implementing an interface and a derived class.
سؤال
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
سؤال
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.
سؤال
Refer to Code Description Ch 07-1: Which of the following method headers would properly define the method needed to make this class Comparable? (cp designates ChessPiece)

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)
سؤال
Which of the following methods is a static method? The class in which the method is defined is given inside the parentheses following the method name.

A) equals(String)
B) toUpperCase(String)
C) sqrt(Math)
D) format(DecimalFormat)
E) None of these
سؤال
In order to create a constant, you would use which of the following Java words?

A) private
B) static
C) int
D) final
E) class
سؤال
Static methods cannot

A) reference instance data
B) reference non-static instance data
C) reference other objects
D) invoke other static methods
E) invoke other non-static methods
سؤال
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) this could occur at any time
سؤال
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 these
سؤال
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
سؤال
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
سؤال
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) the first solution may not solve the problem correctly
E) all of these
سؤال
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) this could occur at any time
سؤال
Assume a class Foo implements Comparable. Without knowing anything else about the Foo class, write an equals 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.
سؤال
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) all four levels require equal creativity
سؤال
Provide a reason why a method would be declared static.
سؤال
Provide a reason why an instance data would be declared static.
سؤال
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
سؤال
In what way is black-box testing better than glass-box testing? In what way is glass-box testing better than black-box testing?
سؤال
Refer to Code Description Ch 07-1: 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. Create this code.
سؤال
Write code that outputs all of the int values between 1 and 100 with five values per line, and each of those five values spaced out equally. Use a single for loop to solve this problem.
سؤال
Refer to Code Description Ch 07-1: 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.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/44
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Object-Oriented Design
1
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 may lead to errors.
False
2
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.
False
3
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
D
4
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
5
During program development, software requirements specify

A) how the program will accomplish the task
B) what task 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 these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
6
The most important decisions regarding the development of a system are made during the implementation phase while code is actively being written.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
7
Once we have implemented the solution, we are not done with the problem because

A) the solution may not be the best or 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 these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
8
Any class can implement an interface, but no classes can implement more than a single interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
9
Assume that the class Bird has a static method fly(). If b is a Bird, then to invoke fly, you could do Bird.fly();.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
10
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
11
Formal parameters are those that appear in the method call and actual parameters are those that appear in the method header.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
12
The graphical effect caused when a shape seems to resize as the mouse is dragged is known as rubberbanding.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
13
Unlike the String class where you must pass a message to an object (instance) of the class, in order to use the Math class, you pass messages directly to the class name, as in Math.sqrt().
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
14
Interface classes cannot be extended but classes that implement interfaces can be extended.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
15
All objects implement Comparable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
16
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
18
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 at any of these stages
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
19
The versions of an overloaded method are distinguished by the number, type, and order of their parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
20
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
21
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
22
Explain the difference between implementing an interface and a derived class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
23
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
24
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
25
Refer to Code Description Ch 07-1: Which of the following method headers would properly define the method needed to make this class Comparable? (cp designates ChessPiece)

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)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following methods is a static method? The class in which the method is defined is given inside the parentheses following the method name.

A) equals(String)
B) toUpperCase(String)
C) sqrt(Math)
D) format(DecimalFormat)
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
27
In order to create a constant, you would use which of the following Java words?

A) private
B) static
C) int
D) final
E) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
28
Static methods cannot

A) reference instance data
B) reference non-static instance data
C) reference other objects
D) invoke other static methods
E) invoke other non-static methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
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) this could occur at any time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
30
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
31
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 these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
32
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
33
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
34
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) the first solution may not solve the problem correctly
E) all of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
35
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) this could occur at any time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
36
Assume a class Foo implements Comparable. Without knowing anything else about the Foo class, write an equals 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
37
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) all four levels require equal creativity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
38
Provide a reason why a method would be declared static.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
39
Provide a reason why an instance data would be declared static.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
40
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
41
In what way is black-box testing better than glass-box testing? In what way is glass-box testing better than black-box testing?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
42
Refer to Code Description Ch 07-1: 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. Create this code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
43
Write code that outputs all of the int values between 1 and 100 with five values per line, and each of those five values spaced out equally. Use a single for loop to solve this problem.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
44
Refer to Code Description Ch 07-1: 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.