πŸ“Š C++
Q. What is the output of the following C++ program?
Code:
#include <iostream>

using namespace std;

int main()
{
  int n1 = 10;
  float n2 = 10;
  cout << sizeof(n1 + n2);
 return 0;
}
  • (A) 2
  • (B) 4
  • (C) 6
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (B) 4

Explanation: In the above program, the integer is converted to a float. So the result of n1 and n2 is float. And it returns the size of the float.

Explanation by: Team MCQ Buddy
In the above program, the integer is converted to a float. So the result of n1 and n2 is float. And it returns the size of the float.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
288
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Team MCQ Buddy
Publisher
πŸ“ˆ
98%
Success Rate