Commerce

Basic Syntax And Data Types In C Sharp MCQs

Practice Basic Syntax And Data Types In C Sharp MCQs for competitive exams.

Basic Syntax And Data Types In C Sharp MCQs

Practice questions from this topic.

What is the correct way to comment a single line in C#?

  1. A. -- This is a comment
  2. B. # This is a comment
  3. C. // This is a comment
  4. D. /* This is a comment */
Report Error

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

  1. A. $variable
  2. B. myVariable
  3. C. #variable
  4. D. None of the above
Report Error

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

  1. A. Declares a constant
  2. B. Converts a variable to string
  3. C. Implicitly declares a variable
  4. D. Defines a method
Report Error

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

  1. A. num = int
  2. B. var num
  3. C. num int
  4. D. int num
Report Error