LogIn
I don't have account.
Question 1
Which of the following is true about C#?
1
C# is a statically-typed language
2
C# supports multiple inheritance directly
3
C# does not support garbage collection
4
C# does not support object-oriented programming
5
None of the above
Question 2
What is the default access modifier for a class in C#?
1
Internal
2
Private
3
public
4
Protected
Question 3
Which of the following is NOT a valid C# data type?
1
double
2
int
3
real
4
float
Question 4
What is the output of the following C# code?
int a = 5, b = 2;
double result = a / b;
Console.WriteLine(result);
1
2.0
2
2.5
3
2
4
Compilation error
Question 5
Which of the following statements about C# constructors is true?
1
A class can have only one constructor
2
A constructor must always have a return type
3
A constructor is automatically called when an object is created
4
A constructor can be called explicitly like a normal method
Question 6
What is the keyword used to inherit a class in C#?
1
implements
2
extends
3
inherits
4
: (colon)
Question 7
What is the difference between == and .Equals() in C#?
1
Both are the same and compare object references
2
== compares values, whereas .Equals() compares references
3
== compares references, whereas .Equals() compares values
4
None of the above
Question 8
What will be the output of the following code?
string s1 = "Hello";
string s2 = "Hello";
Console.WriteLine(s1 == s2);
Console.WriteLine(s1.Equals(s2));
1
True True
2
False True
3
True False
4
False False
Question 9
Which of the following statements about C# interfaces is true?
1
An interface cannot be inherited by another interface
2
An interface can provide default method implementation
3
An interface can have fields
4
An interface can contain constructors
Question 10
What is the purpose of the using statement in C#?
1
It imports namespaces
2
It defines scope for disposing objects
3
It handles exceptions
4
Both 1 and 2
Question 11
What is the output of the following C# code?
using System;

class Program
{
    static void Main()
    {
        int x = 10;
        object obj = x;
        int y = (int)obj;
        Console.Write(y);
    }
}
1
Compilation error
2
10
3
Runtime error
4
NullReferenceException
Question 12
What is the correct way to define a nullable integer in C#?
1
null int num;
2
int? num = null;
3
int num = nullable;
4
nullable<int> num = null;
Question 13
Which of the following is true about C# properties?
1
Properties can have different access modifiers for get and set
2
Properties are just variables with additional syntax
3
Properties must always have both get and set
4
Properties cannot be read-only
Question 14
Which keyword is used to prevent a class from being inherited?
1
private
2
static
3
sealed
4
abstract
Question 15
Which of the following correctly implements an interface in C#?
1
interface ITest { void Show(); }
class MyClass : ITest { public void Show() { Console.WriteLine("Hello"); } }
2
interface ITest { void Show(); }
class MyClass : ITest { void Show() { Console.WriteLine("Hello"); } }
3
interface ITest { void Show(); }
class MyClass : ITest { protected void Show() { Console.WriteLine("Hello"); } }
4
interface ITest { void Show(); }
class MyClass { public void Show() { Console.WriteLine("Hello"); } }
Question 16
What will be the output of the following LINQ query?
var numbers = new List<int> { 2, 3, 4, 5 };
var result = numbers.Where(n => n % 2 == 0);
Console.WriteLine(result.Count());
1
1
2
4
3
2
4
3
Question 17
What will happen if you call ToString() on a null object in C#?
1
It returns an empty string
2
It depends on the object's type
3
It throws a NullReferenceException
4
It returns "null"
Question 18
What is the output of the following C# code?
async Task<int> GetNumberAsync() { return 5; }
async Task Main()
{
    Task<int> task = GetNumberAsync();
    Console.WriteLine("Before await");
    int result = await task;
    Console.WriteLine($"Result: {result}");
}
1
Random execution order
2
Result: 5
Before await
3
Before await
Result: 5
4
Compilation error
Question 19
Which of the following statements about Dictionary in C# is true?
1
Keys in a dictionary must be unique
2
A dictionary allows only string keys
3
A dictionary stores elements in a sorted order
4
All of the above
Question 20
What type of inheritance is not supported in C#?
1
Multiple Inheritance
2
Single Inheritance
3
Hierarchical Inheritance
4
Multilevel Inheritance
Question 21
Which of the following is true about abstract classes in C#?
1
Abstract classes can be instantiated.
2
Abstract classes must have at least one abstract method.
3
Interfaces and abstract classes are the same.
4
An abstract class can have concrete methods.
Question 22
Which keyword prevents method overriding in C#?
1
private
2
sealed
3
final
4
abstract
Question 23
Which of the following best describes the .NET framework?
1
A hardware component
2
An operating system
3
A development platform
4
A database management system
Question 24
Which language influenced the development of C# the most?
1
C++
2
Java
3
Python
4
PHP
Question 25
What is the primary runtime used to execute C# programs?
1
Common Language Runtime (CLR)
2
Dynamic Link Library (DLL)
3
Common Runtime Interface (CRI)
4
Java Virtual Machine (JVM)
Question 26
If you receive a 'namespace not found' error, what is the likely cause?
1
Missing semicolon
2
Typo in the class name
3
Incorrect file extension
4
Missing 'using' directive
Question 27
What will be the output of the following code?
int a = 5, b = 2;
Console.WriteLine(a / b);
1
2.5
2
Error
3
3
4
2
Question 28
Which operator has the highest precedence in C#?
1
+
2
*
3
=
4
()
Question 29
What does the ?? operator do in C#?
1
Performs null-coalescing
2
Checks equality
3
Checks type
4
Performs bitwise OR
Question 30
What is the result of this expression: true || false && false?
1
Cannot determine
2
false
3
true
4
Error