CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran
CBSE CLASS XII
1. (a) Logical Error.
Error occurred due to incorrect logic applied by the programmer.
Syntax Error.
Error occurred due to not following the proper grammar/syntax of the language
OR
Error occurred due to violating rules of the programming language
Example:
//Program to find area and perimeter of rectangle
void main()
{
int A,B,AR,P;
A=10;
B=20;
AR=2*(A*B); //Logical Error – Wrong Formula
P=2*(A+B);
cout<<A<<P>>endl; //Syntax Error – Use of >> with cout
}
(b) string.h
stdio.h
(c) #include<iostream.h>
const int Size =5;
void main( )
{
int Array[Size]={50,40,30,20,10};
for(int Ctr=0;Ctr<Size;Ctr++)
cout<<Array[Ctr];
}
(d) 2 @ 4 @ 8 @
4 # 8 # 16 # 20 #
(e) 10, 15, 20, 25, 30,
10, 15, 20,
Number=30
(f) (ii) 34
2. (a) Base Class Access Specifier Derived Class
Protected Private Private
Protected Protected
Public Protected
Private Private Not Accessible
Protected Not Accessible
Public Not Accessible
(b) (i) Function 1: Constructor/ Default Constructor
Function 2: Destructor
(ii) Function 1 is executed or invoked automatically when an object of
class Science is created.
Function 2 is invoked automatically when the scope of an object of
class Science comes to an end.
OR
Example:
{
Science s1;//Constructor is invoked
} // the destructor is invoked
Paper By Mr. Ravi Kiran
Email Id : [email protected] |