Site icon T4Tutorials.com

Tokens, keywords, identifiers, and constants — C++ MCQ

1. Which of the following is not a keyword in C++?

(A) int


(B) float


(C) main


(D) return



2. Which of the following is a valid identifier in C++?

(A) 2variable


(B) my_var


(C) class


(D) #count



3. Which of the following is a valid constant in C++?

(A) 123


(B) variable1


(C) myVar


(D) int



4. Which of the following is considered a token in C++?

(A) if


(B) myVariable


(C) +


(D) All of the above



5. What is the maximum length of an identifier in C++?

(A) 31 characters


(B) 63 characters


(C) Implementation-dependent


(D) 255 characters



6. Which of the following is a floating-point constant in C++?

(A) 12


(B) 12.5


(C) 'A'


(D) true



7. Which of the following cannot be used as an identifier in C++?

(A) myVar


(B) _count


(C) int


(D) var123



8. Which of the following is a character constant in C++?

(A) "A"


(B) 'A'


(C) 65


(D) A



9. What type of token is ++ in C++?

(A) Keyword


(B) Operator


(C) Identifier


(D) Constant



10. Which of the following is not allowed in an identifier?

(A) Alphabet


(B) Digit (except at the start)


(C) Underscore


(D) Space



Exit mobile version