πŸ“Š C++
Q. What is the output of the following C++ code?
Code:
#include <iostream>
using namespace std;
int sum(int x, int y);
int main()
{
  int i = 1, j = 2;
  cout << sum(i, j) << endl;
  return 0;
}
int sum(int x, int y )
{
  int s = x + y;
  x = 2;
  return x + y;
}
  • (A) 3
  • (B) 4
  • (C) Compilation error
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) 4

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
209
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
92%
Success Rate