Question 53: What is the total number of additions and multiplications in the following code?
Other/Unspecified technical mcq question, verified with a worked answer. Free to practise - no sign-up.
What is the total number of additions and multiplications in the following code?
s := 0
for i := 1 to n
s := s + i
for j := 1 to i
s := s + j * i
next j
next i
s := s + 10
Show answer & explanation
Answer: A. A) (n + 1)²
Verified technical evaluation based on core computer science and mathematical principles.
Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.