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

1/3

Page

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

Which keyword is used to declare a constant in C#?

Select an option to see the answer and solution.

What is the default value of an integer variable in C# if not initialized explicitly?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which data type is used to store whole numbers in C#?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

In C#, which keyword is used to declare a variable that can hold values of any data type?

Select an option to see the answer and solution.

What is the purpose of a variable in C#?

Select an option to see the answer and solution.

What is the correct way to declare a floating-point variable in C#?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

In C#, how do you declare a variable without initializing it?

Select an option to see the answer and solution.

What is the data type of the following variable declaration: var x = 10;

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the data type of the variable in C#?

Select an option to see the answer and solution.

Which keyword is used to define a constant in C#?

Select an option to see the answer and solution.

What does the 'readonly' keyword do in C#?

Select an option to see the answer and solution.