ExamVeda
Login
Home
11
Which keyword is used to define a constant in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
12
What is the output of the following code: int x = 5, y = 2; cout << x / y;
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
13
What is the correct way to declare a pointer in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
14
What is the keyword used for inheritance in C++?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
15
What function is used to return the length of a string in C++?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
16
What is the output of the following code: int x = 10; cout << "Value of x is: " << x++ << endl;?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
17
Which of the following is not a valid C++ identifier?
Discuss
Answer & Solution
Answer: Option E
Solution:
C++ Identifiers: Naming Rules
In C++, identifiers are names you give to things like variables, functions, and classes. They must follow specific rules.

Rules for Valid Identifiers:
1. They can contain letters (a-z, A-Z), digits (0-9), and underscores (_).
2. They must begin with a letter or an underscore.
3. They cannot contain spaces.
4. They cannot be C++ keywords (like int, float, while, etc.).

Let's Check the Options:
A) _variableName: This is valid. It starts with an underscore and uses letters.
B) 2ndVariable: This is invalid. Identifiers cannot start with a digit.
C) variable_name@: This is invalid. It contains the "@" symbol, which is not allowed.
D) VariableName: This is valid. It starts with a letter and uses letters.

Therefore, the correct answer is E, Both (B) and (C) are not valid C++ identifiers.
18
What is the result of the expression: sizeof(int) in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
19
Which C++ feature allows a function to call itself?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
20
What is the correct syntax to dynamically allocate memory for an array of integers in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board