Sie sind auf Seite 1von 4

ASSIGNMENT 1

CLASS XI(2015-16)
(1)
(2)
(3)
(4)
(5)

What is the advantage there in using function prototype within a program.


Which are rules followed at the time of Default argument.
Distinguish between formal parameter and actual parameter.
Explain the difference between a function declaration and a function defination.
Explain the meaning for each of the following function declaration:(a) int f(int a);
(b)double f(int a, int b);
(c )void f(short a, long b , unsigned c);
(d) char f();
(e) unsigned f(unsigned a, unsigned b);

(6) Write the first line of the function declaration and the function defination for each of the
statement :(a)
(b)
(c)
(d)
(e)
(f)

The function fun() generates and return an integer quantity.


The function root() accept two integer argument and return a floating point.
The function convert() accept a character and return another character.
The function transfer() accept a long integer and return a long integer.
The function inverse() accept a character and return a long integer.
The function process() accept an integer and two floating point quantities (int that order)
and return a double precision quantity.
(g) The function value() accept two double precision quatities and short integer quantity.

(7)WAP to find the root of quadratic ax2 +bx+c=0 for a given number a, b, c using function.
(8) WAP to find the HCF of the given two positive intger using function that return an
interger quantity.
(9) WAP using function to input the temperature in Fahrenheit and pint its Centigrade
equivalent . Let the function receive the temperature in Fahrenheit as argument and return
type the converted temperatue.

(10) WAP using function to input a number and print whether it is odd or even . The number
has to be sent to a function as argument whereas the function should return O if odd else
return E.
(11) WAP using function to input three line an print whether they can make triangle or not , if
yes return Y else return N. if yes then pass argument to function and find the area of
triangle using Herons formula.
(12) Find the output of the following:(1)
#include<iostream.h>
static int i=50;
{
static int i=3;
cout<<\n<< i ; i= i +4;
cout<<\n<<::i;
function( )
cout <<\n<<I;
cout<<\n<<::I;
}
(2)
#include<iostream.h>
void play(int a , int & b)
{
a+ =b++;
int t = a+b;
cout<<\n<<t<<\t<<a<<\t<<b;
}
void main()
{
int a = 190;
int b =40;
if (a/b >2)
play(a,b)
cout<<\n<<a<<\t<<b;
}
(3)
#include<iostream.h>
void fun(int a, int & b , int c=62)

{
a=b+c; b=a+c; c= a+b;
cout<<a<<b<<c;
}
void main()
{
int x=55; int y=6;
cout<<endl;
fun(x,x);
cout<<x<<y<<endl;
fun(x,y,y);
cout<<endl;
cout<<x<<y;
}

(4)
#include<iostream.h>
float fun(float f, int &a , float b =5.56)
{
if (++f+b>69.7)
a+ 100;
else
a+100;
b++;
cout<<a<<b<<f<<endl;

return f-b;
}
void main()
{
int x=90;float f1=9.96;
cout<<fun(f1, x, 50.5);
cout<<x<<f1<<endl;
cout<<fun(f1,x, f1);
cout<<x<<f1<<endl;
}

Das könnte Ihnen auch gefallen