1. Which keyword is used to define a class in C#?
a) struct
b) class
c) define
d) object
2. Which of the following is the correct syntax to declare a variable in C#?
a) int x = 10;
b) x = int 10;
c) declare int x = 10;
d) int: x = 10;
3. Which access modifier makes a member accessible only within its own class?
a) public
b) private
c) protected
d) internal
4. Which of these is the correct entry point of a C# console application?
a) Main()
b) Start()
c) Init()
d) Run()
5. What does the static keyword mean in C#?
a) The method belongs to an instance
b) The method is abstract
c) The method belongs to the class
d) The method is dynamic
6. What is the default value of a bool in C#?
a) true
b) false
c) null
d) 0
7. Which type is used for storing a single Unicode character in C#?
a) string
b) char
c) byte
d) Character
8. What is boxing in C#?
a) Converting a string to an object
b) Converting a value type to an object type
c) Converting an object to a value type
d) Wrapping a class inside a struct
9. Which namespace contains basic classes like Console and Math?
a) System.IO
b) System
c) Microsoft
d) Utilities
10. Which loop is guaranteed to execute at least once?
a) for loop
b) foreach loop
c) while loop
d) do-while loop
11. Which keyword is used for exception handling in C#?
a) try-catch
b) catch-finally
c) throw-catch
d) error-catch
12. What is the file extension for a C# source code file?
a) .cpp
b) .java
c) .cs
d) .csharp
Sign in to your account