Ask Question
22 June, 23:55

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

+1
Answers (1)
  1. 23 June, 00:56
    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?
Get an answer to your question ✅ “What will the following segment of code output? score = 95; if (score > 95) cout ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers