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#?
What will be the output of the following code snippet? int x = 5; int y = ++x; Console.WriteLine(x + " " + y);
Which of the following data types in C# is a value type?
What is the correct way to declare a constant variable in C#?
Which namespace is required to use Console.WriteLine() in C#?
What is the difference between '==' and 'Equals()' when comparing strings in C#?
Which of the following will correctly convert a string to an integer 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 correctly declares a nullable integer in C#?
What is the output of the following code? bool result = (5 > 3) && (2 < 1); Console.WriteLine(result);
Which keyword is used to prevent a class from being inherited in C#?
What will happen when you try to access an array index that is out of bounds in C#?
Consider the following code. What will be the output? int x = 10; int y = 20; int z = x++ + ++y; Console.WriteLine(x + " " + y + " " + z);
Which of the following statements about structs and classes in C# is TRUE?
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();