Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
ASSIGNMENT 5(CLASS Xi computer science c++)
FUNCTION AND ARRAYS
Q1.Write down four advantages of function?Q2.What do you understand by function signature/prototype?Q3.What is the difference between user defined function and built infunction?Q4.What is the effect of writing keyword const as a prefix to any formalargument?Q5.When are default arguments useful?Q6.Define actual and formal parameters?Q7.Name different type of arrays?Q8.List the characteristics of an array?Q9.What is index/subscript in array declaration?Q10.Write numbers of element and byte occupied in following declaration of array:(i)int A[5][6](ii)char c[5][10](iii)float p[10](iv)long int k[7](v) char name[15]Q11.Which of the following are invalid array declaration and why :(i)int m[+10](ii)int a[0.9](iii)int a[-10](iv)int p[5]Q12.Write C++ statements for the following:
(i)
Assign value 10 to 6
th
element of array called marks.
(ii)
Assign value 20 to element at 3
rd
row and 5
th
columnof array A.
 
 
Q13.What is the difference between local and global variable. Give example.Q14.Write down output of the following program code:(A)#include<iostream.h>void execute(int &b,int c=50){int t=b+c; b+=t;if(c!=100)cout<<t<<b<<c<<”\n”;}void main( ){int p=90,q=10;execute(p);cout<<p<<q<”\n”;execute(p,q);cout<<p<<q<”\n”;}(B)#include<iostream.h>void main( ){int i=4;int a;a=add(i);cout<<a;}int add(int j){if(j>=4)j=j*j;else j=j*2;return(j);}(C) #include<iostream.h>void main( ){int i,a;for(i=1;i<=5;i++)(d) #include<iostream.h>void execute(int a,int &b,int c=50){if( ++a>c)b++;
 
a=add(i);cout<<a;}int add(int j){int b;b=j*j;else j=j*2;return(j);}else b--;cout<<a<<”\t”<<b<<”\t”<<c<<”\n”;}void main( ){int p=3,q=5;execute(p,q,q);cout<<p<<”\t”<<q<”\n”;execute(p,q);cout<<p<<”\t”<<q<”\n”;execute(q,p,q);cout<<p<<”\t”<<q<”\n”;}(E)#include<iostream.h>int j=5;void main( ){int i=4,j=5;int a;a=add(i);cout<<a<<j;a=add(::j);(F) )#include<iostream.h>int p=9;void main( ){int i=4,p=5;int a;a=i+p;i=a+::pcout<<a<<”\t”<<i<<”\t”<<p;
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more