Page 244 - C++
P. 244

CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
                                         (Sub Code: 083 Paper Code 91/1 Delhi)

                            {
                               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<<endl;
                            }


                   Ans  zyom

                           (½ Mark for writing each correct value)
                           Deduct ½ Mark for writing the values in different lines

                   (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]<<”#”;
                           }

                   Ans     1#6#1#17#2#3#


                           (½ Mark for writing each correct value)

                           Note: Deduct ½ Mark for not considering any/all # as separator and or
                           writing the values in different lines

                   (f)     Look at the following C++ code and find the possible output(s) from the options                                         2
                           (i) to (iv) following it. Also, write the maximum values that can be assigned to
                           each of the variables R and C.
                           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();


                                                     Page #3 of 28
   239   240   241   242   243   244   245   246   247   248   249