please explain ques 5 about the power stuff.
Doubt regarding wrong question in quiz
"/* Output ? */
#include<iostream>
using namespace std;
int main(){
long signed CodingBlocks = 2017;
short unsigned BOSS1 = -2018;
unsigned BOSS2 = -2019;
int BOSS3 = -2020;
long long unsigned BOSS4 = -2021;
short unsigned Nagarro = 2018.9;
long signed HackerBlocks = 'A';
cout<<CodingBlocks<<endl;
cout<<BOSS1<<endl<<BOSS2<<endl<<BOSS3<<endl<<BOSS4<<endl;
cout<<Nagarro<<endl;
cout<<HackerBlocks<<endl;
return 0;
}"
What you have doubt.
The correct ans are
2017
63518
4294965277
-2020
18446744073709549595
2018
65
explain.
i dont want correct solution. that is already give in the course.
One time please revise your data type range theory and you will get to know.
I will also try to understand this to you.
- 2017 is in the range of long signed so it is stored.
- short unsigned only store positive integer but -2018 is negative so max rangge of unsigned short is assigned i.e 63518
- Same as above. Cant store -ve integer so assign its greatest +ve number.
- Int can store. So this is right
- long long unsigned can not store -ve integer so give its largest vaue to the numbe i.e 18446744073709549595
All the below like this only. See the ranges of all the data types
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.