Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q161: What is the purpose of the 'using' directive in C#?
- A: To import classes from a namespace
- B: To define a class
- C: To declare a variable
- D: To execute a method
View Answer
A
Q162: Which method in C# is automatically called when an object is destroyed?
- A: Constructor
- B: Destructor
- C: Method
- D: Static Method
View Answer
B
Q163: What is the keyword used to inherit a class in C#?
- A: implements
- B: base
- C: inherit
- D: extends
View Answer
B
Q164: What is the output of the following C# code snippet: 'Console.writeline("Parent Constructor.");'?
- A: Parent Constructor
- B: Parent Constructor.
- C: Console Output
- D: Constructor Call
View Answer
B
Q165: How can a method in a derived class override a method in the base class in C#?
- A: By using 'virtual' keyword
- B: By using 'override' keyword
- C: By using 'new' keyword
- D: By using 'base' keyword
View Answer
B
Q166: What is polymorphism in C#?
- A: Ability to inherit from multiple classes
- B: Ability to invoke derived class methods through base class reference
- C: Ability to create multiple objects
- D: Ability to use multiple constructors
View Answer
B
Q167: How are properties in C# used?
- A: To provide protected access to class fields
- B: To declare a class
- C: To inherit methods
- D: To execute a loop
View Answer
A
Q168: Which keyword is used to declare a property as read-only in C#?
- A: set
- B: get
- C: readonly
- D: value
View Answer
B
Q169: What is the output of the following C# code: 'Console.writeline("I'm a Circle.");'?
- A: I’m a Circle
- B: I’m a Circle.
- C: Circle Output
- D: Console Output
View Answer
B
Q170: What type of properties have an implementation of 'set' but not 'get' in C#?
- A: Read-only properties
- B: Write-only properties
- C: Public properties
- D: Private properties
View Answer
B