QuestionQ155

Using Operators and Decision Constructs

Given the following:

Question Image

What is the output?

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

The post-increment expression x++ evaluates to 1 and leaves x as 2, while the pre-increment expression ++y increments y to 1 before evaluation. Since the compared values are equal, the if branch prints Hello , followed by Log 2:1.

Community Discussion

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