Methods
Methods
METHODS WORKSHEET 1
CLASS X
1. A static data member has …………. for all objects of a class.
a) multiple copies b)single copy c) arranged copy d)unsorted copy
4. What is the return type of a method that does not return a value?
a) double b) int c) float d) void
5. Identify the instance and local variables in the following code snippet:
class var
{ int p, q;
var( int n, int m )
{ p = n;
q = m; } }
a) instance n, m local p, q c) instance m local q
b) instance p, q local n, m d) instance n local p
6. What is the process of defining more than one method with same name in a class
differentiated by method signature called?
a) method overloading b) method overriding c) defining method d) calling method
7. The prototype of a function Show() that returns a float value and takes two integer values as
parameter is :
a) public void Show(int a, int b) c) public float Show(int a)
b) public void Show(int b) d) public float Show(int a, int b)
8. The keyword that transfer the control back to the method call:
a) Throws b ) return c) send d) back
11. A method that does not return a value has a ....................return type.
a) double b) class c)float d) void
13. The parameters that are passed to the method when it is invoked are called .................
a) actual parameters c) formal parameters
b) informal parameters d) void parameters
14. The method that changes the state of an object is known as ............. .
a) pure method b) impure method c) perfect method d) imperfect method
15. The technique in which the change in the formal parameter gets reflected in the actual
parameter is known as ........................ .
a) call by reference b) call by value c) call by argument d) call by method
16. In which technique are the values of actual parameters copied to the formal parameters?
a) call by reference b) call by value c) call by argument d) call by method
18. Which of the following keywords are used to control access to a class Member
a) default
b) Interface
c) Abstraction
d) protected
20. The technique in which the values of actual parameters are copied to the formal
parameters
a) Call by value b. Call by argument c. call by reference d. Call by method