Gce Model Questions Vol1 2017 Computer Studies Question 8

Practice objective / multiple choice question 8 from the 2017 Gce Model Questions Vol1 Computer Studies examination.

Gce Model Questions Vol1 2017 Computer Studies Objective / Multiple Choice Medium Difficulty
Question 8 GCE_MODEL_QUESTIONS_VOL1 • 2017 • COMPUTER_STUDIES • objective

Consider the following pseudo‑code that processes an array \(A[1\ldots n]\) of integers, where \(n\) is even: ``` count = 0 for i = 1 to n: if A[i] is even: for j = i+1 to n: count = count + 1 ``` Assume exactly half of the elements are even and they occupy the first \(n/2\) positions of the array (i.e., \(A[1]\) to \(A[n/2]\) are even). Express, as a simplified function of \(n\), the total number of times the statement `count = count + 1` is executed. Then state the algorithm's time‑complexity using Big‑O notation.

Answer Options

A. (\frac{3n^{2}}{8} + \frac{n}{4}), O(n^{2})
Correct Answer B. (\frac{3n^{2}}{8} - \frac{n}{4}), O(n^{2})
C. (\frac{3n^{2}}{8} - \frac{n}{2}), O(n\log n)
D. (\frac{n^{2}}{2} - \frac{n}{2}), O(n^{2})
Correct Answer
B
Correct Option:
(\frac{3n^{2}}{8} - \frac{n}{4}), O(n^{2})

About This Question

This is Gce Model Questions Vol1 2017 Computer Studies Question 8. It is one of the objective questions from the 2017 Gce Model Questions Vol1 Computer Studies examination.

Difficulty level: Medium .

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