please explain me how the answer is coming in this question. I am unable to get this!
Please explain the quiz question
which question you are talking about??
can you share the question also
I have uploaded the question pic. Now check it please!
CodingBlocks is int so int can store 2017
BOSS1 is an unsigned short since unsigned only stores only positive number , so negative numbers are stored as 2^16 - x (where x is negative) (2^16 because short int contain 16 bits)
so -2018 will be stored as 2^16-2018
BOSS2 is an unsigned int and since int has 32bits so the -2020 will be stored as 2^32
BOSS3 is an int so can store -2020
BOSS4 is an unsigned long long int and since long long int has 64 bits so -2021 will be stored as 2^64-2021
Nagarro is an int so 2018.9 will be stored as 2018 (only the integer part)
HackerBlocks is a signed int so ‘A’ will be stored as its ascii value i.e. 65 due to typecasting s
In case of any doubt feel free to ask
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
I don’t understand the BOSS2 explaination. As BOSS2 is unsigned and has assigned with -2019,how it’s getting 2^32.
And also one more question, does unsigned and Unsigned int are same ?
Sorry I miss typed
It is 2^32-2019
Yes
Now you can give your feedback
If your doubt resolved
Else feel free to ask