Skip to main content

Visual Programming MCQs with Answers

Practice important Visual Programming MCQs with answers and explanations.

Chapter: 6
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
Correct Answer: A
Chapter: 6
Q162:
Which method in C# is automatically called when an object is destroyed?
A. Constructor
B. Destructor
C. Method
D. Static Method
Correct Answer: B
Chapter: 6
Q163:
What is the keyword used to inherit a class in C#?
A. implements
B. base
C. inherit
D. extends
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: A
Chapter: 6
Q168:
Which keyword is used to declare a property as read-only in C#?
A. set
B. get
C. readonly
D. value
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
Q172:
Which method is used to cleanup resources in C#?
A. Constructor
B. Static method
C. Destructor
D. Virtual method
Correct Answer: C
Chapter: 6
Q173:
Which of the following keywords is used to declare a polymorphic method in C#?
A. new
B. virtual
C. base
D. static
Correct Answer: B
Chapter: 6
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
Correct Answer: C
Chapter: 6
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
Correct Answer: B
Chapter: 6
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
Correct Answer: C
Chapter: 6
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
Correct Answer: B
Chapter: 6
Q178:
Which keyword is used to refer to the current object in a method in C#?
A. base
B. self
C. this
D. object
Correct Answer: C
Chapter: 6
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();
Correct Answer: A
Chapter: 6
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
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Visual Programming

🚀 Start Quiz Now