C#

C#

Test your C# knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. Which of the following is the correct file extension for a C# source file?

    • A. .csharp
    • B. .cs
    • C. .c
    • D. .cpp
  2. Which method serves as the entry point of a C# program?

    • A. Start()
    • B. Run()
    • C. Main()
    • D. Begin()
  3. Which of the following is a value type in C#?

    • A. String
    • B. Array
    • C. int
    • D. Class
  4. Which keyword is used to handle exceptions in C#?

    • A. handle
    • B. exception
    • C. try
    • D. catch
  5. Which operator is used for string concatenation in C#?

    • A. +
    • B. &
    • C. concat()
    • D. join()
  6. Which keyword is used to define an interface in C#?

    • A. class
    • B. struct
    • C. interface
    • D. abstract
  7. Which collection in C# stores key-value pairs?

    • A. List
    • B. Dictionary
    • C. Queue
    • D. Stack
  8. What is the main purpose of delegates in C#?

    • A. Handle errors
    • B. Reference methods
    • C. Create classes
    • D. Define variables
  9. Which LINQ keyword is used to filter data?

    • A. select
    • B. where
    • C. group
    • D. orderby
  10. Which class is used for reading text files in C#?

    • A. FileWriter
    • B. StreamReader
    • C. FileReader
    • D. TextReader
  11. Which keyword is used in C# for asynchronous programming?

    • A. sync
    • B. wait
    • C. async/await
    • D. parallel
  12. Which principle in SOLID stands for 'Open-Closed Principle'?

    • A. Software entities should be open for extension but closed for modification
    • B. A class should have one reason to change
    • C. High-level modules should not depend on low-level modules
    • D. Depend on abstractions, not on concretions
  13. Which namespace is used for multithreading in C#?

    • A. System.IO
    • B. System.Threading
    • C. System.Linq
    • D. System.Net
  14. Which ORM is commonly used with C# for database operations?

    • A. Hibernate
    • B. Sequelize
    • C. Entity Framework
    • D. Dapper
  15. Which mechanism in C# allows examining metadata at runtime?

    • A. Reflection
    • B. Polymorphism
    • C. Generics
    • D. Serialization