C# MCQ questions | C# Multiple Choice Questions and Answers

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.

C# mcq questions

Brief About 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 ___.
[expand title="Show Answer"]Answer: data hiding, information hiding[/expand]

2. Instance variables are also known as ___.
[expand title="Show Answer"]Answer: member variable[/expand]

3. The goal of object-oriented programming is ___.
[expand title="Show Answer"]Answer: data hiding[/expand]

4. An object in C# is created using the ___ operator.
[expand title="Show Answer"]Answer: New[/expand]

5. ___ has the same name as the class itself.
[expand title="Show Answer"]Answer: Constructors[/expand]

6. A ___ constructor is called before any object of the class is created.
[expand title="Show Answer"]Answer: static[/expand]

7. A ___ creates an object by copying variables from another object.
[expand title="Show Answer"]Answer: copy constructor[/expand]

8. A ___ is the opposite of a constructor.
[expand title="Show Answer"]Answer: destructor[/expand]

9. ___ variables are assigned when the class is loaded.
[expand title="Show Answer"]Answer: Static[/expand]

10. ___ variables are assigned when an instance is created.
[expand title="Show Answer"]Answer: Instance[/expand]

11. The ___ is used to distinguish between local and instance variables that have the same name.
[expand title="Show Answer"]Answer: This pointer[/expand]

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.
[expand title="Show Answer"]Answer: read-only[/expand]

13. C# provides a mechanism known as ___ that has the same capabilities as accessor methods.
[expand title="Show Answer"]Answer: properties[/expand]

14. Indexers are ___ and are used to access ___, just like accessing elements in an array.
[expand title="Show Answer"]Answer: location indicators, class objects[/expand]

15. The mechanism of designing or constructing one class from another is called ___.
[expand title="Show Answer"]Answer: inheritance[/expand]

16. ___ parameters are used for passing parameters into methods by value.
[expand title="Show Answer"]Answer: Value[/expand]

17. ___ are used in a method to receive the variable number of arguments when called.
[expand title="Show Answer"]Answer: Parameters arrays[/expand]

18. ___ are used to pass results back from the method.
[expand title="Show Answer"]Answer: Output parameters[/expand]

19. ___ are used to pass into methods by reference.
[expand title="Show Answer"]Answer: Reference parameters[/expand]

20. Methods with the different parameters lists and different definitions are called ___.
[expand title="Show Answer"]Answer: method overloading[/expand]

21. structs are ___ data types.
[expand title="Show Answer"]Answer: composite[/expand]

22. What is the Nesting of methods?
[expand title="Show Answer"]Answer: The values of the actual parameters are assigned to the formal parameters at the time of invocation.[/expand]

23. Unassigned enum members have a value that is ___ more than their predecessor.
[expand title="Show Answer"]Answer: one[/expand]

24. ___ permits the same method name to be used for different operations in different derived classes.
[expand title="Show Answer"]Answer: Polymorphism[/expand]

25. Subclasses don’t inherit a ___ member variable if the subclass declares a member variable using the same name.
[expand title="Show Answer"]Answer: superclass's[/expand]

26. Inheritance is ___ in nature.
[expand title="Show Answer"]Answer: transitive[/expand]

27. The theory of ___ implies that you can control access to a class, method, or variable.
[expand title="Show Answer"]Answer: Encapsulation[/expand]

28. The ___ classes are accessible within the same program assembly and are not accessible from outside the assembly.
[expand title="Show Answer"]Answer: Internal[/expand]

29. The subclass constructor uses the keyword ___ to invoke the constructor method of the superclass.
[expand title="Show Answer"]Answer: base[/expand]

30. What is method overriding?
[expand title="Show Answer"]Answer: new[/expand]

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.
[expand title="Show Answer"]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.[/expand]

32. The ___ class is a base class that simply acts as a base for others and is not useful on its own.
[expand title="Show Answer"]Answer: abstract[/expand]

33. The ___ methods are implicit virtual methods and do not provide any implementation.
[expand title="Show Answer"]Answer: Abstract[/expand]

34. A class that cannot be sub-classed is called a ___ class.
[expand title="Show Answer"]Answer: sealed[/expand]

35. A ___ class cannot override sealed methods.
[expand title="Show Answer"]Answer: derived[/expand]

36. The ___ polymorphism is implemented using overloaded methods and operators.
[expand title="Show Answer"]Answer: Operation[/expand]

37. Inclusion polymorphism is achieved through the use of ___.
[expand title="Show Answer"]Answer: virtual functions[/expand]

38. The___ is another form of inheritance relationship known as containership between two classes, A and B.
[expand title="Show Answer"]Answer: Containment Inheritance[/expand]

39. A ___ inherits all of the member variables within its superclass that are accessible to that subclass.
[expand title="Show Answer"]Answer: subclass[/expand]

40. ___ is a condition that is caused by a runtime error in the program.
[expand title="Show Answer"]Answer: Exception[/expand]

41. Classes in C# cannot have more than one___ class.
[expand title="Show Answer"]Answer: super[/expand]

42. An interface in C# is a ___ type.
[expand title="Show Answer"]Answer: reference[/expand]

43. An interface can inherit ___ interfaces.
[expand title="Show Answer"]Answer: multiple[/expand]

44. One of the reasons that C# does not support multiple inheritances is the problem of ___.
[expand title="Show Answer"]Answer: name collision[/expand]

45. Interfaces are similar to ___ classes.
[expand title="Show Answer"]Answer: abstract[/expand]

46. ___ means method acting for another method.
[expand title="Show Answer"]Answer: Delegate[/expand]

47. A delegate declaration defines a class using the class ___as a base class.
[expand title="Show Answer"]Answer: System.Delegate[/expand]

48. Delegate types are implicitly ___.
[expand title="Show Answer"]Answer: sealed[/expand]

49. Delegates that hold and invoke multiple methods are called ___.
[expand title="Show Answer"]Answer: multicast delegates[/expand]

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.
[expand title="Show Answer"]Answer: event[/expand]

51. The ___ method returns a single character as int.
[expand title="Show Answer"]Answer: Read()[/expand]

52. The ___ method returns a string containing a line of text.
[expand title="Show Answer"]Answer: WriteLine()[/expand]

53. The ___ outputs one or more values to the screen without a newline character.
[expand title="Show Answer"]Answer: Write()[/expand]

54. The ___ outputs one or more values to the screen but adds a newline character at the end of the output.
[expand title="Show Answer"]Answer: ReadLine()[/expand]

55. Formatted output is produced using the overloaded ___ method.
[expand title="Show Answer"]Answer: WriteLine()[/expand]

56. ___ is an index number in curly brackets that indicates which variables of the argument list are to be substituted.
[expand title="Show Answer"]Answer: Marker[/expand]

57. The ___ and ___ characters are called placeholders.
[expand title="Show Answer"]Answer: zero, pound[/expand]

58. The location of the decimal point in the output may be decided by placing a ___ character in the format string.
[expand title="Show Answer"]Answer: period (.)[/expand]

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 ___.
[expand title="Show Answer"]Answer: Exception Handling[/expand]

60. In addition to the ‘catch’ block, the ___ block can have one or more statements that could generate an exception.
[expand title="Show Answer"]Answer: try[/expand]

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.
[expand title="Show Answer"]Answer: Templates[/expand]

62. What is an event handler?
[expand title="Show Answer"]Answer: An event handler is a Visual C# method containing a code that is executed when an event occurs on a control.[/expand]

63. The code for hiding the TextBox control at the start of the application is ___.
[expand title="Show Answer"]Answer: textBox1.Hide ()[/expand]

64. To display the popup messages as part of the event handling mechanisms, the method used is ___.
[expand title="Show Answer"]Answer: MessageBox.Show(“Message String”)[/expand]

65. How do you run the website1 web-based application?
[expand title="Show Answer"]Answer: Press the F5 key or the start debugging button of the toolbar, in Microsoft Visual Studio IDE.[/expand]

66. Click the ___ tab that appears at the bottom to display the Design view of the Default .aspx page.
[expand title="Show Answer"]Answer: design[/expand]

67. When we open the ___ view of the Default .aspx page, the toolbox containing controls such as Buttons and Labels appears automatically.
[expand title="Show Answer"]Answer: design[/expand]

68. The ___ block can also have one or more statements that are necessary to process the exception.
[expand title="Show Answer"]Answer: catch[/expand]

69. The point at which an exception is thrown is called the ___.
[expand title="Show Answer"]Answer: throw point[/expand]

70. C# treats the multiple catch statements like cases in a ___ statement.
[expand title="Show Answer"]Answer: switch[/expand]

71. All C# exceptions are derived from the class ___.
[expand title="Show Answer"]Answer: exception[/expand]

72. A catch block, which will catch any exception is called a ___.
[expand title="Show Answer"]Answer: general catch handler[/expand]

73. The ___ statement can be used to handle an exception that is not caught by any of the previous catch statements.
[expand title="Show Answer"]Answer: Finally[/expand]

74. When creating your own exceptions, it is good coding practice to end the class name of the user-defined exception with the word ___.
[expand title="Show Answer"]Answer:‘Exception’[/expand]

75. If an operation is___, then an exception will be thrown if overflow occurs.
[expand title="Show Answer"]Answer: checked[/expand]

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

Watch Dot Net and C# MCQ Questions on YouTube

Share on Social Media

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top