Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q271: How do you create a new directory in C#?
- A: Directory.Make
- B: Directory.CreateNew
- C: Directory.CreateDirectory
- D: Directory.Add
View Answer
C
Q272: What does the FileInfo class provide?
- A: Information about directories
- B: Information about file attributes
- C: Information about file content
- D: Information about file system operations
View Answer
B
Q273: How can you retrieve a list of files in a directory using DirectoryInfo?
- A: di.GetFiles()
- B: di.ListFiles()
- C: di.FetchFiles()
- D: di.ListAllFiles()
View Answer
A
Q274: What is the purpose of using reflection in C#?
- A: To improve file handling
- B: To retrieve information about types and methods
- C: To manage file and directory operations
- D: To handle exception handling
View Answer
B
Q275: How can you get the type information of an object using reflection?
- A: object.GetType()
- B: object.GetTypeInfo()
- C: Type.GetType()
- D: object.TypeInfo()
View Answer
A
Q276: How do you obtain all the types defined in an assembly using reflection?
- A: Assembly.GetTypes()
- B: Assembly.GetAllTypes()
- C: Assembly.ListTypes()
- D: Assembly.GetDefinedTypes()
View Answer
A
Q277: What method allows you to invoke a method using reflection?
- A: MethodInfo.Invoke()
- B: Method.Invoke()
- C: MethodInfo.Call()
- D: Method.InvokeMethod()
View Answer
A
Q278: How does PropertyInfo.SetValue work in reflection?
- A: Sets the value of a property
- B: Retrieves the value of a property
- C: Updates the property metadata
- D: Deletes the property value
View Answer
A
Q279: What is the purpose of StreamWriter in file handling?
- A: To read files
- B: To write text to files
- C: To delete files
- D: To append text to files
View Answer
B
Q280: How do you safely handle file operations to ensure the file is closed properly?
- A: Using FileHandler
- B: Using StreamWriter with using block
- C: Directly managing file handles
- D: Using FileManager
View Answer
B