Page 65 - C++
P. 65
SAMPLE QUESTION PAPER 2018-19
Marking Scheme
COMPUTER SCIENCE (Code: 083)
CLASS:-XII
Time:3 Hrs. M.M.:70
Q. No. Part Question Description Marks
1 (a) Write the type of C++ Operators (Arithmetic, Logical, and Relational 2
Operators) from the following:
(i) !(ii) !=(iii) &&(iv) %
Ans. (i) Logical (ii) Relational (iii)Logical (iv) Arithmetic
(1/2 Mark for each correct Operator Type)
(b) Observe the following program very carefully and write the name of those 1
header file(s), which are essentially needed to compile and execute
thefollowing program successfully:
void main()
{
char text[20], newText[20];
gets(text);
strcpy(newText,text);
for(int i=0;i<strlen(text);i++)
if(text[i]==’A’)
text[i]=text[i]+2;
puts(text);
}
Ans. stdio.h
string.h
(½ Mark for writing each correct header file)
NOTE: Any other header file to be ignored
(c) Rewrite the following C++ code after removing any/all Syntactical Error(s) (2)
with each correction underlined.
Note: Assume all required header files are already being included in the
program.
#define float PI 3.14
void main( )
{
float R=4.5,H=1.5;
A=2*PI*R*H + 2*PIpow(R,2);
cout<<‘Area=’<<A<<endl;
}
1