CommerceBasic 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#?
- A. -- This is a comment
- B. # This is a comment
- C. // This is a comment
- D. /* This is a comment */
Correct Answer: C
Which of the following is a valid identifier in C#?
- A. $variable
- B. myVariable
- C. #variable
- D. None of the above
Correct Answer: B
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
Correct Answer: C
What is the correct syntax to declare a variable in C#?
- A. num = int
- B. var num
- C. num int
- D. int num
Correct Answer: D