Home »
MCQs »
C# MCQs
What will be the output of the following C# code? | Question 7
38. What will be the output of the following C# code?
using System;
class Program {
static void Main(string[] args) {
int i = 2;
int j = 10 / 4;
if (i == j) {
Console.WriteLine("True");
} else {
Console.WriteLine("False");
}
}
}
- True
- False
- Error
- None
Answer: A) True
Explanation:
The statement int j = 10/4; The value of j will be 2 because of implicit type casting. Thus, the output will be "True".