GATE CS 2024, set 1 · Question 48 · Programming and Data Structures · Multiple select (MSQ) · 2 marks · no negative marks
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?
- (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 2²⁰
- (C) If the inputs are x=20, y=10, then the return value is less than 2¹⁰
- (D) If the inputs are x=10, y=20, then the return value is greater than 2²⁰
Answer
Answer (B), (D)
Answer from the official GATE CS 2024 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes