APSDK
   Latest News
TEACHERS WORKSHOP FROM 13 MAY 2013 TO 17 MAY 2013.    SCHOOL REOPENS ON 01 JULY 2013 AFTER SUMMER BREAK.                 
  

                                                                                                          The Army Public School

ANNUAL EXAM - Class XI

Computer Science

 

M.Marks – 70                                                                            2010-11                                                     Time –3 Hour

 

Q1. Explain  and differentiate the following  (Attempt any four )              ( 8 )

i)      Global and Local variable 

ii)     Function Call by Value and by Reference

iii)    Continue statement and Break statement

iv)   gets( ) and puts( )

v)    if and switch case statements.

 

Q 2 Give  the use and name of header files to which following

     inbuilt functions belong to (with examples) : ( Any four  )            ( 1 ½ X 4 = 6)

    1) exit( )   2) strcmp( )    3) ceil ( )     4) fabs( )     5) isalnum( ) 

 

Q3. Write the outputs of the following programs :                                ( 2 X 3 =6)

i)    int sum(int arr[ ], int size) ;

         void main( )

      { int val[ ]={ 1,3,5,7,9,11,13,15,17,19};

        int s1=0,s2=0;

        s1=sum(val,4);

        s2=sum(val,2);

        cout<<s1<<” “<<s2;

        }

       int  sum(int arr[ ], int size)

       {  for(int i=0,s=0;i<size;++i)

          s+=arr[i];

          return s;         }

 

ii)      void sfn( int last)

       { int s=0;

         static int s1=0;

         for(int j=last ;j>0;j--)

          s=s+j;

          s1=s1+s;

          cout<<s<<” “ <<s1<<endl;

      }

     void main( )

       { for(int i=1;  i<4;  i++)

         sfn(i);   }

 

iii)       int p= 6;

      void change( int &a, int &b, int c)

        {  p=a%b;

           c=c+a;

           a=a+8;

            b = p+a ;

            cout<<p<<a<<b<<c<<endl;

         }

        void main( )

         { int p=3,q=7;

           change(::p,  p,   q);

           cout<<::p<< p << q<<’\n’;   }

 

 

Q4. Find syntax errors if any in following program( Assuming all header files are 

       present)   

                                                                                                                     ( 2 X 2 =4 )        

a)   void fact( int p)

     { long int f=1;

        for( j=1 ,j<=p , j++)

          f=f*j;          }    

 void main( )   

    {  int n;

       cin>>n;

       cout<< fact(n);

       cout<<endl<<p;       }

 

b) void main( )

{ int n1,n2;

  int sub(int m1,int m2)

  int res;

  cin>>n1;   cin>>n2;

  res=sub(n1);

  cout<<res<<i;   }

          

           float sub(int m1, int m2);

           { for(int i=1;i<5;i++)

                 m1++;

                return (m1-m2);      }

 

Q5.  Write function definitions for the following( Any four ) :                     ( 4 X 4 =16 )                                                  

a)    A function average( ) to print the average of all the numbers divisible by 5 of an integer array X[20].

 

b)    A function Sum( ) which accepts a value n and returns the sum of the following series :

               1 + 1 + 2 + 3 + 5 + 8 + -------           n terms.

 

d)    Returns the number of spaces in a string received by the function count ( )

 

e)    A function Area( ) to return total area to the main after accepting length and breadth from the main, input by the user for a rectangle.

 

f)     A function locate( ) which finds and prints the location of a given character in a string.

 

Q6.Declare a structure :                                                                                         ( 5 )

      employee : code,name,address,mobile number, basic salary

 

      Write a program to calculate Net Salary of 10 employees if

      Net Salary= basic salary + da + hra

      Where da=65% of basic salary, hra=15% of basic salary          

 

Q7. Evaluate the following and write the result :                                                      ( 4 )

 

a)    (c-b>=d)  && (( b+d) >= (a +c))  || (((a + b) > c) && (( b-c) < d))  

                                                ( if a=5, b=1, c=3, d=1 )

 

 

 

 

b)     ( if x=7, y=3, z=5)

++x ;    --y ;

z=z-y ;

cout<< ++y << --z << ++z <<z++<< --x;

 

    c)   cout<< ++a << a++ << - -b << c++ << ++d << c- - << - -d << --b ;

                                               ( if a=2, b=6, c=3, d=8 )

d)     b = ++ c + 4*c  + c++ ;     ( if c = 6 initially)

 

 

 

Q 8. Write a program with a function  mirror( ) that accepts a string and  prints

        the mirror image of the String  input  in the main( ) by the user.

         e.g if the string is “What is this?”, then the function call will print --

          “?siht si tahW”                                                                                           ( 4 )

 

Q9. Write a program  to input an integer array X[10].Create another array Y[10]

       containing first the even  numbers and then the odd numbers from array X.                                      

                                                                                                                             ( 4 ) 

 

Q10. Write a program to accept sid , sname and sales of 10 salesmen for two

         months.Display the complete data in descending order of total sales of each

         salesman.                                                                                                    ( 5 )

 

Q11. Convert the following for loop to while and do-while loops respectively :  ( 3 )

         for( int k=3 ; k<=12 ; k++)

           { if(k%2==0)

               cout<<k*k*k;

              else

               cout<< k;

              cout<<endl;

             }              

 

Q12. Write a program to input two integer arrays Q[3][3] and P[3][3] and do the

        following:                                                                                                      ( 5 )

        

a)    Concatenate array P to array Q and print the concatenated array in a tabular format.

b)    Print the diagonals of Q in a proper format.

 

 

 

 

 
Alumni Login
     Username
     

     Password
     

Remember me
     

  Forgot login?       Register