QuestionQ90

Using Operators and Decision Constructs

Given:

Question Image

What is the output?

  • A Hello Log 2:2
  • B Welcome Log 1:2
  • C Welcome Log 2:1
  • D Hello Log 1:2
Explanation

The post-increment expression x++ uses x’s original value, 1, and subsequently changes x to 2. The pre-increment expression ++y changes y to 2 before comparison. Therefore, 1 < 2 is true, printing Hello , followed by Log 2:2.

Community Discussion

No comments yet. Be the first to start the discussion!