Most Expected Questions for Computer Science Class XII(2)

download Most Expected Questions for Computer Science Class XII(2)

of 9

description

COMPUTER SCIENCE 12

Transcript of Most Expected Questions for Computer Science Class XII(2)

  • Most Expected Questions for Computer Science Class XII

    Q 1. (a) What is the difference between automatic type conversion and type casting? Also, give a

    suitable C++ code to illustrate both. 2

    (b) Which C++ header file(s) will be essentially required to be included to run/

    execute the following C++ code? 1 void main( ){

    int Eno=123, char Ename[ ]=Rehan Swamp;

    cout

  • }

    void main ( )

    {

    POINT P1={15, 25, 5}, P2={10, 30, 20};

    StepIn(P1);

    StepOut(P2,4);

    cout

  • for (int 1=1;I

  • e1se

    ARR [L] *=L;

    }

    void Show (int ARR [ ], int Size)

    {

    for (int L=0; L

  • (i) 50 # 51 # 52 # 53 # 54 # 55 # (ii) 52 # 53 # 54 # 55

    (iii) 53 # 54 # (iv) 51 # 52 # 53 # 54 # 55

    Q 3. (a) What is the difference between call by reference and call by value with respect to memory allocation ? Give a suitable example to illustrate using C++ code. 2

    (b) Observe the following C++ code and write the name(s) of the header file(s), which will be

    essentially required to run it in a C++ compiler : 1 void main()

    {

    char CH,STR[20];

    cin>>STR;

    CH=toupper(STR[0]);

    cout

  • (e) Obtain the output of the following C++ program, which will appear on the screen after its

    execution. 3

    Important Note :

    All the desired header files are already included in the code, which are required to run the code. class Game

    {

    int Level, Score;

    char Type;

    public:

    Game(char GType=P)

    {Level=1;Score=0;Type=GType;}

    void Play(int GS);

    void Change();

    void Show()

    {

    cout

  • (f) Read the following C++ code carefully and find out, which out of the given options (i) to (iv) are

    the expected correct output(s) of it. Also, write the maximum and minimum value that can be

    assigned to the variable Taker used in the code : 2 void main() {

    int GuessMe[4]={100,50,200,20};

    int Taker=random(2)+2;

    for (int Chance=0;Chance

  • Important Note :- All the desired header files are already included in the code, which are required to

    run the code. 2

    void main ( )

    {

    char *String=SARGAM; int *Ptr, A[ ]={1,5,7,9};

    Ptr=A;

    cout < < *Ptr

  • void Player: :Start (int SC)

    {

    Score+=SC;

    if (Score >= 100 )

    Level=3;

    else if (Score>=50 )

    Level=2;

    else

    Level=1;

    }

    (f) Read the following C++ code carefully and find out, which out of the given options (i) to (iv) are

    the expected correct output(s) of it. Also, write the maximum and minimum value that can be

    assigned to the variable Start used in the code : 2

    void main ( )

    {

    int Guess[4]={200,150,20 ,250};

    int Start=random (2 ) +2;

    for ( int C=Start ; C