Friday, 15 February 2013

Class X - Method

Points to remember:
1. Two ways of invoking functions: call by value, call by reference.
2. Function overloading: More than one function with the same name but different arguments or data types.
3. A function returns only one value at a time.

Section A
1. What is function prototype?
2. What is function signature?
3.Differentiate : Actual and Formal parameters.
4. Explain :
     i. Calling the funtion by value.
    ii. Calling the function by reference.
5.Explain Pure and Impure functions with examples.
6. What is the function of  'this'  keyword.
7. Give the prototype of a function check which receives a character ch and an integer n and returns true or false.

Section B
1. Design a class overloadCompare to do the following:

void compare (int,int) - compare and print the biggest of  2 integers.
void compare(char,char) - compare the numeric values of two characters and print the charecter with higher numeric value.
compare(String,String)- compare the length of 2 strings and print the longer of the two.

2. Write a menu driven program using a function area( ) to compute the following:
area of square = side x side
area of circle = 3.14 x r x r
area of rectangle = l x b
3. Define a function primeNum (int n) which returns 1 if n is prime otherwise returns 0.
4. Define a class equation to print the results of the following equation with the help of the functions:
n ! /  r ! * (n-r)!