Warning: include_once(../../../../../headder.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 18

Warning: include_once(): Failed opening '../../../../../headder.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 18

CBSE Important Questions

CBSE Guess > Papers > Important Questions > Class XI > 2013 > Computer Science > Computer Science By Mr. Prabhuji Gupta

CBSE CLASS XI


Warning: include(../../../../../ads_330x250_middle.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 29

Warning: include(): Failed opening '../../../../../ads_330x250_middle.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 29

User Defined Functions

 

Previous Index

Most Important Questions

Q 1 What are the three steps in using a function?
Q 2 In how many ways can we pass variables to a function?
Q 3 What are the advantages of passing function arguments by reference over by value?
Q 4 In a function declaration there is no need to give variable names. Still it is recommended. Why?
Q 5 How can we prevent a reference from modifying the value of a variable when the variable is passed by reference?
Q 6 Write function prototypes for the following:
(a) A function, which receives an int and a float and returns a double.
 (b) A function which doesn’t receive anything and doesn’t return anything. 
(c)  A function that recives an array of ints, and a float reference and doesn’t  return anything.
 Q 7 Point out the errors, if any, in the following program:

(a) void f(int x, int y);
void main()
 {
   f();
 }

void f(int x=0, int y=0)
 {
   cout< < x < < y;
 }

(b) void main()
{
int a=30;
f ();
}
void f()
{
int b=20;
}

Q 8 What will be printed as the result of the operation below:

#define swap(a,b) a=a+b;b=a-b;a=a-b;
int swap2(int, int);
void main()
 {
int x=5, y=10;
swap (x,y);
cout<<x<<”,”<<y<</x<<”,”<<y<
x=5, y=10;
swap2(x,y);
cout<<x<<”,”<
 } </x<<”,”<
int swap2(int a, int b)
{
int temp;
temp=a;
b=a;
a=temp;
return 0;
}

Q 9 Given the function

int fun(int, float);
why will the following not work?
void fun1()
 {
int result;
result=fun(2,3);
}

Q 10 When is a default argument value used inside a function?
Q 11 What is principal reason for passing arguments by value?
Q 12 What is the principle reason for passing arguments by reference?
Q 13 Given the following code segment:

int a,b,c;
void main()
{
float d;
…………
{
int e=0;
……….…
}
}
void fun(float f)
{
double g,h;
}
Write the scope of all the variables in above code:

Q 14 Write a function, which will take a string and return the word count. Each word is separated by a space.
Q 15 Write a function, which will take the height of the person in inches and return the height in feet and inches in two separate variables.
Q 16 Write a function that interchanges and prints the value of two integer variables a and b without using third variable.
Q 17 Write a function using pointer variables as arguments to swap the values of two integer variables.
Q 18 Why prototyping is necessary in C++ program?
Q 19 Write a function in C++ to find the sum of the following series: 1+2+3+4+5+……….upto N terms

 

Previous Index

Submitted By Mr. Prabhuji Gupta
Email: [email protected]


Warning: include(../../../../../120_60_others.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 131

Warning: include(): Failed opening '../../../../../120_60_others.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/papers/cbse_important_questions/xi/2013/compur-science/user-defined-functions2.php on line 131