In question 3 and 4, only the data modifiers have been mentioned (i.e long, short, unsigned etc.). There is nothing mentioned about the datatype. Eg. signed CodingBlocks. What does this mean?
Doubt in Quiz - Programming Fundamentals
Actually I couldn’t post the doubt on quiz topic as ‘Ask Doubts’ button was deactivated.
hey Himalaya,
for question 3:
Signed means you are declaring a number which can be negative as well as positive but unsigned can have positive value only.
you can use Signed or unsigned for integer value without writing int which is the only reason
signed CodingBlocks is valid. Therefore line 4 is absolutely correct.
But you cannot use only signed or unsigned when you deal with characters. you have mention them as signed char or unsigned char which is the reason line 5 is wrong and line 6 is correct.
in line 5 datatype of Nagarro is integer with signed modifier but value given to it is not a number but a character which is too without quotes.
Important note: signed Nagarro = ‘A’; is also a correct statement beacuse here nagarro will store ASCII value of ‘A’.
Consider the below example
signed char var=‘a’; cout<<var; //output=a
signed var=‘a’; cout<<var; //output= 97
conclusion: if it is only signed or unsigned than it is modifier for integer and if there is char after signed or unsigned than it for char.
question 4:
double datatype never has short as modifier. Thatswhy there is error
Hey Himalaya, if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved.