Quiz on programming fundamentas

please explain q 3 , 4 and 5

Please send the questions here. And the options as well.

"/* The output of the following program is ? */ 1) #include
2) using namespace std;
3) int main(){
4) signed CodingBlocks = 9;
5) signed Nagarro = A;
6) signed char HackerBlocks = ‘A’;
7) cout<<CodingBlocks<<endl;
8) cout<<HackerBlocks<<endl;
9) return 0;
} "

A 9

Error in line 4

Error in line 5

9 A

"/* Output ? */
#include
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;
}"

2017 2^16 - 2018 2^32 -2019 -2020 2^64 - 2021 2018 65

2017 2018 2019 2020 2021 2018.9 A

2017 2^32 - 2018 2^32 -2019 -2020 2^32 - 2021 2018 65

2017 2^32 - 2018 2^32 -2019 -2020 2^64 - 2021 2018 64

"/* What will be the output of the following program ? */

#include
using namespace std;

int main(){
signed CodingBlocks = 9;
short double Nagarro = 8.8;
signed char HackerBlocks = ‘A’;
cout<<CodingBlocks<<endl;
cout<<Nagarro<<endl;
cout<<HackerBlocks<<endl;

return 0;
}"

9 8.8 A

"Run Time Error "

Error due to Nagrro

Error Due to Coding Blocks

In first question, there is error in line 5 as A is a character and not an integer. So it should be ‘A’.
In third question, there is error due to Nagarro as short cannot be used with double.

what about 2nd one?
and in the first one , wont the ascii code of a be assingned?

No the ascii code is not assigned like this. For the ascii code, we wrtite -
int a = int(‘A’);
And I am not sure about the second question because when I am running it on coding blocks IDE, I am getting an output which is not even in the options.

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.