Home / MCQ Bank / Computer
Computer Classes And Objects In C Plus Plus Difficulty: Medium

What will be the output of the following C++ code? #include <iostream> using namespace std; class base { int val1, val2; public: int get() { val1 = 100; val2 = 300; } friend float mean(base ob); }; float mean(base ob) { return float(ob.val1 + ob.val2) / 2; } int main() { base obj; obj.get(); cout << mean(obj); return 0; }

Select the correct option to test your answer:

More Computer Questions

What does the /\A anchor represent in a regular expression in Ruby? Find all the cities whose humidity is 89, Table Name weather What is the default access modifier for a class in Java if no access modifier is specified? What is the result of the expression 10 % 2 == 0 ? "Even" : "Odd" in C#? Which of the following HTML 4 attributes is not removed in HTML5?