×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What will be the output of the following C# code? | Question 10

44. What will be the output of the following C# code?

using System;

class Program {
  static void Main(string[] args) {
    int i = 100;

    do {
      Console.Write(i + " ");
      ++i;
    } while (i <= 50);
  }
}
  1. Error
  2. 100 101 102 ... Infinite
  3. 101
  4. 100

Answer: D) 100

Explanation:

The do-while loop is an exit control loop where the condition is checked after executing the loop body. In the above code, the condition is false still loop body will be executed first. Thus, the output will be 100.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.