C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
Which of the following is the correct syntax to declare a variable in C#?
Which keyword is used to create a class in C#?
Which namespace is required to use Console.WriteLine() in C#?
Which of the following is NOT a valid C# variable name?
What will be the output of the following code? string s = "Hello"; s = s + " World"; Console.WriteLine(s);
Which of the following is a value type in C#?
What is the default access modifier for a class member in C#?
Which of the following correctly declares a variable that can hold null?
What will be the output of: Console.WriteLine();
Which of the following is a reference type in C#?
What is the correct syntax for a multi-line comment in C#?
Which keyword is used to create a constant variable in C# that cannot be modified after initialization?
What will be the output of: int x = 10; int y = 20; int z = x > y ? x : y; Console.WriteLine(z);
What is the output of: decimal d = 10.5m; int x = (int)d; Console.WriteLine(x);
In C#, which keyword is used to create a constant variable that cannot be modified after initialization?
What is the default access modifier for a class member in C# if not specified?
Which namespace must be included to use LINQ in C#?
In C#, what is the correct syntax to declare a nullable integer?
What will be printed when the following code executes? string str = "Hello"; str = str + " World"; Console.WriteLine(str.Length);
In C#, which keyword is used to declare a variable that cannot be changed after initialization?