Page 67 - C++
P. 67

S[I]=S[I+1];
                                           S[I+1]=WS;
                                    }
                                    for (I=1;I<Size;I+=2)
                                     if (S[I]>=’M’ && S[I]<=’U’)
                                           S[I]=’@’;
                             }
                             void main()
                             {
                               STRING Word=”CBSEEXAM2019”;
                               MIXNOW(Word);
                               cout<<Word<<endl;
                             }

                      Ans.  BCE@XEMA0291

                             (2 Marks for correct output)
                             OR
                             (½ Mark for each of two correct consecutive alphabets not exceeding 1½
                             marks )

                      (f)    Observe the following program and find out, which output(s) out of (i) to     (2)
                             (iv) willbe expected from the program? What will be the minimum and the
                             maximum value assigned to the variable Alter?
                             Note:  Assume all required header files are already being included in
                             the program.
                                    void main( )
                                    {
                                           randomize();
                                           int Ar[]={10,7}, N;
                                           int Alter=random(2) + 10 ;
                                           for (int C=0;C<2;C++)
                                           {
                                                   N=random(2) ;
                                                   cout<<Ar[N] +Alter<<”#”;
                                           }
                                    }
                                    (i) 21#20#                          (ii) 20#18#
                                        (iii) 20#17#                    (iv) 21#17#

                      Ans.  The output expected from the program is (iii)  20#17#
                             Minimum Value of Alter = 10
                             Maximum Value of Alter = 11

                             (1 Mark for writing correct option (iii))
                             ( ½ Mark for writing correct Minimum Value of Alter)
                             ( ½ Mark for writing correct Maximum Value of Alter)




                                                              3
   62   63   64   65   66   67   68   69   70   71   72