Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q141: Which loop is best suited for iterating over arrays in C#?
- A: while loop
- B: do-while loop
- C: for loop
- D: foreach loop
View Answer
D
Q142: What does the break statement do in a loop?
- A: Terminates the loop immediately
- B: Skips the current iteration
- C: Restarts the loop
- D: Ends the entire program
View Answer
A
Q143: What does the continue statement do in a loop?
- A: Terminates the loop
- B: Skips the remaining code in the current iteration and jumps to the next iteration
- C: Ends the entire program
- D: Moves to the next loop
View Answer
B
Q144: Which of the following is the correct way to define a method in C#?
- A: methodName()
- B: void methodName(parameters)
- C: def methodName()
- D: static methodName(parameters)
View Answer
B
Q145: What does the this keyword in C# refer to?
- A: The current method
- B: The current object instance
- C: The parent class
- D: A static method
View Answer
B
Q146: Which parameter type in C# is used for returning multiple values?
- A: ref
- B: out
- C: in
- D: params
View Answer
B
Q147: What is the purpose of the params keyword in C#?
- A: To define a constant parameter
- B: To pass a variable number of arguments
- C: To pass a fixed number of arguments
- D: To return multiple values
View Answer
B
Q148: What is the difference between a for loop and a foreach loop in C#?
- A: for is for fixed-size arrays, foreach is for dynamic arrays
- B: for allows index manipulation, foreach does not
- C: for is slower, foreach is faster
- D: for is for string manipulation, foreach is for arithmetic
View Answer
B
Q149: How does C# treat the Bool keyword?
- A: As an alias for System.String
- B: As an alias for System.Boolean
- C: As an alias for System.Int32
- D: As an alias for System.Float
View Answer
B
Q150: What is the output of this code? Console.writeline("The value is {0}", true);
- A: The value is 1
- B: The value is True
- C: The value is false
- D: The value is 0
View Answer
B