Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q181: How can we rename a namespace in C# using the 'using' directive?
- A: Using 'using' keyword
- B: Using 'namespace' keyword
- C: Using '=' operator
- D: Using ':' operator
View Answer
C
Q182: What is the output of the following code: Console.writeline("I'm a Square.");
- A: I’m a Square
- B: I’m a Square.
- C: Square Output
- D: Console Output
View Answer
B
Q183: In C#, which constructor is called first when an object of a derived class is created?
- A: Static constructor
- B: Destructor
- C: Base class constructor
- D: Derived class constructor
View Answer
C
Q184: What does the following code print: Console.writeline("I'm just a generic drawing object.");
- A: Generic drawing object
- B: I’m just a generic drawing object
- C: I’m just a generic drawing object.
- D: Drawing object output
View Answer
C
Q185: What is the primary purpose of auto-implemented properties in C#?
- A: Simplify property declarations
- B: Increase performance
- C: Ensure thread safety
- D: Simplify inheritance
View Answer
A
Q186: Which keyword is used in C# to define an indexer?
- A: array
- B: index
- C: this
- D: object
View Answer
C
Q187: How do you access an indexer in a C# class?
- A: Using curly braces {}
- B: Using parentheses ()
- C: Using square brackets []
- D: Using angle brackets <>
View Answer
C
Q188: What keyword is used to define a structure in C#?
- A: struct
- B: class
- C: interface
- D: enum
View Answer
A
Q189: What is a key difference between a struct and a class in C#?
- A: Structs are reference types, classes are value types
- B: Structs can inherit from other structs
- C: Structs are value types, classes are reference types
- D: Classes cannot contain methods, but structs can
View Answer
C
Q190: Which of the following statements about interfaces in C# is true?
- A: Interfaces can contain implementation code
- B: Interfaces cannot be inherited
- C: Interfaces define a contract without implementation
- D: Interfaces are used to implement multiple inheritance
View Answer
C