Technical Questions asked in Google

  1. What will be the output of following code fragment?
    a=60;
    b=70;
    i=j=10;
    if(a<100){
    if(b>50){
    ++i ;
    else
    ++j ;
    }}
    cout<< i+j;
    1. 21
    2. 19
    3. 20
    4. None of the above
    Answer: Option A.
amazon article
  1. What is the error in the code?"
    Char ch;
    Int vowels=0,others=0;
    Cin>> ch;
    While((ch>= ‘A’ && ch <+ ‘Z’) || (ch>=’a’ && ch <= ‘z’)){
    Switch(ch)
    {
    Case’a’:
    Case’A’:
    Case’e’:
    Case’E’:
    Case’i’:
    Case’i’:
    Case’o’:
    Case’O’:
    Case’u’:
    Case’U’: ++vowels;
    Break;
    Default: ++others;
    }}
    Cout<< vowels<< ‘\n’<< others;
    1. The while loop is an endless loop. Whatever value of ch has in the beginning, will remain the same, as ch is not updated within the loop.
    2. There is no need to declare 'a' and 'A' and hence all other vowels gain in switch as it is case insensitive.
    3. The switch statement’s two case constants are identical case 'i' and 'i' which is an error
    4. More than one is correct from above.
    Answer: Option D.
  2. Which of the following is not supported by Java?
    1. Operator overloading
    2. Multiple inheritances for classes
    3. None of these
    4. Both (a) and (b)
    Answer: Option D.
  3. Which of the following are included in relational integrity constraints in DBMS?
    1. Key constraints
    2. Domain constraints
    3. Referential integrity constraints
    4. All of these
    Answer: Option D.
  4. What is the output of the following program?
    #include
    int g =20;
    void func(int &x, int y)
    {
    x=x-y ; y=x*10 ;
    cout<< x<<’,’<< y<< ‘\n’ }
    void main()
    { int g=7 ;
    func(g,::g);
    cout<< g<< ‘,’ << :: g ;
    }
    1. -13,-130
      33,330
    2. -13,-130
      -13,20
    3. -13,20
      33,330
    4. None of these
    Answer: Option B.
Campus Placement ad
Rate Us
Views:9256