Thursday, 21 April 2016

CLASS-XII

Assignment-2
Constructors and Destructors
Chapter-5


1)What is a copy constructor? Give an example in C++ to illustrate copy constructor.  
2)Answer the questions i)and ii) after going through the following class
class work
{
int workid;
char worktype;
public:
~work()                                                 // Function1
{cout<<“un-allocated”<<endl;}
void status()                                        // Function2
{
cout<<workid<<endl;
}
 work()                                                 // Function 3
 { workid=10;worktype=‘t’;}
 work(work &w)                                  // Function4
{
 workid=w.workid+12;
 worktype=w.worktype+1;
}
};
   i)     Which member function out of function1,function2,function3 and function4 shown in above definition of class work is called automatically, when the scope of the object gets over? Is it known as constructor OR destructor OR overloaded function OR copy constructor?
ii)   Work w;  àstatement1
      Work y(w);àstatement2
Which member function out of function1,function2,function3 and function4 shown in above definition of class work will be called an execution of statement written as statement 1 and statement2? What are those functions specifically known as?     

3)  Given the following C++ code, answer the questions                                                                  
class test
{     int time;
      public:
      test( )                                       //function 1
      {
      time=0;
      cout<<”Bye”;
      }
      ~ test( )                                    //function  2
      {cout<<”hello”;
      }
      void exam( )                            //function 3
      {
      cout<<”GOD BLESS YOU”;
      }
      test(int duration)                     //function 4
      {
      time=duration;
      cout<<”exam starts”;
      }
      test(test &t)                             //function 5
      {
      time = t.duration;
      cout<<”exam finished”
      }
      };
·         In Object Oriented Programming, what is Function 1 referred as and when does it get invoked/called?
·         In Object Oriented Programming, what is Function 2 referred as and when does it get invoked/called?
·         Which category of constructor Function 5 belongs to and what is the purpose of using it?
·         Write statements that would call the member Function 1 and 4       



4)  Answer the questions (i) and (ii) after going through the following program:
#include <iostream.h>
#include<string.h>
class bazaar
{ char Type[20] ;
char product [20];
int qty ;
float price ;
bazaar()
//function 1
{ strcpy (type , “Electronic”) ;
strcpy (product , “calculator”);
qty=10;
price=225;
}
public :
void Disp() //function 2
{ cout<< type <<”-”<<product<<”:” <<qty<< “@” << price << endl ;
}
};
void main ()
{ Bazaar B ; //statement 1
B. disp() ; //statement 2
}
(i) Will statement 1 initialize all the data members for object B with the values given in the function 1 ? (YES OR NO)  Justify your answer suggesting the correction(s) to be made in the above code.
 (ii) What shall be the possible output when the program gets executed? (Assuming, if required _ the suggested correction(s) are made in the program).


Tuesday, 19 April 2016

CLASS-XI ASSIGNMENT-2 DATA REPRESENTATION



CHAPTER-3

1. Convert binary number 10112  to decimal number.
2. Convert binary number 1001012  to decimal number.
3.Convert octal number 34578  to decimal number.
4.Convert octal number 4258  to decimal number.
5.Convert hexadecimal number FACE16  to decimal number.
6.Convert hexadecimal number BABA16  to decimal number.


Tuesday, 12 April 2016

CLASS-XI ASSIGNMENT-1



CHAPTER-3


1. Converting decimal number 165310  to hexadecimal
2. Converting decimal number 26.5310  to binary
3. Converting decimal number 165.45310  to octal
4. Converting decimal number 567.98710  to binary
5. Converting decimal number 543.876510  to hexadecimal
6. Converting decimal number 16.4565310  to octal
7. Converting decimal number 983210  to binary
8. What is number system?
9. What is MSB and LSB?
10. What is the base of binary, octal, decimal and hexadecimal numbers?