logo

CuriousTab

CuriousTab

References problems


  • 1. Which of the following statement is correct?

  • Options
  • A. A reference is a constant pointer.
  • B. A reference is not a constant pointer.
  • C. An array of references is acceptable.
  • D. It is possible to create a reference to a reference.
  • Discuss
  • 2. A reference is declared using the _____ symbol.

  • Options
  • A. &&
  • B. &
  • C. ||
  • D. !
  • Discuss
  • 3. Which of the following statements is correct?

    1. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
    2. A reference is not a constant pointer.

  • Options
  • A. Only 1 is correct.
  • B. Only 2 is correct.
  • C. Both 1 and 2 are correct.
  • D. Both 1 and 2 are incorrect.
  • Discuss
  • 4. Which of the following statements is correct?

    1. A reference is not a constant pointer.
    2. A referenced is automatically de-referenced.

  • Options
  • A. Only 1 is correct.
  • B. Only 2 is correct.
  • C. Both 1 and 2 are correct.
  • D. Both 1 and 2 are incorrect.
  • Discuss
  • 5. Which of the following statement is correct?

  • Options
  • A. An array of references is acceptable.
  • B. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  • C. An array of references is not acceptable.
  • D. Reference is like a structure.
  • Discuss
  • 6. Which of the following statements is correct?

    1. Pointer to a reference and reference to a pointer both are valid.
    2. When we use reference, we are actually referring to a referent.

  • Options
  • A. Only 1 is correct.
  • B. Only 2 is correct.
  • C. Both 1 and 2 are correct.
  • D. Both 1 and 2 are incorrect.
  • Discuss
  • 7. Which of the following statements is correct?

    1. Change a reference changes the referent.
    2. We can create an array of references.

  • Options
  • A. Only 1 is correct.
  • B. Only 2 is correct.
  • C. Both 1 and 2 are correct.
  • D. Both 1 and 2 are incorrect.
  • Discuss
  • 8. Which of the following statement is correct about the program given below?
    #include<iostream.h> 
    int CuriousTabFunction(int m)
    {
        m *= m;
        return((10)*(m /= m)); 
    }
    int main()
    {
        int c = 9, *d = &c, e;
        int &z = e;
        e = CuriousTabFunction(c-- % 3? ++*d :(*d *= *d));
        z = z + e / 10;
        cout<< c << " " << e;
        return 0;
    }

  • Options
  • A. It will result in a compile time error.
  • B. The program will print the output 64 9.
  • C. The program will print the output 64 10.
  • D. The program will print the output 64 11.
  • Discuss
  • 9. 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 0; 
    }

  • Options
  • A. 2 3 6
  • B. 4 4 7
  • C. 4 5 8
  • D. 3 4 6
  • Discuss
  • 10. Which of the following statement is correct about the program given below?
    #include<iostream.h> 
    int main()
    {
        int x = 10;
        int &y = x;
        x++;
        cout<< x << " " << y++;
        return 0; 
    }
    

  • Options
  • A. The program will print the output 11 12.
  • B. The program will print the output 12 11.
  • C. The program will print the output 12 13.
  • D. It will result in a compile time error.
  • Discuss

First 2 3 4 5