Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q261: What will the following code print if the xmlReader reads a Cube element with attributes?
- A: currency: rate
- B: currency and rate values
- C: currency
- D: rate
View Answer
B
Q262: What does the SelectSingleNode method do in XmlDocument?
- A: Selects all nodes matching the XPath expression
- B: Selects a single node matching the XPath expression
- C: Loads the XML document from a file
- D: Creates a new node in the XML document
View Answer
B
Q263: What is the primary use of XML in programming?
- A: Exchanging data between applications
- B: Storing code execution instructions
- C: Providing compile-time metadata
- D: Managing application resources
View Answer
A
Q264: What is the purpose of an extension method in C#?
- A: To create a new class
- B: To simplify code by adding methods to existing types
- C: To replace existing methods
- D: To handle file operations
View Answer
B
Q265: How do you use an extension method for a string in C#?
- A: By using the Extension keyword
- B: By calling it on the string variable directly
- C: By modifying the string class directly
- D: By declaring a new method in the myutils class
View Answer
B
Q266: What method is used to read the entire content of a file in C#?
- A: File.Read
- B: File.ReadAllText
- C: File.ReadFrom
- D: File.ReadContent
View Answer
B
Q267: How can you write text to a file in C#?
- A: File.WriteText
- B: File.WriteAllText
- C: File.Write
- D: File.AppendText
View Answer
B
Q268: What is the correct method to append text to an existing file in C#?
- A: File.AppendAllText
- B: File.WriteAllText
- C: File.AppendText
- D: File.AddText
View Answer
A
Q269: How do you delete a file using C#?
- A: File.DeleteFile("filename")
- B: File.Remove("filename")
- C: File.Delete("filename")
- D: File.RemoveFile("filename")
View Answer
C
Q270: What method is used to rename a file in C#?
- A: File.Move
- B: File.Rename
- C: File.ChangeName
- D: File.UpdateName
View Answer
A