Ask Question
17 August, 19:30

What will the following segment of code output? score = 95; if (score > 95) cout << "Congratulations!/n"; cout << "That's a high score!/n"; cout << "This is a test question!" << endl; Answers: That's a high score! This is a test question! Congratulations! That's a high score! This is a test question! This is a test question! Congratulations! That's a high score! None of these

+3
Answers (1)
  1. 17 August, 22:22
    0
    That's a high score!

    This is a test question!

    Explanation:

    The reason these two lines are printed and not the first one is simple. After the 'IF' condition has been stated, there is no use of parenthesis such as { and } to enclose the next lines. This means that only the first line after the 'IF' condition may be read or skipped depending on whether the condition (score>95) is met. Since the score is not larger than 95, and the 'IF' condition fails, the line 'Congratulations!' is not printed. The next two lines of the code are read as normal because they do not depend on the 'IF' condition.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What will the following segment of code output? score = 95; if (score > 95) cout ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers