Ask Question
3 February, 21:14

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

+5
Answers (1)
  1. 3 February, 21:42
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers