πŸ“Š C++
Q. What will happen when we use void in argument passing?
  • (A) Maybe or may not be return any value to its caller
  • (B) It will not return value to its caller
  • (C) It will return value to its caller
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (B) It will not return value to its caller
πŸ“Š C++
Q. What is the output of this program?
Code:
#include 
    using namespace std;
    int add(int p, int q);
    int main()
    {
        int n = 15, m = 16;
        cout << add(n, m) << endl;
        return 0;
    }
    int add(int p, int q )
    {
        int sum = p + q;
        p = 20;
        return p + q;
    }
  • (A) 36
  • (B) 15
  • (C) 16
  • (D) 20
πŸ’¬ Discuss
βœ… Correct Answer: (D) 20
πŸ“Š C++
Q. What is the output of this program?
Code:
#include 
    using namespace std;
    void square (int *p)
    {
	*p = (*p + 1) * (*p);
    }
    int main ( )
    {
	int n = 11;
        square(&n);
        cout << n; 
        return 0;
    }
  • (A) 11
  • (B) 123
  • (C) 321
  • (D) 132
πŸ’¬ Discuss
βœ… Correct Answer: (D) 132
πŸ“Š C++
Q. What is the new value of P?
Code:
#include 
    using namespace std;
    void function(int &p)
    {
        p = 15;
    }
    int main()
    {
         int p = 12;
         function(p);
         cout << "New value of P is " << p;
         return 0;
    }
  • (A) New value of P is 12
  • (B) Compilation Error
  • (C) New value of P is 15
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) New value of P is 15
πŸ“Š C++
Q. What is the output of this program?
Code:
#include 
    using namespace std;
    void copy (int& p, int& q, int& r)
    {
        p = p * 1;
        q = q * 2;
        r = r * 3;
    }
    int main ()
    {
        int m = 6, n = 3, o = 2;
        copy (m, n, o);
        cout << "M = " << m << ", N = " << n << ", O = " << o;
        return 0;
    }
  • (A) M = 6, N = 6, O = 6
  • (B) N = 6, O = 6, M = 6
  • (C) O = 6, M = 6
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) M = 6, N = 6, O = 6
πŸ“Š C++
Q. By default how the value are passed in c++?
  • (A) call by reference
  • (B) call by pointer
  • (C) call by value
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (C) call by value
πŸ“Š C++
Q. Which is used to keep the call by reference value as intact?
  • (A) const
  • (B) absolute
  • (C) static
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (A) const
πŸ“Š C++
Q. How many ways of passing a parameter are there in c++?
  • (A) 4
  • (B) 3
  • (C) 2
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) 3
πŸ“Š C++
Q. What is the use of the function “showbase”?
  • (A) Function Argument
  • (B) Indicate the base used
  • (C) Indicate the variable
  • (D) Indicate the base used & variable
πŸ’¬ Discuss
βœ… Correct Answer: (B) Indicate the base used
πŸ“Š C++
Q. What is the output of this program?
Code:
#include <iostream>
    using namespace std;
    int main()
    {
        unsigned long num = 56;
        cout << num << oct <<" " << num << endl;
        return 0;
    }
  • (A) 56
  • (B) 70
  • (C) 70 56
  • (D) 56 70
πŸ’¬ Discuss
βœ… Correct Answer: (D) 56 70