GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2024 set1

GATE 2024 set1 · CS · MSQ · 2 marks · Programming and Data Structures › C Programming Fundamentals

GATE 2024 set1 Computer Science and Information Technology question: Consider the following C function definition. code Which of the following statements…

Consider the following C function definition.

int f(int x, int y) {
  for (int i=0; i<y; i++) {
    x=x+x+y;
  }
  return x;
}

Which of the following statements is/are TRUE about the above function?

  1. (A)

    If the inputs are x=20, y=10, then the return value is greater than

  2. (B)

    If the inputs are x=20, y=20, then the return value is greater than

  3. (C)

    If the inputs are x=20, y=10, then the return value is less than

  4. (D)

    If the inputs are x=10, y=20, then the return value is greater than

Show answer

Official answer: B,D

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion