CBSE Class-12 Exam 2017 : Delhi Scheme Question Paper, Computer Science

CBSE Class-12 Exam 2017 : Delhi Scheme

Question Paper, Computer Science

CBSE Class-12 Exam 2017 :  Computer Science

SECTION – A
(Only for Candidates, who opted for C++)
1. (a) Write the type of C++ tokens (keywords and user defined identifiers) from the
following : 2
(i) For
(ii) delete
(iii) default
(iv) Value
(b) Anil typed the following C++ code and during compilation he found four errors as
follows : 1
(i) Function strlen should have a prototype
(ii) Undefined symbol cout
(iii) Undefined symbol endl
(iv) Function getchar should have a prototype
On asking his teacher told him to include necessary header files in the code. Write
the names of the header files, which Anil needs to include, for successful
compilation and execution of the following code :
void main()
{
char S[] = "Hello";
for(int i = 0; i<strlen(S); i++)
S[i] = S[i]+1;
cout<<S<<end1;
getchar();
}
(c) Rewrite the following C++ code after removing any/all syntactical errors with each
correction underlined. 2
Note : Assume all required header files are already being included in the program.
void main()
{
cout<<"Enter an integer”;
cin>>N;
switch(N%2)
case 0 cout<<"Even"; Break;
case 1 cout<<"Odd"; Break;
}
(d) Find and write the output of the following C++ program code : 2
Note : Assume all required header files are already included in the program.
#define Big(A,B) (A>B)?A+1:B+2
void main()
{
char W[] = "Exam";
int L=strlen(W);
for(int i=0; i<L–1; i++)
W[i] = Big(W[i],W[i+1]);
cout<<W<<end1;
}
(e) Find and write the output of the following C++ program code : 3
Note : Assume all required header files are already being included in the program.
void main()
{
int A[]={10,12,15,17,20,30};
for(int i = 0; i<6; i++)
{
if(A[i]%2==0)
A[i] /= 2;
else if(A[i]%3==0)
A[i] /= 3;
if(A[i]%5==0)
A[i] /=5;
}
for(i = 0; i<6; i++)
cout<<A[i]<<”#”;
}
(f) Look at the following C++ code and find the possible output(s) from the options
(i) to (iv) following it. Also, write the maximum values that can be assigned to each
of the variables R and C. 2
Note :
• Assume all the required header files are already being included in the code.
• The function random(n) generates an integer between 0 and n – 1.
void main()
{
randomize();
int R=random(3),C=random(4);
int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
for(int I=0; I<R; I++)
{
for(int J=0; J<C; J++)
cout<<MAT[I][J]<<" ";
cout<<end1;
}
}

Click Here to Download  

Courtesy: CBSE