SAP Certified Development Associate – ABAP with SAP NetWeaver 7.50 — Question 5
An ABAP program processes the following expression: r = a/b + c.
Which of the following data declarations would cause the runtime environment to use fixed-point arithmetic for the above expression to calculate the value of "r"? (Choose two.)
Answer options
- A. DATA: r TYPE p DECIMALS 2, a TYPE i VALUE 201, b TYPE i VALUE 200, c TYPE f.
- B. DATA: r type p, a type i VALUE 201, b type i VALUE 200, c type i.
- C. DATA: r TYPE p DECIMALS 2, a TYPE i VALUE 201, b TYPE i VALUE 200, c TYPE p.
- D. DATA: r TYPE f, a TYPE i VALUE 201, b TYPE i VALUE 200, c TYPE f.
Correct answer: D
Explanation
The correct answer is D because it uses data types that allow for fixed-point arithmetic to be applied during the calculation. Options A and C also declare 'r' as a fixed-point type, but they include floating-point types for 'c', which would not result in fixed-point arithmetic. Option B only uses integer types, which do not trigger fixed-point arithmetic in this context.