C# MCQ questions | C# Multiple Choice Questions and Answers:
C MCQs are a common type of question in exams. They test your knowledge of a topic and can be used to assess your understanding of the material.
MCQs can be difficult or easy, depending on how much information you are given. There are many different types of MCQs, and below we have listed some of the most common ones.
Brief Introduction to the C# Language
C is a programming language that originated in the early 1970s. It has been widely used in various domains, including system programming, network programming, and application development.
C is a programming language designed for general-purpose programming. It has features similar to those of other languages but also has some unique characteristics. One of the most important aspects of C is its portable nature.
This means that C can be used on many different platforms, making it a very versatile language. Additionally, C is relatively fast and efficient, making it an optimal choice for many applications.
C# MCQ Questions with Answers
1. The concept of encapsulation is also known as ___ or ___.
Answer: data hiding, information hiding
2. Instance variables are also known as ___.
Answer: member variable
3. The goal of object-oriented programming is ___.
Answer: data hiding
4. An object in C# is created using the ___ operator.
Answer: New
5. ___ has the same name as the class itself.
Answer: Constructors
6. A ___ constructor is called before any object of the class is created.
Answer: static
7. A ___ creates an object by copying variables from another object.
Answer: copy constructor
8. A ___ is the opposite of a constructor.
Answer: destructor
9. ___ variables are assigned when the class is loaded.
Answer: Static
10. ___ variables are assigned when an instance is created.
Answer: Instance
11. The ___ is used to distinguish between local and instance variables that have the same name.
Answer: This pointer
12. C# provides the ___ modifier to be used with data members to set the value of the member using a constructor method, which cannot be modified later.
Answer: read-only
13. C# provides a mechanism known as ___ that has the same capabilities as accessor methods.
Answer: properties
14. Indexers are ___ and are used to access ___, just like accessing elements in an array.
Answer: location indicators, class objects
15. The mechanism of designing or constructing one class from another is called ___.
Answer: inheritance
16. ___ parameters are used for passing parameters into methods by value.
Answer: Value
17. ___ are used in a method to receive the variable number of arguments when called.
Answer: Parameters arrays
18. ___ are used to pass results back from the method.
Answer: Output parameters
19. ___ are used to pass into methods by reference.
Answer: Reference parameters
20. Methods with the different parameters lists and different definitions are called ___.
Answer: method overloading
21. structs are ___ data types.
Answer: composite
22. What is the Nesting of methods?
Answer: The values of the actual parameters are assigned to the formal parameters at the time of invocation.
23. Unassigned enum members have a value that is ___ more than their predecessor.
Answer: one
24. ___ permits the same method name to be used for different operations in different derived classes.
Answer: Polymorphism
25. Subclasses don’t inherit a ___ member variable if the subclass declares a member variable using the same name.
Answer: superclass’s
26. Inheritance is ___ in nature.
Answer: transitive
27. The theory of ___ implies that you can control access to a class, method, or variable.
Answer: Encapsulation
28. The ___ classes are accessible within the same program assembly and are not accessible from outside the assembly.
Answer: Internal
29. The subclass constructor uses the keyword ___ to invoke the constructor method of the superclass.
Answer: base
30. What is method overriding?
Answer: new
31. To override a method without declaring it virtual, we need to use the ___ modifier to tell the compiler that the derived class method “hides” the base class method.
Answer: The process of defining a method in the subclass that has the same name, same arguments, and same return type as a method in the superclass is called method overriding.
32. The ___ class is a base class that simply acts as a base for others and is not useful on its own.
Answer: abstract
33. The ___ methods are implicit virtual methods and do not provide any implementation.
Answer: Abstract
34. A class that cannot be sub-classed is called a ___ class.
Answer: sealed
35. A ___ class cannot override sealed methods.
Answer: derived
36. The ___ polymorphism is implemented using overloaded methods and operators.
Answer: Operation
37. Inclusion polymorphism is achieved through the use of ___.
Answer: virtual functions
38. The___ is another form of inheritance relationship known as containership between two classes, A and B.
Answer: Containment Inheritance
39. A ___ inherits all of the member variables within its superclass that are accessible to that subclass.
Answer: subclass
40. ___ is a condition that is caused by a runtime error in the program.
Answer: Exception
41. Classes in C# cannot have more than one___ class.
Answer: super
42. An interface in C# is a ___ type.
Answer: reference
43. An interface can inherit ___ interfaces.
Answer: multiple
44. One of the reasons that C# does not support multiple inheritances is the problem of ___.
Answer: name collision
45. Interfaces are similar to ___ classes.
Answer: abstract
46. ___ means method acting for another method.
Answer: Delegate
47. A delegate declaration defines a class using the class ___as a base class.
Answer: System.Delegate
48. Delegate types are implicitly ___.
Answer: sealed
49. Delegates that hold and invoke multiple methods are called ___.
Answer: multicast delegates
50. An ___ is a delegate type class member that is used by the object or class to provide a notification to other objects that an event has occurred.
Answer: event
51. The ___ method returns a single character as int.
Answer: Read()
52. The ___ method returns a string containing a line of text.
Answer: WriteLine()
53. The ___ outputs one or more values to the screen without a newline character.
Answer: Write()
54. The ___ outputs one or more values to the screen but adds a newline character at the end of the output.
Answer: ReadLine()
55. Formatted output is produced using the overloaded ___ method.
Answer: WriteLine()
56. ___ is an index number in curly brackets that indicates which variables of the argument list are to be substituted.
Answer: Marker
57. The ___ and ___ characters are called placeholders.
Answer: zero, pound
58. The location of the decimal point in the output may be decided by placing a ___ character in the format string.
Answer: period (.)
59. The task of catching the exception object thrown by the error condition and then displaying an appropriate message for taking corrective actions is known as ___.
Answer: Exception Handling
60. In addition to the ‘catch’ block, the ___ block can have one or more statements that could generate an exception.
Answer: try
61. Select the windows application template, which appears in the ___ section when you choose Visual C# in the project type pane, to specify a template for a new project.
Answer: Templates
62. What is an event handler?
Answer: An event handler is a Visual C# method containing a code that is executed when an event occurs on a control.
63. The code for hiding the TextBox control at the start of the application is ___.
Answer: textBox1.Hide ()
64. To display the popup messages as part of the event handling mechanisms, the method used is ___.
Answer: MessageBox.Show(“Message String”)
65. How do you run the website1 web-based application?
Answer: Press the F5 key or the start debugging button of the toolbar, in Microsoft Visual Studio IDE.
66. Click the ___ tab that appears at the bottom to display the Design view of the Default .aspx page.
Answer: design
67. When we open the ___ view of the Default .aspx page, the toolbox containing controls such as Buttons and Labels appears automatically.
Answer: design
68. The ___ block can also have one or more statements that are necessary to process the exception.
Answer: catch
69. The point at which an exception is thrown is called the ___.
Answer: throw point
70. C# treats the multiple catch statements like cases in a ___ statement.
Answer: switch
71. All C# exceptions are derived from the class ___.
Answer: exception
72. A catch block, which will catch any exception is called a ___.
Answer: general catch handler
73. The ___ statement can be used to handle an exception that is not caught by any of the previous catch statements.
Answer: Finally
74. When creating your own exceptions, it is good coding practice to end the class name of the user-defined exception with the word ___.
Answer:‘Exception’
75. If an operation is___, then an exception will be thrown if overflow occurs.
Answer: checked
You may want to read Computer Fundamentals MCQs
Conclusion
Dot Net and C# are both competitive programming languages that can be used in interviews. By practicing MCQs with answers, you can improve your understanding of these languages and increase your chances of passing an interview.
Thanks for your visit to our blog if you like the post on C# MCQ questions, please share it on social media and also give your answers through the comment box.
Read More MCQs
- Mysql MCQ Questions
- Java MCQ Online Test
- Object-Oriented Programming
- Core Java Multiple Choice Questions