Data Types
- The size_t integer type in C++ is?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The size_t type is used to represent the size of an object. Hence, it’s always unsigned. According to the language specification, it is at least 16 bits.
- What will be output of this function?
#include
using namespace std;
int main()
{
register int p = 15;
int *ptr = &p;
cout << *ptr;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Using & on a register variable may be invalid, since the compiler may store the variable in a register, and finding the address of it is illegal.
- What will be the output of this program?
#include
using namespace std;
int main()
{
int P = 20;
cout << "Given integer 'P' with 'true' :" << P && true;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Given integer 'P' with 'true' :20
- What will be output of this program?
#include
using namespace std;
int main()
{
int num = 5;
int num0 = num / -10;
int num1 = num % -10;
cout << num0 << " "<< num1;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Sign of result of mod operation on negative numbers is sign of the dividend.
- 0545, 451245123245, ‘p’ and 0X3f are _____ _____ ____ and _____ literals respectively.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Literal integer constants that begin with 0x or 0X are interpreted as hexadecimal and the ones that begin with 0 as octal. The character literal are written within ”.