logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References See What Others Are Saying!
  • Question
  • 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.


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

  • Correct Answer
  • Only 1 is correct. 


  • More questions

    • 1. What will be the output of the following program?
      #include<iostream.h> 
      class Point
      {
          int x, y; 
          public:
          Point(int xx = 10, int yy = 20)
          {
              x = xx;
              y = yy; 
          }
          Point operator + (Point objPoint)
          {
              Point objTmp;
              objTmp.x = objPoint.x + this->x; 
              objTmp.y = objPoint.y + this->y;
              return objTmp;
          }
          void Display(void)
          {
              cout<< x << " " << y;
          }
      };
      int main()
      {
          Point objP1;
          Point objP2(1, 2);
          Point objP3 = objP1 + objP2;
          objP3.Display(); 
          return 0; 
      }

    • Options
    • A. 1 2
    • B. 10 20
    • C. 11 22
    • D. Garbage Garbage
    • E. The program will report compile time error.
    • Discuss
    • 2. Which of the following statement is correct about the program given below?
      #include<iostream.h>
      #include<string.h> 
      class CuriousTab
      {
          public:
          void GetData(char *s, int x, int y )
          {
              int i = 0;
              for (i = x-1; y>0; i++)
              {
                  cout<< s[i];
                  y--; 
              } 
          }
      }; 
      int main()
      {
          CuriousTab objCuriousTab;
          objCuriousTab.GetData((char*)"Welcome!", 1, 3);
          return 0; 
      }

    • Options
    • A. The program will print the output me!.
    • B. The program will print the output Wel.
    • C. The program will print the output !em.
    • D. The program will print the output Welcome!.
    • E. The program will result in a compile time error.
    • Discuss
    • 3. 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
    • 4. What will be the output of the following program?
      #include<iostream.h> 
      class Base
      {
          public:
          int S, A, M; 
          Base(int x, int y)
          {
              S = y - y;
              A = x + x; 
              M = x * x;
          }
          Base(int, int y = 'A', int z = 'B')
          {
              S = y;
              A = y + 1 - 1; 
              M = z - 1;
          }
          void Display(void)
          {
              cout<< S << " " << A << " " << M << endl;
          }
      };
      class Derived : public Base
      {
          int x, y, z; 
          public:
          Derived(int xx = 65, int yy = 66, int zz = 67): Base(x)
          {
              x = xx; 
              y = yy;
              z = zz;
          }
          void Display(int n)
          {
              if(n)
                  Base::Display(); 
              else
                  cout<< x << " " << y << " " << z << endl; 
          }
      };
      int main()
      {
          Derived objDev; 
          objDev.Display(-1); 
          return 0;
      }

    • Options
    • A. 65 65 65
    • B. 65 66 67
    • C. A A A
    • D. A B C
    • E. The program will report compile time error.
    • Discuss
    • 5. What will be the output of the following program?
      #include<iostream.h>
      int CuriousTabFunction(int a, int b = 3, int c = 3)
      {
          cout<< ++a * ++b * --c ; 
          return 0;
      }
      int main()
      {
          CuriousTabFunction(5, 0, 0); 
          return 0;
      }

    • Options
    • A. 8
    • B. 6
    • C. -6
    • D. -8
    • Discuss
    • 6. Which of the following statement is correct?

    • Options
    • A. Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument.
    • B. Overloaded function must have default arguments.
    • C. Overloaded function must have default arguments starting from the left of argument list.
    • D. A function can be overloaded more than once.
    • Discuss
    • 7. What does a class hierarchy depict?

    • Options
    • A. It shows the relationships between the classes in the form of an organization chart.
    • B. It describes "has a" relationships.
    • C. It describes "kind of" relationships.
    • D. It shows the same relationship as a family tree.
    • Discuss
    • 8. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x; 
          float y; 
          public:
          void Function()
          {
              x = 4; 
              y = 2.50; delete this;
          }
          void Display()
          {
              cout<< x << " " << y;
          } 
      }; 
      int main()
      {
          CuriousTab *pCuriousTab = new CuriousTab();
          pCuriousTab->Function(); 
          pCuriousTab->Function(); 
          pCuriousTab->Display(); 
          return 0; 
      }

    • Options
    • A. The program will print the output 4 2.5.
    • B. The program will print the output 4.
    • C. The program will report runtime error.
    • D. The program will report compile time error.
    • Discuss
    • 9. What will be the output of the following program?
      #include<iostream.h>
      #include<string.h> 
      class CuriousTab
      {
          char str[50]; 
          char tmp[50]; 
          public:
          CuriousTab(char *s)
          {
              strcpy(str, s);
          }
          int CuriousTabFunction()
          {
              int i = 0, j = 0; 
              while(*(str + i))
              {
                  if(*(str + i++) == ' ')
                      *(tmp + j++) = *(str + i);
              }
              *(tmp + j) = 0; 
              return strlen(tmp); 
          }
      };
      int main()
      {
          char txt[] = "Welcome to CuriousTab.com!";
          CuriousTab objCuriousTab(txt); 
          cout<< objCuriousTab.CuriousTabFunction();
          return 0;
      }

    • Options
    • A. 1
    • B. 2
    • C. 24
    • D. 25
    • Discuss
    • 10. What will be the output of the following program?
      #include<iostream.h>
      #include<string.h> 
      class CuriousTab
      {
          char txtMsg[50]; 
          public:
          CuriousTab(char *str = NULL)
          {
          if(str != NULL)
             strcpy(txtMsg, str);
          }
          int CuriousTabFunction(char ch);
      };
      int CuriousTab::CuriousTabFunction(char ch)
      {
          static int i = 0;
          if(txtMsg[i++] == ch)
              return strlen((txtMsg + i)) - i;
          else
              return CuriousTabFunction(ch);
      }
      int main()
      {
          CuriousTab objCuriousTab("Welcome to CuriousTab.com!");
          cout<< objCuriousTab.CuriousTabFunction('t');
          return 0;
      }

    • Options
    • A. 6
    • B. 8
    • C. 9
    • D. 15
    • E. 16
    • Discuss


    Comments

    There are no comments.

Enter a new Comment