logo

CuriousTab

CuriousTab

Discussion


Home C Programming Functions Comments

  • Question
  • A function cannot be defined inside another function


  • Options
  • A. True
  • B. False

  • Correct Answer
  • True 

    Explanation
    A function cannot be defined inside the another function, but a function can be called inside a another function.

    Functions problems


    Search Results


    • 1. Functions cannot return more than one value at a time

    • Options
    • A. True
    • B. False
    • Discuss
    • 2. In C all functions except main() can be called recursively.

    • Options
    • A. True
    • B. False
    • Discuss
    • 3. What will be the output of the program?
      #include<stdio.h>
      #include<stdlib.h>
      
      int main()
      {
          int i=0;
          i++;
          if(i<=5)
          {
              printf("CuriousTab");
              exit(1);
              main();
          }
          return 0;
      }
      

    • Options
    • A. Prints "CuriousTab" 5 times
    • B. Function main() doesn't calls itself
    • C. Infinite loop
    • D. Prints "CuriousTab"
    • Discuss
    • 4. What will be the output of the program?
      #include<stdio.h>
      int check(int);
      int main()
      {
          int i=45, c;
          c = check(i);
          printf("%d\n", c);
          return 0;
      }
      int check(int ch)
      {
          if(ch >= 45)
              return 100;
          else
              return 10;
      }
      

    • Options
    • A. 100
    • B. 10
    • C. 1
    • D. 0
    • Discuss
    • 5. What will be the output of the program?
      #include<stdio.h>
      int check (int, int);
      
      int main()
      {
          int c;
          c = check(10, 20);
          printf("c=%d\n", c);
          return 0;
      }
      int check(int i, int j)
      {
          int *p, *q;
          p=&i;
          q=&j;
          i>=45? return(*p): return(*q);
      }
      

    • Options
    • A. Print 10
    • B. Print 20
    • C. Print 1
    • D. Compile error
    • Discuss
    • 6. If return type for a function is not specified, it defaults to int

    • Options
    • A. True
    • B. False
    • Discuss
    • 7. A function may have any number of return statements each returning different values.

    • Options
    • A. True
    • B. False
    • Discuss
    • 8. Functions can be called either by value or reference

    • Options
    • A. True
    • B. False
    • Discuss
    • 9. Names of functions in two different files linked together must be unique

    • Options
    • A. True
    • B. False
    • Discuss
    • 10. If a function contains two return statements successively, the compiler will generate warnings. Yes/No?

    • Options
    • A. Yes
    • B. No
    • Discuss


    Comments

    There are no comments.

Enter a new Comment