You are on page 1of 7

1. What can identifiers in C++ be used to represent?

a. Only variables
b. Variables, constants, types, functions, and labels
c. Only functions
d. Only types

Answer: b. Variables, constants, types, functions, and labels

2. How many characters can an identifier in C++ consist of?


a. 31 characters
b. 63 characters
c. As many characters as needed
d. 10 characters

Answer: a. 31 characters

3. Which of the following is a rule for naming identifiers in C++?


a. The first character must be a digit
b. The name can contain spaces
c. Reserved words can be used as identifier names
d. The first character must be an alphabetic or underscore

Answer: d. The first character must be an alphabetic or underscore


4. What is a standard identifier in C++?
a. An identifier defined by the user
b. A type of identifier with a special meaning in C++
c. An identifier used for storing data
d. An identifier with 63 characters

Answer: b. A type of identifier with a special meaning in C++

5. How many keywords are there in the C++ language?


a. 31
b. 63
c. 10
d. It varies depending on the program

Answer: b. 63

6. Which of the following is considered a user-defined identifier in C++?


a. cout
b. cin
c. marks
d. int
Answer: c. Marks

7. What happens if the name of an identifier in C++ is longer than 31 characters?


a. It results in a compilation error.
b. The first 31 characters are used, and the rest are ignored.
c. The program automatically shortens the name.
d. The program crashes.

Answer: b. The first 31 characters are used, and the rest are ignored.

8. What is the maximum number of characters allowed in a C++ identifier?


a. 63
b. 127
c. 255
d. 31

Answer: d. 31

9. What is the significance of keywords in C++?


a. They are user-defined identifiers.
b. They can be redefined by the user.
c. They have predefined meanings and purposes set by the language developer.
d. They are used for naming variables only.
Answer: c. They have predefined meanings and purposes set by the language
developer.

10. Which of the following is NOT a standard identifier in C++?


a. cout
b. int
c. if
d. for

Answer: b. Int

1. Line: “The identifiers are the names used to represent variable, constants,
types, functions and labels in the program.”
Question: What do identifiers represent in a program?
a. Only constants
b. Variables and constants
c. Types and functions
d. Labels only
Answer: b. Variables and constants

2. Line: “A good identifier name should be descriptive but short.”


Question: What is a characteristic of a good identifier name?
a. Long and complex
b. Descriptive and long
c. Short and random
d. Descriptive but short
Answer: d. Descriptive but short

3. Line: “An identifier in C++ may consist of 31 characters.”


Question: What is the maximum character limit for a C++ identifier?
a. 10 characters
b. 31 characters
c. 63 characters
d. Unlimited characters
Answer: b. 31 characters

4. Line: “The first character must be an alphabetic or underscore.”


Question: What is the rule for the first character of an identifier in C++?
a. It must be a digit
b. It can be any special character
c. It must be an alphabetic or underscore
d. It doesn’t matter
Answer: c. It must be an alphabetic or underscore

5. Line: “The reserved word cannot be used as an identifier name.”


Question: Can reserved words be used as identifier names in C++?
a. Yes
b. No
Answer: b. No

6. Line: “C++ provides the following types of identifiers:”


Question: How many types of identifiers does C++ provide?
a. One
b. Two
c. Three
d. Four
Answer: c. Three

7. Line: “A type of identifier that has special meaning in C++ is known as a


standard identifier.”
Question: What is a standard identifier in C++?
a. An identifier defined by the user
b. A type of identifier with special meaning
c. A user-defined identifier
d. A reserved keyword
Answer: b. A type of identifier with special meaning

8. Line: “Keyword is a word in C++ language that has a predefined meaning


and purpose.”
Question: What is a keyword in C++?
a. A word with no meaning
b. A word defined by the user
c. A word with a predefined meaning and purpose
d. A type of identifier
Answer: c. A word with a predefined meaning and purpose

9. Line: “The total number of keywords is 63.”


Question: How many keywords are there in the C++ language?
a. 31
b. 63
c. 127
d. 255
Answer: b. 63

You might also like