logo

CuriousTab

CuriousTab

Discussion


Home C Programming Functions Comments

  • Question
  • Is it true that too many recursive calls may result into stack overflow?


  • Options
  • A. Yes
  • B. No

  • Correct Answer
  • Yes 

    Explanation
    Yes, too many recursive calls may result into stack overflow. because when a function is called its return address is stored in stack.

    After sometime the stack memory will be filled completely. Hence stack overflow error will occur.


    Functions problems


    Search Results


    • 1. Usually recursion works slower than loops.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 2. In a function two return statements should never occur.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 3. Will the following functions work?
      int f1(int a, int b)
      {
          return ( f2(20) );
      }
      int f2(int a)
      {
          return (a*a);
      }
      

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 4. Every function must return a value

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 5. Maximum number of arguments that a function can take is 12

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 6. What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          char *str;
          str = "%d\n";
          str++;
          str++;
          printf(str-2, 300);
          return 0;
      }
      

    • Options
    • A. No output
    • B. 30
    • C. 3
    • D. 300
    • Discuss
    • 7. What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          char *str;
          str = "%s";
          printf(str, "K\n");
          return 0;
      }
      

    • Options
    • A. Error
    • B. No output
    • C. K
    • D. %s
    • Discuss
    • 8. What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          char str1[] = "India";
          char str2[] = "CURIOUSTAB";
          char *s1 = str1, *s2=str2;
          while(*s1++ = *s2++)
              printf("%s", str1);
      
          printf("\n");
          return 0;
      }
      

    • Options
    • A. CuriousTab
    • B. BndiaBIdiaCURIOUSTABia
    • C. India
    • D. (null)
    • Discuss
    • 9. What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
      #include<stdio.h>
      
      int main()
      {
          int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
          printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
          return 0;
      }
      

    • Options
    • A. 448, 4, 4
    • B. 520, 2, 2
    • C. 1006, 2, 2
    • D. Error
    • Discuss
    • 10. What will be the output of the program assuming that the array begins at location 1002?
      #include<stdio.h>
      
      int main()
      {
          int a[2][3][4] = { {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2}, 
                             {2, 1, 4, 7, 6, 7, 8, 9, 0, 0, 0, 0} };
          printf("%u, %u, %u, %d\n", a, *a, **a, ***a);
          return 0;
      }
      

    • Options
    • A. 1002, 2004, 4008, 2
    • B. 2004, 4008, 8016, 1
    • C. 1002, 1002, 1002, 1
    • D. Error
    • Discuss


    Comments

    There are no comments.

Enter a new Comment