CBSE Board Class 12 Computer Science Sample Papers 2011


CBSE Board Sample Papers 2011 for Class 12 Computer Science

Sample Paper – 2011
Class – XII
Subject - Computer Science

Time allowed : 3 hours                                Maximum marks : 70


Note :
i)All the questions are compulsory .
ii)Programming Language  : C++ .


1.a) What is the difference between Auto variables and Static variables? Give an example
     to illustrate the same.              2                 

b) Name the header files for the following functions           2
(1)cgets
(2)floor
(3)isalpha
(4)  gets 

c)In the following C++ program what is expected value of myscore from options  (i) to (iv)      
     given  below.          2
              #include<stdlib.h>
             #include<iostream.h>
void main(  )
{
   randomize( );
             int score[]={ 25, 20,34,56, 72, 63};
             int myscore=score[2+random(2)];
            cout<<myscore<<endl;
            }
     i) 25  ii) 34  iii) 20  iv) None of these                                              

d)Give the output of thefollowing program (Assuming all required header files are included
          in the program ).          2
void swap(char &c1,char &c2)
{ char temp;
temp=c1;
c1=c2;
c2=temp;
  }
     void update(char *str)
     {         int k,j,l1,l2;
    l1 = (strlen(str)+1)/2;
    l2=strlen(str);
     for(k=0,j=l1-1;k<j;k++,j--)
     {
  if(islower(str[k]))
   swap(str[k],str[j]);
        }
    for(k=l1,j=l2-1;k<j;k++,j--)
    {
      if(isupper(str[k]))
   swap(str[k],str[j]);
               }
        }


void main()
{  
   char data[100]={"gOoDLUck"};
cout<<"Original Data : "<<data<<endl;
update(data);
cout<<"Updated Data "<<data;
}

  e)  Give the output of the following program segment :                                                  3
       void main()
     {  int x[] = { 11,22, 33, 55, 112};
          int *p = x ;
           while(*p<110)
          {  if(*p%3 !=0)
                *p=*p+1 ;
              else
                  *p=*p+2 ;
               P++ ;
           }          
           for( int i=4 ;i>=1 ;i--)
         {   cout<<x[i]<< ‘*’ ;
           if(i%3= =0 )
          cout<<endl ;
        } cout<<x[0]*3<<endl ;
      }       


Q-2 a. Define Multilevel and Multiple Inheritance with example .                                  2
    
       b. Define a class ELECTION in C++ with the following descriptions:                    4 
           Write a suitable main ( ) function also to declare 3 objects of ELECTION type and
            find the winner and display the details .
Private members :
Data :  candidate_name , party , vote_received
Public members :
Functions  : Enterdetails ( ) – To input data
    Display ( ) –         To display the details of the winner
    Winner ( ) –          To return the details of the winner trough the object after 
                                                                             comparing the  votes received by three candidates .

d.Answer the questions (i) to (iv) based on the following code :
        class RED                   4
{
  char n [ 20 ];
  void input ( );
protected :
  int x , y ;
  void read ( );
public :
  RED ( );
  RED ( int a );
  void get_red ( );
  void put_red ( );
};
class WHITE : protected RED
{
  void a , b ;
protected :
  int c , d ;
  void get_white( );
public:
  WHITE ( );
  Void put_white ( );
};
class BLACK : private WHITE
{
  void * p ;
  char st[20];
protected :
  int q;
  void get_black( );
public:
  BLACK ( );
  void put_black ( );
}ob;

a.Name the data members and functions which are accessible by the objects of class BLACK.
b.Give the size of object ob
c.Name the OOPS concept implemented above and its type .
d.Name the members accessible by function get_black( );



3.a) Write a function in C++ to delete a name from a list of names.                         3         
              
   b) An array A[13][14] is  stored  in  the  memory  along  the column with each element
        occupying 4 bytes. Find out the Base address and address of the element A[3][7]
         if the element A[4][4] is stored at the address 1300.                                                      4 


c) Consider the following portion of a program , which implements names queue for  Books .
     Write the definition of function Insert(), to insert a new node in the queue with required
      information  .                                                           4
struct Book
{
char names[4][20];
};
class QueueofBooks
{
Book Q[10];
public :
int front ,rear;
QueueofBooks()
{
  front=rear=-1;
}
void Insert();
void Delete();
};

d) Write a function in C++ which accepts a 2D array of integers and its size as arguments      and displays elements which are exactly two digit number.                                                  3
              If 2D array is 
             Output is
             14 25 32 45 11 28 18 
 
e) Evaluate the following postfix expression using a stack and show the contents of stack
    after execution of each operation:  A-B+C*D^E*G/H                                                   3



5.a) Observe the program segment given below carefully and answer the question that follows :                1 
  class college
{ private :
            char name[25];
             int numstu;
     public:
  void incollege( );
  void outcollege( );
  int retnumstu( )
  { return numstu; }
};
void modify(college A)
{ fstream INOUT;
  INOUT.open(“college.dat”,ios::binary|ios::in|ios::ate);
  college B;



  int recread=0, found=0;
  while(!found && INOUT.read((char*)&B,sizeof(B))
{ recread++;
  if(A.retnumstu( )= = B.retnumstu( ))
  {
                              ____________________________// statement1
   INOUT.write((char*)&A,sizeof(A));
   Found=1;
    }
   else
    INOUT.write((char*)&B,sizeof(B));
   }
  if(!found)
   cout<<”\nRecord for modification does not exist”;
  ________________  ;  // statement2  }

If the function modify( ) is supposed to modify a record in file college.dat with the values of college A passed to its argument, write the appropriate statement for missing statement1 using seekp( ) or  seekg( ), whichever needed, in the above code that would write the modified record at its  proper place and fill also for statement 2 .

 b)Write a function in C++ to transfer a particular type of stock from the file “stock.dat”  to another   file “Site.dat”. Assuming that the binary file is  containing the records of following structure:          2        
struct Products
{
  int id;
  char Iname[30];
  int type;
};
           Remember that transfer means deletion from the “stock.dat” file and addition in the “site.dat” file.

  c) Assume that a text file named “MATHS.TXT” contains text and some mathematical operators written into  it.      “MATHS.TXT”  contains  only  five  types  of  operator   ‘+’ , ‘−’ , ‘*’ , ‘/’ , ‘=’.Write a function named copyoperator() that reads   the file “MATHS.TXT” and create a new filenamed “OPERATOR.TXT”, to contain only operators from the file “MATHS.TXT”.
      In “OPERATOR.TXT” operators are separated by comma.                           3
            For example: If “MATHS.TXT” contains
                                        Result of 2 + 4 * 3 = 14
    Result of 16 / 2 + 1 = 9
              Then the file “OPERATOR.TXT” shall contain
                                         + , * , = , / , +
6.(a)What do you understand by Primary Key. Give one database example .                    2

       (b). Write the SQL statement for the following :
       (i)    Display all distinct records from PREPAID .
      (ii)   To display the Model & Amount for Preeti , Suchismita & Pavani .
      (iii)  Create a view called  ITSECTOR , which contains all the information of PREPAID

     table whose  Connection is Hutch or Model is Nokia .  
     (iv)  Find all customer name whose model is same as of  Suchismita .
     (v)  select Cname , Cmodel , Amount form PREPAID , POSTPAID where PREPAID.Vrno = POSTPAID.Vno ; 
     (vi)    select  Connection , sum(Amount) from PREPAID group by Connection ;
    (vii)    select * from  PREPAID where Model is NULL ;  .
    (viii)   select Model , count(*) from PREPAID  group by Model Having Amount >800 ;

7  (a) State and prove the Distributive law algebraically.   2

       b) Write the equivalent POS expression of following  SOP form
           F (x,y,z)= ∑ (0,2,4,6)        2

       c)  Draw the Logical circuit of the following expression with the help of NOR gate only                 
            x+yz .            1

        d) Obtain the simplified form of a Boolean expression using K-Map.                                             
             F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14)       3

8.  (a) What  are cookies.   1

      (b) Define the term Bandwidth. Give unit of  Bandwidth.    1

      (c)  Expand the following terminology : (i) NSF  (ii) ARPANET    1

      (d) Define the term NIU.    1
     
      (e)  Distinguish between star and Bus topology    2

CBSE Board Best Sellers

In order to keep pace with technological advancement and to cope up with CBSE Board examinations, Pearson group has launched Edurite to help students by offering Books and CDs of different courses online.

Sign Up FREE

Get help on CBSE Board Sample Question Paper for class 12 Now

ALWAYS LEARNING