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 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.

  • 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 &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
    • 2. 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.
    • Discuss
    • 3. 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
    • 4. 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
    • 5. 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
    • 6. 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
    • 7. 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
    • 8. 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
    • 9. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int main()
      {
          int x = 0;
          int &y = x; y = 5; 
          while(x <= 5)
          {
              cout<< y++ << " ";
              x++;
          }
          cout<< x; 
          return 0; 
      }

    • Options
    • A. The program will print the output 5 6 7 8 9 10.
    • B. The program will print the output 5 6 7 8 9 10 7.
    • C. The program will print the output 5 7.
    • D. It will result in a compile time error.
    • 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 = 25;
          y = 50;
          cout<< x << " " << --y;
          return 0; 
      }

    • Options
    • A. The program will print the output 25 49.
    • B. It will result in a compile time error.
    • C. The program will print the output 50 50.
    • D. The program will print the output 49 49.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment