GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2023

GATE 2023 · CS · MSQ · 2 marks · Algorithms › Asymptotic Notation

GATE 2023 Computer Science and Information Technology question: Consider functions Function 1 and Function 2 expressed in pseudocode as follows:…

Consider functions Function_1 and Function_2 expressed in pseudocode as follows:

Function_1 Function_2
```
while n > 1 do
for i = 1 to n do
    x = x + 1;
end for
n = ⌊n/2⌋;

end while
|
for i = 1 to 100 * n do
x = x + 1;
end for


Let  and  denote the number of times the statement “” is executed in **Function_1** and **Function_2**, respectively.

Which of the following statements is/are TRUE?
  1. (A)

  2. (B)

  3. (C)

  4. (D)

Show answer

Official answer: A,D

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion