Neco 2017 Computer Studies Question 28

Practice objective / multiple choice question 28 from the 2017 Neco Computer Studies examination.

Neco 2017 Computer Studies Objective / Multiple Choice Hard Difficulty
Question 28 NECO • 2017 • COMPUTER_STUDIES • objective

Consider the following Python function that returns a list where each element is the product of all other elements of the input list, without using the division operator:\n\n```python\ndef product_others(nums):\n n = len(nums)\n result = [1]*n\n prefix = 1\n for i in range(n):\n result[i] = prefix\n prefix *= nums[i]\n suffix = 1\n for i in range(n-1, -1, -1):\n result[i] *= suffix\n suffix *= nums[i]\n return result\n```\n\nWhat is the output of \(product_others([2, 3, 4, 5])\)?

Answer Options

A. 60,30,40,24
B. 24,30,40,60
C. 120,60,40,30
Correct Answer D. 60,40,30,24
Correct Answer
D
Correct Option:
60,40,30,24

About This Question

This is Neco 2017 Computer Studies Question 28. It is one of the objective questions from the 2017 Neco Computer Studies examination.

Difficulty level: Hard .

Master the Exam!

You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.

Unlock Full Access Available for Android & Windows
Chat with Support