Question 9

Computer Awareness Structure of instructions in CPU Easy

Consider a computer system with speed of \(10^6\) instructions per second. A program P, having \(2n^2\) steps is run on this system, where n is the input size. If n = 10000, what is the execution time for P?

(A) 1.2 seconds
(B) 20 seconds
(C) 100 seconds
(D) 200 seconds
View Dynamic Solution & Explanation
Correct Solution: Option D

Step-by-step Solution:

The program P has 2n² steps, where n is the input size. Given that n = 10,000, we can calculate the total number of steps as:

Steps = 2 × (n²) = 2 × (10000²) = 2 × 100,000,000 = 200,000,000 steps

The system can execute 10⁶ instructions per second. Therefore, the execution time is:

Execution Time = Total Steps / Instructions per Second

Execution Time = 200,000,000 / 1,000,000 = 200 seconds

Thus, the execution time for program P is 200 seconds.