What is the purpose of the 'foreach' loop in C#?
A. Performs a conditional iteration
B. Terminates the loop
C. Iterates over elements in a collection
D. Executes a block of code repeatedly
Answer: Option C
A. Performs a conditional iteration
B. Terminates the loop
C. Iterates over elements in a collection
D. Executes a block of code repeatedly
Answer: Option C
What is the correct syntax to declare a variable in C#?
A. num = int;
B. var num;
C. num int;
D. int num;
What is the purpose of the 'var' keyword in C#?
A. Declares a constant
B. Converts a variable to string
C. Implicitly declares a variable
D. Defines a method
Join The Discussion