Page 217 - C++
P. 217
PRACTICE PAPER -IV
Max Marks: 70 Time: 3 Hrs
Q.1 a) What are the two factors on which access of the inherited members depend? [2]
b) Write the names of header files, which are necessary to run the following program:
main()
{ char c ;
c=getchar( ) ;
if (isdigit(c))
cout<<”\nIt is a digit” ;
if (isalpha(c))
cout<<”\nIt is any alphabet” ;
return 0;
} [1]
c) Rewrite the following program after removing the syntactical error(s) if any. Underline each
correction.
#include<iostream.h>
void main( )
{ First = 10 , Second = 20 ;
Jumpto(First ; Second) ;
Jumpto(second) ;
}
void Jumpto(int N1 , int N2=20)
{ N1 = N1 + N2 ;
cout<<N1>>N2 ;
} [2]
d) Find the output of the following program segment (assume all necessary declarations are
already made).
# include<iostream.h>
void main( )
{ int Track[ ] = { 10,20,30,40 } , *Striker ;
Striker = Track ;
Track[1]+=30 ;
cout << “Striker=”<<*Striker<<endl ;
*Striker - =10 ;
Striker++ ;
cout<<”Next @” << *Striker << endl ;
Striker += 2 ;
cout<<”Last #” << *Striker << endl ;
cout<<”Reset To” << Track[0] << endl ;
} [2]
e) Find the output of the following program segment with working (assume all necessary
declarations are already made):
void FUNC(int *a , int n)
{ int i , j , temp , sm , pos ;
for(i = 0 ; i < n/2 ; i++)
for(j = 0 ; j < (n/2)-1 ; j++)
if(*(a+j) > *(a+j+1))
{ temp = *(a+j) ;
1