Computer Science Test 2

8 Questions | Total Attempts: 36

SettingsSettingsSettings
Please wait...
Computer Science Test 2

BOARD PATTERN QUESTIONS


Questions and Answers
  • 1. 
    Predict the output void main() { int Numbers[] = {2,4,8,10}; int *ptr = Numbers; for (int C = 0; C<3; C++) { cout<< *ptr << “@”; ptr++; } cout<<<endl; for(C = 0; C<4; C++) { (*ptr)*=2; --ptr; } for(C = 0; C<4; C++) cout<< Numbers [C]<< “#”; cout<<endl; }
  • 2. 
    An array Arr[15][20] is stored in the memory along the row with each element occupying 4 bytes. Find out the Base Address and address of the element Arr[3][2], if the element Arr[5][2] is stored at the address 1500.
    • A. 

      B.= 1176 , address of Arr[3][2].=1340

    • B. 

      B.= 1092  , address of Arr[3][2].=1340

    • C. 

      B.= 1093  , address of Arr[3][2].=1341

    • D. 

      B.= 1092  , address of Arr[3][2].=1341

  • 3. 
    Given below is a function in C++ to print the count of the word the as an independent word in a textfile STORY.TXT. Syntax errors were found during compilation. Identify the wrong statements void thewordCount(){ ifstream Fil(“STORY.TXT”);     //stm1 char String;                               //stm2 int C=0;                                      //stm3 while(!Fil.eof())                       // stm4 { fil>>String;                             //stm5 if(strcmpi(String,'the')==0)  //stm6 C=C+1;  }                                    // stm7 cout<<C; }
    • A. 

      Errors found in stm2,stm6

    • B. 

      Errors found in stm5,stm2,stm1

    • C. 

      Errors found in stm2, stm5, stm6

    • D. 

      Errors found in stm4 only

  • 4. 
    State de-morgan's law 1 and 2
    • A. 

      (X+Y)’=X’+Y’   and (X.Y)’=X'.Y'

    • B. 

      X+Y=X’.Y’   and (X.Y)=X’+Y’

    • C. 

      (X+Y)’=X.Y   and (X.Y)’=X+Y

    • D. 

      (X+Y)’=X’.Y’   and (X.Y)’=X’+Y’

  • 5. 
    Reduce the following Boolean expression using K-Map : 2 F(A, B, C, D) =π(5,6,7,8,9,12,13,14,15)
    • A. 

      F(A,B,C,D)=(A+C).(B’+D’).(B’+C’)

    • B. 

      F(A,B,C,D)=(A’+C).(B’+D’).(B+C)

    • C. 

      F(A,B,C,D)=(A’+C).(B’+D’).(B’+C’)

    • D. 

      F(A,B,C,D)=(A’+C).(B+D).(B’+C’)

  • 6. 
    Class trainer {char TNo [20],specializations [10]; int days; Protected:  float remuneration ;void assignrem(float); Public: Trainer( ); void TEntry( ); void TDisplay( ); }; class Learner {  char Regno[10],LName[20],Program[10]; protected: int Attendance, grade; public: learner( );  void TEntry( );  void TDisplay( ); }; class institute : public Learner, Public Trainer { char ICode[10],IName[20]; public:  Intitute ( ) ;  void IEntry ( ) ;  void IDisplay( ); }; Which type of inheritance is depicted by the above example? If class Institute was derived privately from class Learner and privately from class Trainer, then name the member function(s) that could be accessed through Objects of Class Institute
    • A. 

      Multiple Inheritance ,IEntry( ) , IDisplay( ),TEntry() ,TDisplay()

    • B. 

      Multiple Inheritance ,TEntry( ) , TDisplay( )

    • C. 

      Multiple Inheritance ,IEntry( ) , IDisplay( )

    • D. 

      Multi level Inheritance ,IEntry( ) , IDisplay( )

  • 7. 
    Class Maths {  char chapter [20];  int Marks;  public:  Maths ( )      // member Function 1  {  strcpy (chapter, ``geometery’’  Marks =10;  cout <<``chapter Intialised ”;  } Maths(char ch[10],int M)  //member Function 2 { strcpy(chapter,ch); Marks=M; } }; Which concept is illustrated using member function1 and member function 2 together Write the code to invoke the member function2
    • A. 

      Polymorphism. Maths M1("Polynomials",56)

    • B. 

      Polymorphism. Maths M1=Maths("Polynomials")

    • C. 

      Constructor Overloading. Maths M1("Polynomials",56)

    • D. 

      Constructor Overloading. Maths M1=("Polynomials",56)

  • 8. 
      Evaluate  15 3 2 + / 7 + 2 *
    • A. 

      5

    • B. 

      20

    • C. 

      21

    • D. 

      12

Back to Top Back to top