HOLIDAYS HOME WORK 2017-18 (Summer vacation)
Class XII
SUB:- Computer Science
1. Answer the following questions: -
a) Explain the impact of access identifier const over variables. Support answer with examples.
b) What are arithmetic operators in C++? Distinguish between unary and binary arithmetic operators?
c) Explain the transitive nature of inheritance? What do you understand by polymorphism?
d) What is the significance of private, protected and public specifiers in a class?
2. Differentiate between:
a) Call by value and call by reference
b) Actual and formal parameter
c) Fundamental data types and derived data types
d) Procedural programming and Object oriented programming
3. Define:
a) Advantages of OOP
b) Data encapsulation
c) Function prototyping
d) Iteration statements
4. Rewrite the following after removing the syntactical errors if any. Underline each correction.
a) #include [iostream.h]
Typedef char Text (80);
void main()
{ Text T = “Indian”;
int Count = strlen(T);
cout < T < ‘has’ < Count < ‘characters’ < endl;
}
b) #include <iostream.h
Class BOOK
{
Long Bid, Qty;
Public:
void Purchase() { cin> Bid> Qty;}
void Sale
{
coutsetw(5)< Bid<”Old :”< Qty < endl;
cout < “New :” < --Qty < endl;
}
};
void main()
{ Book B;
B. Purchase();
Sale();
B.Sale(); }
5. Find the output of the following program:
a) Void main()
{
randomize();
int CHANGER;
CHANGER = random(3);
char CITY[25] = {“DELHI”, “MUMBAI”, “KOLKATA”, “CHENNAI”};
for(int I =0; I <= CHANGER; I++)
{ for(int J =0; J<=I; J++)
cout < CITY[J];
cout < endl;
}
}
b) #include <iostream.h
#include <ctype.h
Void main()
{
char Mystring[] = “What@OUTPUT!”;
for(Int I =0; Mystring(I) =’\0’; I++)
{
If(!isalpha(Mystring(I))
Mystring[I] = ‘*’;
else if (isupper(Mystring[I]))
Mystring[I] = Mystring[I] + 1;
Else
Mystring[I] = Mystring[I +1];
}
cout < Mystring;
}
6. Write a C++ program that uses an area() function for the calculation of area of a triangle or a rectangle or a square. Suggest number of sides about the shape for which area is to be calculated.