MCQs > IT & Programming > C++ > Code will exhibit undefined behavio What will be the result of calling the h() function in the following C++ code? const char* upwork[] = { "Freelancers", "Projects", "Fixed", "Hourly" } const char* f(inti) { return upwork[i]; } void g(string s){} void h() { const string& r = f(0); g(f(1)); string s = f(2); cout<< "f(3): " << f(3) << " s: " << s << " r: " << r << '\n'; }

C++ MCQs

Code will exhibit undefined behavio

What will be the result of calling the h() function in the following C++ code? const char* upwork[] = { "Freelancers", "Projects", "Fixed", "Hourly" } const char* f(inti) { return upwork[i]; } void g(string s){} void h() { const string& r = f(0); g(f(1)); string s = f(2); cout<< "f(3): " << f(3) << " s: " << s << " r: " << r << '\n'; }

Answer

Correct Answer: f(3): Hourly s: Fixed r: Freelancers

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it