principles of programming ch 9
When you write the declaration for a method that can receive a parameter, which of the following must be included in the method declaration?
a local name for the parameter the data type of the parameter two of the above
a program contains a mehod with the header num calculateTaxes(num amount, string name). Which of the following methods can coexist in the same program with no possible ambiguity?
a num calculateTaxes(string name, num amount)
Which of the following is true?
a program can contain a method that calls another method
Although the terms parameter and argument are closely related, the difference is that argument refers to ______.
a value in a method call
Methods in the same program with identical names and identical parameter lists are _____.
ambiguous
Which of the following must every method have?
header
The notion of _______ most closely describes the way a calling method is not aware of the statements within a called method.
implementation hiding
Which of the following is most closely related to the concept of local?
in scope
Programmers should strive to ________.
increase cohesion
The value used in a method's return statement must
match the data type used before the method name in the header
Assume that you have written a method with the header void myMethod(num a, string b). Which of the following is a correct method call?
myMethod(12, "Hello")
Assume that you have written a method with the header string myMethod(num score, string grade) Also assume that you have declared a numeric variable named test. Which of the following is a correct method call?
myMethod(test, "A")
When you overload a method, you write multiple mehods with the same
name
Methods in different programs with identical names and identical parameter lists are ______.
none of the above
Assume that you have written a method with the header num yourMethod(string name, num code) The methods type is _______________.
num
A method's interface is its ________.
parameter list return type identifier all of the above
When an array is passed to a method, it is
passed by reference
When a method receives a copy of the value stored in an argument used in the method call, it means the variable was
passed by value
a void method
returns nothing
When you use a variable name in a method call, it _____ as the variable in the method header.
can have the same name