• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/18

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

18 Cards in this Set

  • Front
  • Back
Which of the following must every method have?

a. Header
b. A parameter list
c. At least one variable
d. All the above
A
3. Which of the following is most closely related to the concept of "local"?

a. abstract
b. object-oriented
c. in scope
d. program level
C
4. Although the terms parameter and arguments are closely related, the difference between them is that "argument" refers to ____________________.

a. a passed constant
b. a value in a method call
c. a formal parameter
d. a variable that is local to a method
B
5. The notion of ________________ most closely describes the way a calling method is not aware of the statements within a called method.

a. abstraction
b. object-oriented
c. implementation hiding
d. encapsulation
C
A methods name and parameter list constitute its

a. signature
b. return type
c. identifier
d. Class
A
Which of the following must be included in a method declaration for a method that receives a parameter:

a. the name of the argument that will be used to call the method
b. a local name for the parameter
c. the return value for the method
d. All of these
B
8. When you use a variable name in a method call, it __________ the same name as the variable in the method header.

a. can have
b. cannot have
c. must have
d. must not have
A
9. Assume you have written a method with the header void myMethod(num a, string b)
Which of the following is a correct method call?

a. myMethod(12)
b. myMethod(12, “Hello”)
c. myMethod(“Goodbye”)
d. It is impossible to tell.
B
10. Assume you have written a method with the header num yourMethod(string name, num code)
The method’s type is ____________________.

a. num
b. string
c. num and string
d. void
A
11. 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()
b. myMethod(test)
c. myMethod(test, test)
d. myMethod(test,"A")
D
If a method returns a value, you __________the returned value when you call the method.

a. Must use
b. Must not use
c. Usually will want to use
d. Usually will not want to use
A
14. A void method ______________________.

a. contains no statements
b. requires no parameters
c. returns nothing
d. has no name
C
13. When a method receives a copy of the value stored in an argument used in the method call, it means the variable was ________________________.

a. unnamed
b. passed by value
c. passed by reference
d. assigned its original value when it was declared
B
15. When an array is passed to a method, it is ________________.

a. passed by reference
b. passed by value
c. unnamed in the method
d. unalterable in the method
A
16. When you overload a method, you write multiple methods with the same________________.

a. name
b. parameter list
c. number of parameters
d. return type
A
A class 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?

a. num calculateTaxes(string name, num amount)
b. string calculateTaxes(num money, string taxpayer)
c. num calculateTaxes(num annualPay, string taxpayerId)
d. All of these can coexist without ambiguity.
A
18. Methods in the same program with identical names and identical parameter lists are ____________________.

a. overloaded
b. overworked
c. overwhelmed
d. illegal
D
19. Methods in different programs with identical names and identical parameter lists are _____________________.

a. overloaded
b. illegal
c. both of these
d. none of these
D