ExamVeda
Login
Home
21
What will be the output of the following code: cout << (5 != 2); in C++?
Discuss
Answer & Solution
Answer: Option C
Solution:
The output of the code cout << (5 != 2); in C++ will be 1.

The expression (5 != 2) is a comparison operation that checks if 5 is not equal to 2.

Since 5 is indeed not equal to 2, the expression evaluates to true.

In C++, the boolean value true is represented by 1.

Therefore, the output will be 1. However, it seems there might be a misunderstanding. The correct answer should be Option C: 1. If the options provided are fixed, then the answer should be corrected to reflect the boolean output as 1.
22
What is the size of a 'long double' data type in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
23
Which of the following is not a valid variable name in C++?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
24
What is the correct way to represent octal values in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
25
What does the 'volatile' keyword do in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
26
What is the result of the following expression in C++: 7 % 3?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
27
What is the correct way to declare a pointer to an integer in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
28
What is the data type of the expression: 5.2f in C++?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
29
What is the output of the following code: `cout << (true || false);` in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
30
What is the range of values for a 'signed char' data type in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board