Decimal data type - Quiz
  • 1. What is the primary purpose of a decimal data type?
A) To replace all floating-point numbers in memory
B) To represent non-repeating decimal fractions without rounding
C) To store only integer values
D) To increase the speed of binary calculations
  • 2. Why do floating-point numbers often struggle with representing 0.3 accurately?
A) They use a base-10 exponent exclusively
B) They do not support non-repeating fractions
C) They restrict the denominator to a power of two
D) They have too many bits for simple fractions
  • 3. In the context of decimal representation, what happens when 0.1 * 7 is evaluated in some systems?
A) It results in an error
B) It may evaluate to false due to inexactness
C) It always equals 0.7000000000000001
D) It is always true
  • 4. Which of the following is a common real-world application where decimal fractions are preferred?
A) Binary networking protocols
B) Hardware interrupt handling
C) Low-level machine instruction sets
D) Currency
  • 5. How can a decimal data type be implemented?
A) Only as a floating-point number
B) As an array of characters
C) As either a floating-point or fixed-point number
D) Only as a fixed-point number
  • 6. What characterizes the fixed-point implementation of a decimal type?
A) The denominator is always a power of two
B) The exponent varies
C) The denominator is set to a fixed power of ten
D) It is always less precise than floating-point
  • 7. What is the key feature of a floating-point decimal implementation?
A) A variable exponent represents the power of ten
B) A restricted exponent range of 0 to 10
C) A fixed denominator
D) No mantissa
  • 8. How are rational data types typically constructed?
A) From a hex code
B) From a string
C) From two integers
D) From a single floating-point number
  • 9. Which standard specifies three floating-point decimal data types?
A) IEEE 754
B) ANSI C
C) Unicode Standard
D) ISO/IEC 9899
  • 10. Which of the following is an IEEE 754 decimal floating-point format?
A) Decimal32
B) Decimal16
C) Decimal256
D) Decimal8
  • 11. How many bits are used by the C# built-in decimal data type?
A) 32 bits
B) 256 bits
C) 128 bits
D) 64 bits
  • 12. Which class is used for decimal calculations in Python?
A) num.Decimal
B) math.Fixed
C) python.Float
D) decimal.Decimal
  • 13. What is the decimal library class used in Ruby?
A) RationalNum
B) Float64
C) DecimalNumber
D) BigDecimal
  • 14. What is the name of the class for decimals in Java?
A) java.decimal.Decimal
B) java.math.DecimalNumber
C) java.core.Fixed
D) java.math.BigDecimal
  • 15. What is the maximum mantissa length for the NSDecimalNumber class?
A) 64 digits
B) 28 digits
C) 38 digits
D) 128 digits
  • 16. What does ABAP's DECFLOAT16 correspond to?
A) fixed-point decimal
B) decimal128
C) decimal64
D) decimal32
  • 17. Which language provides support for decimal floats as an extension via gcc?
A) C and C++
B) Python
C) Ruby
D) Java
  • 18. What is the approximate range of the C# decimal type?
A) ±0.001 to ±1000
B) ±1.0 × 10−28 to ±7.9228 × 1028
C) ±232 to ±264
D) ±1.0 × 10−128 to ±1.0 × 10127
  • 19. Which language natively supports both fixed-point and floating-point decimal data?
A) Python
B) PL/I
C) Ruby
D) C#
  • 20. What is the range of the exponent in the Cocoa NSDecimalNumber class?
A) -128 to 127
B) -28 to 28
C) 0 to 38
D) -64 to 64
Created with That Quiz — where test making and test taking are made easy for math and other subject areas.