Skip to main content

Visual Programming MCQs with Answers

Practice important Visual Programming MCQs with answers and explanations.

Chapter: 4
Q121:
How do you write a Hello World program in C# that outputs to the console?
A. System.print("Hello world!");
B. System.out("Hello world!");
C. Console.writeline("Hello world!");
D. Console.output("Hello world!");
Correct Answer: C
Chapter: 4
Q122:
What method is used to write to the console and get input from the user in C#?
A. Console.input()
B. Console.scanf()
C. Console.read()
D. Console.readline()
Correct Answer: D
Chapter: 4
Q123:
Which of the following is used to compile a C# program into an executable?
A. Java Runtime Environment
B. .NET Framework
C. Common Language Infrastructure
D. C++ Runtime
Correct Answer: C
Chapter: 4
Q124:
What is a feature of C# regarding exceptions?
A. Supports checked exceptions
B. Does not support checked exceptions
C. Requires manual exception handling
D. Does not allow exceptions
Correct Answer: B
Chapter: 4
Q125:
What does the following code snippet demonstrate? Genericlist<int> list1 = new genericlist<int>();
A. Generics
B. Boxing
C. Polymorphism
D. Inheritance
Correct Answer: A
Chapter: 4
Q126:
How are functions written in C#?
A. def functionName()
B. function functionName()
C. public static void functionName()
D. void functionName()
Correct Answer: C
Chapter: 4
Q127:
What does the Main() function represent in a C# program?
A. The start point of the program
B. The end point of the program
C. A helper function
D. An error handler
Correct Answer: A
Chapter: 5
Q128:
What type does the Bool keyword represent in C#?
A. Integer
B. Boolean
C. String
D. Float
Correct Answer: B
Chapter: 5
Q129:
Which of the following is an integer type in C#?
A. float
B. double
C. int
D. string
Correct Answer: C
Chapter: 5
Q130:
What does the System.String type support in C#?
A. Boolean values
B. Escape and verbatim sequences
C. Integer arithmetic
D. Floating-point arithmetic
Correct Answer: B
Chapter: 5
Q131:
Which operator is used for string concatenation in C#?
A. +
B. -
C. *
D. /
Correct Answer: A
Chapter: 5
Q132:
Which operator in C# is used to access array elements?
A. . (dot)
B. [] (brackets)
C. -> (arrow)
D. {} (curly braces)
Correct Answer: B
Chapter: 5
Q133:
How are arrays indexed in C#?
A. Zero-based
B. One-based
C. Two-based
D. Three-based
Correct Answer: A
Chapter: 5
Q134:
What is a jagged array in C#?
A. An array of different data types
B. A multi-dimensional array
C. An array of arrays
D. A sorted array
Correct Answer: C
Chapter: 5
Q135:
What will the following code print? Console.writeline("myints[0]: {0}, myints[1]: {1}", myints[0], myints[1]);
A. Values of myints array
B. Addresses of myints array elements
C. Length of myints array
D. Names of myints array elements
Correct Answer: A
Chapter: 5
Q136:
What is the purpose of a switch statement in C#?
A. To control data flow
B. To define variables
C. To iterate over arrays
D. To handle multiple possible values of a variable
Correct Answer: D
Chapter: 5
Q137:
Which control statement would you use for a conditional check in C#?
A. switch
B. loop
C. goto
D. if-else
Correct Answer: D
Chapter: 5
Q138:
Which of the following types can be used in a switch statement in C#?
A. Floats
B. Strings
C. Doubles
D. Complex numbers
Correct Answer: B
Chapter: 5
Q139:
What kind of loop is this? for (int i = 0; i < 10; i++) { }
A. while loop
B. do-while loop
C. for loop
D. foreach loop
Correct Answer: C
Chapter: 5
Q140:
What kind of loop is the following? while (condition) { }
A. do-while loop
B. for loop
C. while loop
D. foreach loop
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Visual Programming

🚀 Start Quiz Now