Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q171: How can static methods in a class be called in C#?
- A: By creating an object
- B: Directly using the class name
- C: By using 'this' keyword
- D: By using 'new' keyword
View Answer
B
Q172: Which method is used to cleanup resources in C#?
- A: Constructor
- B: Static method
- C: Destructor
- D: Virtual method
View Answer
C
Q173: Which of the following keywords is used to declare a polymorphic method in C#?
- A: new
- B: virtual
- C: base
- D: static
View Answer
B
Q174: In C#, which of the following methods can be overridden in a derived class?
- A: Static method
- B: Instance method
- C: Virtual method
- D: Private method
View Answer
C
Q175: What does the 'base' keyword in C# do?
- A: It declares a base class
- B: It calls a constructor of the base class
- C: It accesses static methods
- D: It overrides a method
View Answer
B
Q176: How do you access a method in a nested namespace in C#?
- A: Using '::' operator
- B: Using 'namespace' keyword
- C: Using '.' operator
- D: Using '/' operator
View Answer
C
Q177: In C#, what does the 'new' keyword do when used with a method?
- A: It creates a new object
- B: It hides a base class method
- C: It initializes a constructor
- D: It defines a new class
View Answer
B
Q178: Which keyword is used to refer to the current object in a method in C#?
- A: base
- B: self
- C: this
- D: object
View Answer
C
Q179: What is the correct syntax to create an object of a class in C#?
- A: ClassName obj = new ClassName();
- B: ClassName obj = ClassName();
- C: obj = new ClassName;
- D: ClassName obj();
View Answer
A
Q180: In C#, what is the use of the 'override' keyword?
- A: To call a base class method
- B: To override a static method
- C: To provide a new implementation of a virtual method
- D: To prevent a method from being inherited
View Answer
C