Data Types
-  Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?
 
- 
                        
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The standard does NOT require a char to be 8-bits, but does require that sizeof(char) return 1.
 
-  In C++, what is the sign of character data type by default?
 
- 
                        
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The standard does not specify if plain char is signed or unsigned. There are three distinct character types according to the standard: char, signed char and unsigned char.
 
-  Is the size of character literals different in C and C++?
 
- 
                        
View Hint View Answer Discuss in Forum
NA
Correct Option: A
In C++, sizeof(‘a’) == sizeof(char) == 1. In C however, sizeof(‘a’) == sizeof(int).
 
-  What is the output of this program?
#include
using namespace std;
int main()
{
char ch = 'M';
cout<< ch;
return 0;
} 
- 
                        
View Hint View Answer Discuss in Forum
NA
Correct Option: C
M
 
-  What constant defined in
header returns the number of bits in a char?  
- 
                        
View Hint View Answer Discuss in Forum
NA
Correct Option: C
CHAR_BIT