Python Unit 9

  1. 1. Which of the following is true?




    C. A program can contain a method that calls another method.
  2. Which of the following must every method have?




    B. a header
  3. Which of the following is most closely related to the concept of local?




    A. in scope
  4. Although the terms parameter and argument are closely related, the difference is that argument refers to _____.




    D. a value in a method call
  5. A method's interface is its ______.




    D. all of the above
  6. When you write the declaration for a method that can receive a parameter, which of the following must be included in the method declaration?




    B. two of these
  7. When you use a variable name in a method call, it ____ as the variable in the method header.




    A. can have the same name
  8. Assume you have written a method with the header void myMethod(num a, string b). Which of the following is a correct method call?




    B. myMethod(12, "Hello")
  9. Assume you have written a method with the header num yourMethod(string name, num code). The method's type is _____.




    A. num
  10. Assume you have written a method with the header string myMethod(num score, string grade). Also assume you have declared a numeric variable named test. Which of the following is a correct method call?




    A. myMethod(test, "A")
  11. The value used in a method's return statement must ______.




    C. match the data type used before the method name in the header
  12. When a method receives a copy of the value stored in an argument used in the method call, it means the variable was _____.




    C. passed by value
  13. A void method ____.




    B. returns nothing
  14. When an array is passed to a method, it is _____.




    B. passed by reference
  15. When you overload a method, you write multiple methods with the same _____.




    A. name
  16. A program contains a method with the header num calculateTaxes(num amount, string name). Which of the following methods can coexist in the same program with no possible ambiguity?




    D. num calculateTaxes(string name, num amount)
  17. Methods in the same program with identical names and identical parameter lists are ______.




    B. ambiguous
  18. Methods in different programs with identical names and identical parameter lists are ________.




    D. none of the above
  19. The notion of _______ most closely describes the way a calling method is not aware of the statements within a called method.




    B. implementation hiding
  20. Programmers should strive to ______.




    B. increase cohesion
Author
jdavis123
ID
357772
Card Set
Python Unit 9
Description
Updated