CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran
CBSE CLASS XII
Ans:
(iv)51#50#
(Solution: MAX value is 3
That’s why random(MAX) can produce 0 or 1 or 2.
(random(N) will produce no. between 1 to n-1)
The Number value may be 50 or 51 or 52.
The P value starts from Number, upto 50,
each time decreases by 1.
So Possible outputs are as follows:
52#51#50#
51#50#
50#
As the output 51#50# is available in given
answers, so 51#50# is the answer.)
2008 Delhi
Q.1.b. Name the header files that shall be needed
for the following code: 1
void main( )
{ char String[ ] = “Peace”;
cout << setw(2)<<String;
}
Ans:
iomanip.h, iostream.h
Q.1. c. Rewrite the following program after
removing the syntactical error(s) if any.
Underline each correction.
#include<iostream.h>
void main( )
{ First = 10, Second = 20;
Jumpto(First;Second);
Jumpto(Second);
}
void Jumpto(int N1, int N2 = 20)
{ N1=N1+N2;
count<<N1>>N2;
}
Ans:
#include<iostream.h>
void Jumpto(int N1,int N2=20);
//Prototype missing
void main( )
{ int First = 10, Second = 20;
//Data type missing
Jumpto(First,Second);
//Comma to come instead of ;
Jumpto(Second);
}
void Jumpto(int N1, int N2)
{ N1=N1+N2;
cout<<N1<<N2;
//Output operator << required
}
Paper By Mr. Ravi Kiran
Email Id : [email protected] |