iGET

C# Programming - MCQ Practice Questions

C# (.NET) MCQs — OOP, collections, LINQ & exception handling.

290 questions | 100% Free

Q.41Medium

What is the correct way to check if a string is null or empty in modern C#?

Q.42Medium

Which of the following statements about properties in C# is TRUE?

Q.43Easy

What is the output of: decimal d = 10.5m; int x = (int)d; Console.WriteLine(x);

Q.44Medium

What happens when you try to access an array element beyond its length in C#?

Q.45Medium

Which of the following demonstrates proper use of string interpolation in C# 6.0+?

Q.46Hard

What is the difference between 'struct' and 'class' in C# regarding memory allocation?

Q.47Medium

What will be the output of the following code? int x = 5; int y = ++x; Console.WriteLine(x + " " + y);

Q.48Hard

Which of the following correctly describes method overloading in C#?

Q.49Easy

In C#, which keyword is used to create a constant variable that cannot be modified after initialization?

Q.50Easy

What is the default access modifier for a class member in C# if not specified?

Q.51Easy

Which namespace must be included to use LINQ in C#?

Q.52Easy

In C#, what is the correct syntax to declare a nullable integer?

Q.53Easy

What will be printed when the following code executes? string str = "Hello"; str = str + " World"; Console.WriteLine(str.Length);

Q.54Medium

Which of the following correctly demonstrates the use of an out parameter in C#?

Q.55Medium

What is the output of: bool result = (5 > 3) && (10 < 8); Console.WriteLine(result);

Q.56Medium

Which collection type in C# automatically prevents duplicate values?

Q.57Medium

In C#, what is the difference between '==' and 'Equals()' when comparing strings?

Q.58Medium

What is the correct way to create a generic method in C#?

Q.59Medium

Which statement about anonymous functions in C# is TRUE?

Q.60Medium

What is the output of: var x = 5; Console.WriteLine(x.GetType().Name);