Page 228 - computer science (868) class 11
P. 228
5. What is the difference between Actual Parameter and Formal Parameter?
Ans. The difference between actual parameters and formal parameters are the following:
Actual Parameter Formal Parameter
The actual values that are passed directly or through The values send by the calling program are received in the
variables to the respective method at the time of calling the parameters described in the method. These parameters
method are called Actual Parameters. that receives the values from the caller program are known
as Formal parameters.
6. What is the difference between Pass by Value and Pass by Reference?
Ans. The difference between "Pass by Value" and "Pass by Reference" are the following:
Pass by Value Pass by Reference
In this process, the copy of the actual parameters is sent to In this type of programming, the actual parameters and the
the formal parameters, then it is referred as pass by value. formal parameters share the same location in the memory.
Any change in the Formal parameter will not reflect on the Any change in the formal parameter while the method is
Actual parameter executing, will cause the actual parameter also to change.
Any type of primitive data can be used in Pass by value. Only non-primitive data can be used in Pass by reference.
7. What is the difference between "Pure Method" and "Impure Method"?
Ans. The difference between the Pure Method and the Impure Method are the following:
Pure Method Impure Method
A pure method does not change the state of an object. An impure method changes the state of an object.
It returns a value to the function from where it is called. It may or may not return a value to the function from
where it is called.
8. What is Method Overloading? How does the compiler differentiate between methods which are overloaded?
Ans. Method Overloading is the process of creating different functions with the same name but with a different number of parameters
or different data types of the parameters.
The different ways of differentiating between methods are by having:
• functions with the same name but different types of parameters.
• functions with the same name but different number of parameters.
Unsolved Questions
A. Tick ( ) the correct answer:
1. The return value is ………………… if n = 4
public int twice (int n)
{
int tw= n * 2;
return tw;
}
a. 8 b. 4
c. 2 d. None of these
2. ………………… is a part of method header containing only the name of the method along with parameter list.
a. Method Header b. Method Footer
c. Method Signature d. None of these
3. Which of the following is/are access specifiers?
a. public b. private
c. protected d. All of these
226226 Touchpad Computer Science-XI

