logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References Comments

  • Question
  • Which of the following statement is correct about the program given below?
    #include<iostream.h> 
    int main()
    {
        int arr[] = {1, 2 ,3, 4, 5}; 
        int &zarr = arr;
        for(int i = 0; i <= 4; i++)
        {
            arr[i] += arr[i];
        }
        for(i = 0; i <= 4; i++)
            cout<< zarr[i]; 
        return 0; 
    }


  • Options
  • A. The program will print the output 1 2 3 4 5.
  • B. The program will print the output 2 4 6 8 10.
  • C. The program will print the output 1 1 1 1 1.
  • D. It will result in a compile time error.

  • Correct Answer
  • It will result in a compile time error. 


  • References problems


    Search Results


    • 1. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
          void SetValue(int &a, int &b)
          {
              a = 100;
              x = a;
              y = b;
              Display();
          }
          void Display()
          {
              cout<< x << " " << y; 
          }
      };
      int main()
      {
          int x = 10;
          CuriousTab objCuriousTab;
          objCuriousTab.SetValue(x, x);
          return 0;
      }

    • Options
    • A. The program will print the output 100 10.
    • B. The program will print the output 100 100.
    • C. The program will print the output 100 garbage.
    • D. The program will print two garbage values.
    • E. It will result in a compile time error.
    • Discuss
    • 2. Which of the following statement is correct about the program given below?
      #include<iostream> 
      enum curioustab
      {
          a=1, b, c
      };
      int main()
      {
          int x = c;
          int &y = x;
          int &z = x;
          y = b;
          std::cout<< z--;
          return 0; 
      }

    • Options
    • A. It will result in a compile time error.
    • B. The program will print the output 1.
    • C. The program will print the output 2.
    • D. The program will print the output 3.
    • Discuss
    • 3. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
          CuriousTab(int &xx, int &yy)
          {
              x = xx;
              y = yy;
              Display();
          }
          void Display()
          {
              cout<< x << " " << y;
          }
      };
      int main()
      {
          int x1 = 10; 
          int &p = x1;
          int y1 = 20; 
          int &q = y1; 
          CuriousTab objCuriousTab(p, q); 
          return 0; 
      }

    • Options
    • A. It will result in a compile time error.
    • B. The program will print the output 10 20.
    • C. The program will print two garbage values.
    • D. The program will print the address of variable x1 and y1.
    • Discuss
    • 4. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int i, j; 
      class CuriousTab
      {
          public:
          CuriousTab(int x = 0, int y = 0)
          {
              i = x; 
              j = x; 
              Display();
          }
          void Display()
          {
              cout<< j <<" ";
          } 
      }; 
      int main()
      {
          CuriousTab objCuriousTab(10, 20); 
          int &s = i; 
          int &z = j; 
          i++;
          cout<< s-- << " " << ++z; 
          return 0; 
      }

    • Options
    • A. The program will print the output 0 11 21.
    • B. The program will print the output 10 11 11.
    • C. The program will print the output 10 11 21.
    • D. The program will print the output 10 11 12.
    • E. It will result in a compile time error.
    • Discuss
    • 5. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int main()
      {
          int m = 2, n = 6;
          int &x = m;
          int &y = n;
          m = x++; 
          x = m++;
          n = y++;
          y = n++;
          cout<< m << " " << n; 
          return 0; 
      }

    • Options
    • A. The program will print output 2 6.
    • B. The program will print output 3 7.
    • C. The program will print output 4 8.
    • D. The program will print output 5 9.
    • E. The program will print output 6 10.
    • Discuss
    • 6. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
          void SetValue(int &xx, int &yy)
          {
              x =  xx ++;
              y =  yy; 
              Display();
          }
          void Display()
          {
              cout<< x << " " << y;
          }
      };
      int main()
      {
          int x = 10;
          int &y = x;
          CuriousTab objCuriousTab;
          objCuriousTab.SetValue(x , y);
          return 0; 
      }

    • Options
    • A. The program will print the output 10 10.
    • B. The program will print the output 10 11.
    • C. The program will print the output 11 11.
    • D. The program will print the output 11 10.
    • E. It will result in a compile time error.
    • Discuss
    • 7. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int main()
      {
          int x = 80; 
          int y& = x;
          x++;
          cout << x << " " << --y;
          return 0;
      }

    • Options
    • A. The program will print the output 80 80.
    • B. The program will print the output 81 80.
    • C. The program will print the output 81 81.
    • D. It will result in a compile time error.
    • Discuss
    • 8. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int a, b, c; 
          public:
          void SetValue(int x, int y ,int z)
          {
              a = x;
              b = y;
              c = z;
          } 
          void Display()
          {
              cout<< a << " " << b << " " << c;
          } 
      }; 
      int main()
      {
          CuriousTab objCuriousTab;
          int x  = 2;
          int &y = x;
          y = 5;
          objCuriousTab.SetValue(x, ++y, x + y);
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 5 6 10.
    • B. The program will print the output 6 6 10.
    • C. The program will print the output 6 6 12.
    • D. It will result in a compile time error.
    • Discuss
    • 9. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int main()
      {
          int x = 10, y = 20;
          int *ptr = &x;
          int &ref = y;
      
          *ptr++;
           ref++;    
      
          cout<< x << " " << y;
          return 0; 
      }

    • Options
    • A. The program will print the output 10 20.
    • B. The program will print the output 10 21.
    • C. The program will print the output 11 20.
    • D. The program will print the output 11 21.
    • E. It will result in a compile time error.
    • Discuss
    • 10. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTabTest
      {
          public:
          CuriousTabTest(int &x, int &y)
          {
              x++;
              y++;
          } 
      };
      int main()
      {
          int a = 10, b = 20;
          CuriousTabTest objBT(a, b); 
          cout<< a << " " << b; 
          return 0; 
      }

    • Options
    • A. 10 20
    • B. 11 21
    • C. Garbage Garbage
    • D. It will result in a compile time error.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment