aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Programming and Data Structures - GATE Practice
  • Consider the following C function ```c int f(int n) { sta...
Multiple choice

Consider the following C function

int f(int n) {
  static int i = 1;
  if (n >= 5) return n;
  n = n + i;
  i++;
  return f(n);
}

The value returned by f(1) is

  1. 5

  2. 6

  3. 7

  4. 8

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Keep practicing — related questions

  • Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = ...
  • Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = ...
  • Consider the following C functions: int f1 (int n) { If(n == 0 | |n == 1) return n; else return(2*f1(n-1) +...
  • Consider the following C functions: int f1(int n) { If(n == 0 | | n == 1) return n; else return (2 * f1(n -...
  • Consider the following recursive C function that takes two arguments unsigned int foo (unsigned int n, unsi...
  • Consider the following recursive C function that takes two arguments unsigned int foo (unsigned int n, unsi...
  • Determine Output: int counter (int value) { static int count =0; count = count +value; return count; } main...
  • Consider the following function. int unknown (int n) { int i, j, k 0; for i n / 2; i <- n; i + +) for j = 2...
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy