Data Types
- Size of C++ objects are expressed in terms of multiples of the size of a ____ and the size of a char is _______
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
char, 1
- Identify the incorrect option.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
sizeof(char) <= sizeof(wchar_t) <= sizeof(long).
- What is the output of the following program?
#include
using namespace std;
int main()
{
int n = 0x10 + 030 + 50;
cout << sizeof(n)<<'\n';
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The sum of three numbers are belongs to different number systems, so the result is type casted into integer.
- What is the output of the following program?
#include
using namespace std;
int main()
{
int p = 10;
float q;
cout << sizeof(++p + q);
cout << " "< return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
The a as a integer will be converted to float while calculating the size. The value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 10.
- What would be the output of the following program (in 32-bit systems)?
#include
using namespace std;
int main()
{
cout << sizeof(char);
cout << " "<< sizeof(int);
cout << " "<< sizeof(float);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Character is 1 byte, integer 4 bytes and float 4 bytes.