Sunday 05th May 2024
REGISTRATION
Online Fashion Store

Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran

CBSE CLASS XII

Ans:

#include <iostream.h>
#include <stdio.h>
class MyStudent
{ int StudentId;
char Name[20];
public:
MyStudent( ) { }
void Register( )
{ cin>>StudentId;
gets(Name);
}
void Display( )
{ cout<<StudentId<<":"<<Name<<endl;
}
};
void main( )
{ MyStudent MS;
MS.Register( );
MS.Display( );
}

Q.1.e. Find the output of the following program:2
#include<iostream.h>
#include<ctype.h>
void Secret(char Msg[ ], int N);
void main( )
{ char SMS[ ]=”rEPorTmE”;
Secret(SMS,2);
cout<<SMS<<endl;
}
void Secret(char Msg[ ], int N)
{ for(int C=0;Msg[C]!=’\0’;C++)
if(C%2= =0)
Msg[C]=Msg[C]+N;
else if(isupper(Msg[C]))
Msg[C]=tolower(Msg[C]);
else
Msg[C]=Msg[C]-N;
}

Ans: teRmttoe

Q.1.f Study the following program and select the possible output from it:
#include<iostream.h>
#include<stdlib.h>
const int MAX=3;
void main( )
{ randomize( );
int Number;
Number=50+random(MAX);
for(int P=Number;P>=50;P--)
cout<<P<<”#”;
cout<<endl;
}
(i) 53#52#51#50# (ii) 50#51#52#
(iii) 50#51# (iv) 51#50#

Paper By Mr. Ravi Kiran
Email Id : [email protected]