Vidyalelo
C# Programming · all questions

Variables and Constants in C Sharp
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

45

Questions

2/3

Page

Pick an option on a question to see the right answer and solution.

What is the default value of a boolean variable in C# if not initialized explicitly?

Select an option to see the answer and solution.

Which of the following is NOT a valid constant name in C#?

Select an option to see the answer and solution.

In C#, which keyword is used to declare a variable without specifying its data type explicitly?

Select an option to see the answer and solution.

What is the scope of a global variable in C#?

Select an option to see the answer and solution.

Which of the following is a valid way to declare and initialize a string variable in C#?

Select an option to see the answer and solution.

What is the purpose of declaring constants in C#?

Select an option to see the answer and solution.

What is the value of a variable in C# after it is declared but not assigned a value?

Select an option to see the answer and solution.

In C#, what is the result of the expression 3 / 2?

Select an option to see the answer and solution.

Which keyword is used to exit a loop prematurely in C#?

Select an option to see the answer and solution.

What is the correct way to declare a nullable integer variable in C#?

Select an option to see the answer and solution.

What is the correct syntax to declare a constant in C#?

Select an option to see the answer and solution.

Which of the following is NOT a valid data type in C#?

Select an option to see the answer and solution.

What is the scope of a global variable in C#?

Select an option to see the answer and solution.

In C#, which data type is used to represent characters and symbols?

Select an option to see the answer and solution.

What is the purpose of the 'volatile' keyword in C#?

Select an option to see the answer and solution.

Which of the following is a valid constant in C#?

Select an option to see the answer and solution.

What is the correct way to declare and initialize a constant in C#?

Select an option to see the answer and solution.

Which of the following is a valid variable name in C#?

Select an option to see the answer and solution.

What is the data type of the following variable declaration: var name = "John";

Select an option to see the answer and solution.

In C#, which keyword is used to declare a variable that cannot be modified once it is assigned a value?

Select an option to see the answer and solution.