What will be the output of the following pseudo code for arr[] = 1, 2, 3, 4, 5…

PYQ Accenture Hiring Assessment 2024

What will be the output of the following pseudo code for arr[] = 1, 2, 3, 4, 5 ?

initialize i, n
initialize an array of size n
accept the values for the array
for i = 0 to n - 2
    arr[i] = arr[i] + arr[i+1]
end for
print the array elements
  1. A.

    3 5 7 9 5

  2. B.

    3 5 7 9 11

  3. C.

    3 5 9 15 20

  4. D.

    error

Attempted by 540 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…