11th Standard Syllabus & Materials
11th Standard
TN 11th Tamil இயற்கை வேளாண்மை,சுற்றுச்சூழல் -செய்யுள் - மனோன்மணீயம் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil என்னுயிர் என்பேன் -துணைப்பாடம் - இசைத்தமிழர் இருவர் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மொழி கலை -செய்யுள் - ஒவ்வொரு புல்லையும் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - இலக்கணம் - பகுபத உறுப்புகள் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - துணைப்பாடம் - வாடிவாசல் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - செய்யுள் - குறுந்தொகை Important Questions And Answers Study Material - QB365 Set A

Published on: 09/10/2019
Classes and Objects
Download Tamil Nadu 11th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
Identity the error.
class A
{
float X;
void init( )
{
A a1;
X 1.5 =1;
}};
void main ( )
{ A1.init( );}
2.
What is global class?
3.
What is access specifies?
4.
Define class.
5.
Write down the importance of destructor.
6.
What is the difference between the class and object in terms of oop?
7.
What are called members?
8.
Explain default constructor with an example.
9.
What is constructor?
10.
What is copy constructor?
11.
What are advantages of declaring constructors and destructor under public accessability?
12.
Rewrite the following program after removing the syntax errors if any and underline the errors:
#include
$include
class mystud
{ int studid =1001;
char name[20];
public
mystud( ) { }
void register ( )
{cin>>stdid; gets(name); }
void display ( )
{cout<<studid<<”: “<<name<<endl;}
}
int main( )
{ mystud MS;
register.MS( );
MS.display( );
}
13.
Write a C++ program example of creating global and local object
14.
Write the output of the following
#include < iostream >
#include < stdio.h >
using namespace std;
class P
{ public:
P ( )
{ cout<< "\nConstructor of class P "; }
~ P ( )
{ cout<< "\nDestructor of class P "; }
};
class Q
{ public:
Q( )
{ cout<< "\nConstructor of class Q "; }
~ Q( )
{ cout<< "\nDestructor of class Q "; }
};
class R
{ P obj1, obj2;
Q obj3;
public:
R ( )
{ cout<< "\nConstructor of class R ";}
~ R ( )
{ cout<< "\nDestructor of class R ";}
};
int main ( )
{
Ro R;
Q oq;
P op;
return 0;
}
15.
Explain nested class with example.
16.
Which of the following is used to create user defined datatype?
properties
operations
behaviour
class
17.
How many features commonly present in OOP language?
3
4
5
many
18.
Which of the following create a temporary instance?
Implicit call to the constructor
Explicit call to constructor
Implicit call to the destructor
Explicit call to the destructor
19.
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
Compile-time error
Domain error
Runtime error
Runtime exception
20.
Which of the following access specifier protects data from inadvertent modifications?
Private
Protected
Public
Global
21.
The variables declared inside the class are known as
data
inline
method
attributes
1.
Identify the error.
A a1;
X 1.5 = 1
A1. init ( ) ;}
2.
If a class definition is specified outside the body of all functions in a program then it is called global class.
3.
Public, private and protected are called access specifiers.
4.
Class is a way to bind the data and its associated functions together.
5.
The purpose of the destructor is to free the resources that the object may have acquired during its lifetime. A destructor function removes the memory of an object which was allocated by the constructor at the time of creating a object.
6.
| Class | Object |
|---|---|
| Class is a blueprint or template from which objects are created. | Object is an instance of class |
| Class is a group of similar objects. | Object is a real world entity such as pen, laptop, mobile, chair etc. |
| Class doesn't allocate memory when it is created. | Object allocates memory when it is created. |
7.
Class comprises of members. Members are classified as Data Members and Member functions. Data members are the data variables that represent the features or properties of a class. Member functions are the functions that perform specific tasks in a class.
8.
A constructor that accepts no parameter is called default constructor. For example in the class data program Data :: Data ( ) is the default constructor. Using this constructor. objects are created similar to the way the variables of other data types are created.
Example
int num; // ordinary variable declaration
Data d1; // object declaration
9.
The definition of a class only creates a new user defined data type. The instances of the class type should be instantiated (created and initialized). Instantiating object is done using constructor. An array or a structure in c++ can be initialized during the time of their declaration. The initialization of class type object at the time of declaration similar to a structure or an array is not possible because the class members have their associated access specifiers (private or protected or public). Therefore Classes include special member functions called as constructors. The constructor function initializes the class object.
10.
A constructor having a reference to an already existing object of its own class is called copy constructor. In other words Copy Constructor is a type of constructor which is used to create a copy of an already existing object of a class type. It is usually of the form simple (simple &), where simple is the class name. The compiler provides a default Copy Constructor to all the classes.
11.
When constructor and destructor are declared under public:
1. we can initialize the object while declaring it.
2. we can explicitly call the constructor.
3. we can overload constructors and therefore use multiple constructors to initialize objects automatically.
4. we can destroy the objects at the end of the class scope automatically (free unused memory).
However, some C++ compilers and Dev C++ do not allow to declare constructor and destructors under private section. So it is better to declare constructor and destructor under public section only.
12.
| Given Program | Corrected Program | Corrections |
| #include $include class mystud { int studid =1001; char name[20]; public m ystud( ) { } void register ( ) {cin>>stdid; gets(name); } void display ( ) {cout< int main( ) { mystud MS; register.MS( ); MS.display( ); } |
#include #include using namespace std: class mystud {int studid; public: void register () {cin>>studid;get(name); } {cout< int main() } {mystud MS; MS.register1(); MS.display(); } |
missing line space between class and class name space between int and studid, studid cannot be initialized here : (colon) is missing // register is a keyword-cannot be used as function name // data member is should be studid // wrong syntax & method name |
13.
#include< iostream >
#include< conio >
using namespace std
class add //Global class
{
int a,b;
public;
int sum;
void getdata( )
{
a=5;
b=10;
sum=a+b;
}
} a1; //global object
add a2; //global object
int main ( )
{
add a3; //Local object for a global class
a1.getdata( );
a2.getdata( );
a3.getdata( );
cout << a1.sum; //public data member accessed from outside the class
cout << a2.sum;
cout << a3.sum;
return 0;
}
Output:
151515
14.
Constructor of class P
Constructor of class Q
Constructor of class R
Destructor of class R
Destructor of class Q
Destructor of class P
15.
Nested class: When one class become the member of another class then it is called Nested class and the relationship is called containership.
Classes can be nested in two ways.
1. By defining a class within another class
2. By declaring an object of a class as a member to another class.
Defining a class with in another: When a class is declared with in another class, the inner class is called as Nested class (ie the inner class) and the outer class is known as Enclosing class. Nested class can be defined in private as well as in the public section of the Enclosing class.
C++ program to illustrate the nested class
#include < iostream >
using namespace std;
class enclose
{
private:
int x;
class nest
{
private:
int y;
public:
int z;
void prn ( )
{
y=3;z=2;
cout << "\n The product of'" << y << '*' << z << "=" << y*z << "\n";
}
}; //inner class definition over
nest n1;
public:
nest n2;
void square ( )
{
n2.prn ( ); //inner class member function is called by its object
x=2;
n2.z=4;
cout << "\n The product of " << n2.z << '*' << n2.
z << "=" << n2.z*n2.z << "\n";
cout << "\n The product of " << x << '*' << x << "=+ << x*x;
}
}; //outer class definition over
int main ( )
{
enclose e;
e.square ( ); // outer class member function is called
}
Output:
The product of 3*2=6
The product of 4*4=16
The product of 2*2=4
In the above program the inner class nest is defined inside the outer class enclose. nest is accessed by enclose by creating an objec of nest.
16.
(d)
class
17.
(b)
4
18.
(b)
Explicit call to constructor
19.
(a)
Compile-time error
20.
(a)
Private
21.
(c)
method
11th Standard Syllabus & Materials
11th Standard
TN 11th Tamil பீடு பெற நில் - செய்யுள் - காவடிச்சிந்து Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - உரைநடை - மலை இடப்பெயர்கள் : ஓர் ஆய்வு Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மாமழை போற்றுதும் - துணைப்பாடம் - யானை டாக்டர் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மாமழை போற்றுதும் - செய்யுள் - ஐங்குறுநூறு Important Questions And Answers Study Material - QB365 Set A
Tamilnadu Stateboard 11th Standard Subjects

Maths

Commerce

Economics

Biology

Business Maths and Statistics

Accountancy

Computer Science

Physics

Chemistry

Maths

Biology

Economics

Physics

Chemistry

History

Business Maths and Statistics

Computer Science

Accountancy

Computer Applications

History

Computer Technology

Commerce

Computer Applications

Computer Technology

Tamil

English

French
Tamilnadu Stateboard Standards