×

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 6

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

using System;

namespace MyApplication {
  class Program {
    static void Main(string[] args) {
      int a = 10, b = 20;
      Console.WriteLine("{0}+{1}", a, b);
    }
  }
}
  1. 20
  2. 30
  3. 10+20
  4. 10+10

Answer: C) 10+20

Explanation:

In the statement, Console.WriteLine("{0}+{1}", a, b); - {0} is the placeholder for variable a and {1} is the placeholder for variable b, {0}+{1} will not perform any operation, values of a and b will be printed at the place of {0} and {1}. Thus, the output will be 10+20.

Comments and Discussions!

Load comments ↻






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