Question
a) float a = (double) 12.502f;
float b = 12.80f;
float c;
c = (float) a + b;
Console.Writeline(c);
Console.ReadLine();
b) float a = 12.502D;
float b = 12.80f;
float c;
c = a + b;
Console.WriteLine(c);
Console.ReadLine();
c) double a = 12.502;
float b = 12.802f;
float c;
c = (float)a + b;
Console.WriteLine(c);
Console.ReadLine();
d) double a = (float) 12.502f;
float b = 12.80f;
float c;
c = a + b;
Console.WriteLine(c);
Console.ReadLine();
a.
a
b.
b
c.
c
d.
d
Posted under C# programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Select correct set of code to display the value of given variable ‘c’ as ‘25.302’.
Similar Questions
Discover Related MCQs
Q. Minimum and Maximum range of values supported by ‘float’ data type are ?
View solution
Q. Select appropriate difference between decimal, float and double data type in C# ?
1) Float and Double are floating binary point types while decimal is a floating decimal point type.
2) Precision difference for float is ‘7’ digit for double is ’15’ to ’16’ digit and for decimal is ’28’ to ’29’ digits.
3) Some values which cannot be exactly represented hence for those values float and double are more appropriate.
View solution
Q. A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored ?
View solution
Q. The Default value of Boolean DataType is ?
View solution
Q. Which of the following format specifiers is used to print hexadecimal values and return value of output as Octal equivalent in C# ?
View solution
Q. What is the Size of ‘Char’ datatype?
View solution
Q. Select the correct differences between char and varchar datatypes?
1. varchar is non unicode and char is unicode character datatype
2. char is ‘n’ bytes whereas varchar is actual length in bytes of data entered in terms of storage size
3. varchar is variable in length and char is the fixed length string
4. For varchar, if a string is less than the maximum length then it is stored in verbatim without any extra characters while for char if a string is less than the set length it is padded with extra characters to equalize its length to given length
View solution
Q. Which is the String method used to compare two strings with each other ?
View solution
Q. For two strings s1 and s2 to be equal, which is the correct way to find if the contents of two strings are equal ?
View solution
Q. Correct statement about strings are ?
View solution
Q. Verbatim string literal is better used for ?
View solution
Q. Why strings are of reference type in C#.NET ?
View solution
Q. Storage location used by computer memory to store data for usage by an application is ?
View solution
Q. DIFFERENCE BETWEEN KEYWORDS ‘VAR’ AND ‘DYNAMIC’ ?
View solution
Q. Are the given codes :
1. Myclass class;
Myclass class2 = null;
2. int i;
int j = 0;
View solution
Q. Scope of variable is related to definition of variable as:
a. Region of code within which variable value is valid and hence can be accessed.
b. No, relation with region where variable is declared its value is valid in entire scope.
View solution
Q. Syntax for declaration and initialization of data variable is :
View solution
Q. Choose effective differences between ‘Boxing’ and ‘Unboxing’.
View solution
Q. Select differences between reference type and value type :
1. Memory allocated to ‘Value type’ is from heap and reference type is from ‘System. ValueType’
2. Memory allocated to ‘Value type’ is from ‘System. ValueType’ and reference type is from ‘Heap’
3. Structures, enumerated types derived from ‘System. ValueType’ are created on stack, hence known as ValueType and all ‘classes’ are reference type because values are stored on heap
View solution
Q. What is the need for ‘Conversion of data type’ in C#?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!