...
Nielit Scientist-B CS 4-12-2016
April 5, 2025
Nielit Scientist-B CS 4-12-2016
April 5, 2025
Nielit Scientist-B CS 4-12-2016
April 5, 2025
Nielit Scientist-B CS 4-12-2016
April 5, 2025

Nielit Scientist-B CS 4-12-2016

Question 8
What will be output if you will compile and execute the following C code?

void main()

{

char c=125;

c=c+10;

printf(“%d”,c);

}

A
135
B
115
C
-121
D
-8
Question 8 Explanation: 
As we know any data type shows cyclic properties
In our example the data type is char data type , so if you will increase or decrease the char
variables beyond its maximum or minimum value respectively it will repeat same value
according to following cyclic order
So,
125+1= 126
125+2= 127
125+3=-128
125+4=-127
125+5=-126
125+6=-125
125+7=-124
125+8=-123
125+9=-122
125+10=-121
Correct Answer: C
Question 8 Explanation: 
As we know any data type shows cyclic properties
In our example the data type is char data type , so if you will increase or decrease the char
variables beyond its maximum or minimum value respectively it will repeat same value
according to following cyclic order
So,
125+1= 126
125+2= 127
125+3=-128
125+4=-127
125+5=-126
125+6=-125
125+7=-124
125+8=-123
125+9=-122
125+10=-121

Leave a Reply

Your email address will not be published. Required fields are marked *