Q.1

Which of the following statements is correct?

  1. Once the variable and the reference are linked they are tied together.
  2. Once the reference of a variable is declared another reference of that variable is not allowed.
  • Only 1 is correct.
  • Only 2 is correct.
  • Both 1 and 2 are correct.
  • Both 1 and 2 are incorrect.
Q.2

Which of the following statement is correct about the program given below?

#include<iostream.h> 
struct Bix
{
    short n;
};
int main()
{
    Bix b;
    Bix& rb = b;
    b.n =    cout << b.n << " " << rb.n << " ";
    rb.n =    cout << b.n << " " << rb.n;
    return
}
  • It will result in a compile time error.
  • The program will print the output 5 5 5 8.
  • The program will print the output 5 5 8 8.
  • The program will print the output 5 5 5 5.
Q.3

Which of the following statement is correct?

  • Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  • A reference is indicated by using && operator.
  • Once a reference variable has been defined to refer to a particular variable it cannot refer to any other variable.
  • A reference can be declared beforehand and initialized later.
Q.4

Which of the following statements is correct?

  1. Change a reference changes the referent.
  2. We can create an array of references.
  • Only 1 is correct.
  • Only 2 is correct.
  • Both 1 and 2 are correct.
  • Both 1 and 2 are incorrect.
Q.5

Which of the following statement is correct about the references?

  • A reference must always be initialized within functions.
  • A reference must always be initialized outside all functions.
  • A reference must always be initialized.
  • Both A and C.
Q.6

Which of the following statement is correct about the program given below?

#include<iostream.h> 
int main()
{
    int x =    int &y = x;
    x++;
    cout<< x << " " << y++;
    return
}
  • The program will print the output 11 12.
  • The program will print the output 12 11.
  • The program will print the output 12 13.
  • It will result in a compile time error.
Q.7

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
    void SetValue(int &xx, int &yy)
    {
        x =  xx ++;
        y =  yy; 
        Display();
    }
    void Display()
    {
        cout<< x << " " << y;
    }
};
int main()
{
    int x =    int &y = x;
    IndiaBix objBix;
    objBix.SetValue(x , y);
    return
}
  • The program will print the output 10 10.
  • The program will print the output 10 11.
  • The program will print the output 11 11.
  • The program will print the output 11 10.
  • It will result in a compile time error.
Q.8

What will be the output of the following program?

#include<iostream.h> 
class BixTest
{
    public:
    BixTest(int &x, int &y)
    {
        x++;
        y++;
    } 
};
int main()
{
    int a =b =    BixTest objBT(a, b); 
    cout<< a << " " << b; 
    return
}
  • 10 20
  • 11 21
  • Garbage Garbage
  • It will result in a compile time error.
Q.9

What will be the output of the program given below?

#include<iostream.h> 
class BixBase
{
    int x;
    public:
    BixBase(int xx =    {
        x = xx; 
    }
    void Display()
    {
        cout<< x ;
    }
};
class BixDerived : public BixBase
{
    int y; 
    public:
    BixDerived(int yy =    {
        y = yy;
    }
    void Display()
    {
        cout<< y ;
    }
};
int main()
{
    BixBase objBase(10); 
    BixBase &objRef = objBase;

    BixDerived objDev(20); 
    objRef = objDev;

    objDev.Display(); 
    return
}
  • 0
  • 10
  • 20
  • Garbage-value
  • It will result in a compile-time/run-time error.
Q.10

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
    IndiaBix(int xx =int yy =    {
        x = xx; 
        y = yy;
    }
    void Display()
    {
        cout<< x << " " << y;
    }
    IndiaBix operator +(IndiaBix z)
    {
        IndiaBix objTemp;
        objTemp.x = x + z.x;
        objTemp.y = y + z.y;
        return objTemp; 
    }
};
int main()
{
    IndiaBix objBix1(80); 
    IndiaBix objBix2(20); 
    IndiaBix objSum; 
    IndiaBix &objRef = objSum; 
    objRef = objBix1 + objBix
    objRef.Display(); 
    return
}
  • It will result in a runtime error.
  • It will result in a compile time error.
  • The program will print the output 9 4.
  • The program will print the output 100 100.
Q.11

Which of the following statements is correct?

  1. We can return a global variable by reference.
  2. We cannot return a local variable by reference.
  • Only 1 is correct.
  • Only 2 is correct.
  • Both 1 and 2 are correct.
  • Both 1 and 2 are incorrect.
Q.12

What will be the output of the following program?

#include <iostream.h> 
enum xyz 
{
    a, b, c
}; 
int main()
{
    int x = a, y = b, z = c; 
    int &p = x, &q = y, &r = z; 
    p = z; 
    p = ++q;
    q = ++p;
    z = ++q + p++; 
    cout<< p << " " << q << " " << z;
    return
}
  • 2 3 6
  • 4 4 7
  • 4 5 8
  • 3 4 6
Q.13

Which of the following statements is correct?

  1. A reference is not a constant pointer.
  2. A referenced is automatically de-referenced.
  • Only 1 is correct.
  • Only 2 is correct.
  • Both 1 and 2 are correct.
  • Both 1 and 2 are incorrect.
Q.14

Which of the following statement is correct about the program given below?

#include<iostream.h> 
int main()
{
    int x =    int &y = x;
    x =    y =    cout<< x << " " << --y;
    return
}
  • The program will print the output 25 49.
  • It will result in a compile time error.
  • The program will print the output 50 50.
  • The program will print the output 49 49.
Q.15

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
    IndiaBix(int &xx, int &yy)
    {
        x = xx;
        y = yy;
        Display();
    }
    void Display()
    {
        cout<< x << " " << y;
    }
};
int main()
{
    int x1 =
    int &p = x    int y1 =
    int &q = y
    IndiaBix objBix(p, q); 
    return
}
  • It will result in a compile time error.
  • The program will print the output 10 20.
  • The program will print two garbage values.
  • The program will print the address of variable x1 and y1.
Q.16

Reference is like a _____.

  • Pointer
  • Structure
  • Macro
  • Enum
Q.17

Which of the following statement is correct?

  • A reference is a constant pointer.
  • A reference is not a constant pointer.
  • An array of references is acceptable.
  • It is possible to create a reference to a reference.
Q.18

Which of the following statement is correct about the program given below?

#include<iostream.h> 
int BixFunction(int m)
{
    m *= m;
    return((10)*(m /= m)); 
}
int main()
{
    int c =*d = &c, e;
    int &z = e;
    e = BixFunction(c-- % 3 ? ++*d :(*d *= *d));
    z = z + e /    cout<< c << " " << e;
    return}
  • It will result in a compile time error.
  • The program will print the output 64 9.
  • The program will print the output 64 10.
  • The program will print the output 64 11.
Q.19

Which of the following statements is correct?

  1. An array of references is acceptable.
  2. We can also create a reference to a reference.
  • Only 1 is correct.
  • Only 2 is correct.
  • Both 1 and 2 are correct.
  • Both 1 and 2 are incorrect.
Q.20

Which of the following statement is correct about the program given below?

#include<iostream.h> 
enum bix
{
    a=b, c
};
int main()
{
    int x = c;
    int &y = x;
    int &z = x;
    y = b;
    cout<< z--;
    return
}
  • It will result in a compile time error.
  • The program will print the output 1.
  • The program will print the output 2.
  • The program will print the output 3.
0 h : 0 m : 1 s