+3 votes
in Class 12 by kratos

Differentiate between :

(a) Entry and Exit Control loop b

(b) Call by value and Call by reference

(c) If and Switch statement

(d) Actual and Formal parameter

1 Answer

+2 votes
by kratos
 
Best answer

(a) Entry controlled loop: Loop condition is checked before the body of the loop is **** (e.g) for and while. Exit controlled loop: Loop condition is checked after the body of the loop is **** once. (e.g) dowhile.

(b) call by value: The parameters to a function are passed, but changes done to the variable are not reflected back in the original variable. call by reference: In this type of passing parameters to the function, the address of variable is passed. Hence, any changes made inside the function are reflected to the value of original variable respectively.

(c) If: It is a decision making statement can take any condition for checking. Switch can take only equality condition.

(d) Actual parameter is the variables passed from the calling program.

Formal parameters are the variables present in the function definition.

(eg) int add (int a, int b)

{

cout<<a+b;

}

void main ()

{

cout << add (x,y);

}

Here, x & y are actual parameters. Whereas, a & b are formal parameters.

...