Programming Logic and Design, 8th Edition Chapter 9 - ming Logic and Design 8th Edition Chapter 9 Review Questions 1 2 3 4 5 6 7 8 Which of the

Programming Logic and Design, 8th Edition Chapter 9 - ming...

This preview shows page 1 - 3 out of 390 pages.

gic and Design, 8th Edition Chapter 9 Review Questions 1 Which of the following is true? A program can call one method at most. A method can contain one or more other methods. A program can contain a method that calls another method. All of the above are true. 2 Which of the following must every method have? a parameter list a header a return value all of the above 3 abstract object-oriented program level in scope 4 a value in a method call a passed constant a formal parameter a variable that is local to a method 5 A method’s interface is its _____. parameter list return type identifier all of the above 6 When you write the declaration for a method that can receive a parameter, which of the following must the name of the argument that will be used to call the method a local name for the parameter the data type of the parameter two of these 7 When you use a variable name in a method call, it _____ as the variable in the method header. can have the same name cannot have the same name must have the same name cannot have the same data type 8 myMethod(12) myMethod(12, "Hello") myMethod("Goodbye") It is impossible to tell. Which of the following is most closely related to the concept of local ? Although the terms parameter and argument are closely related, the difference is that argument refers t Assume you have written a method with the header void myMethod(num a, string b) . Whi
9 num string void 10 myMethod() myMethod(test) myMethod(test, test) myMethod(test,"A") 11 be numeric be a variable match the data type used before the method name in the header two of the above 12 When a method receives a copy of the value stored in an argument used in the method call, it means th unnamed passed by value passed by reference assigned its original value when it was declared 13 A void method _____. contains no statements requires no parameters returns nothing has no name 14 When an array is passed to a method, it is _____. passed by reference passed by value unnamed in the method unalterable in the method 15 When you overload a method, you write multiple methods with the same_____. name parameter list number of parameters return type 16 num calculateTaxes(string name, num amount) string calculateTaxes(num money, string taxpayer) num calculateTaxes(num annualPay, string taxpayerId) All of these can coexist without ambiguity. 17 Methods in the same program with identical names and identical parameter lists are _____. overloaded overworked overwhelmed ambiguous 18 Methods in different programs with identical names and identical parameter lists are _____. overloaded Assume you have written a method with the header num yourMethod(string name, num cod num and string Assume you have written a method with the header string myMethod(num score, string The value used in a method’s return statement must _____.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture