Menu Close

C exam on Functions

Please enter your email:

1.

Arguments(variables inside parenthesis) of function working like

 
 
 
 

2.

Recursive functions are executed in which order

 
 
 
 

3.

Output of following Code?

#include<stdio.h>
void fun(int);
int main()
{
  int x=2;
  fun(x++);
  return 0;
}
void fun(int x)
{
  printf("%d ", x++);
}

 

 
 
 
 

4.

Output of following Code?

#include<stdio.h>
void abc(int);
int main()
{
  abc(2);
}
void abc(int a)
{
  printf("%d ",a);
  if(a)
    abc(a-1);
  printf("%d ",a);
}

 

 
 
 
 

5.

Output of following Code?

#include <stdio.h>
void abc(int);
void abc(int a)
{
  printf("%d ", ++a);
}
int main()
{
  int a=10;
  abc(++a);
  abc(a++);
  printf("%d",a);
  return 0;
}

 

 
 
 
 

6.

Output of following Code?

#include<stdio.h>
void f(int, int);
void main()
{
  int i=10;
  f(i, i++);
  printf("%d ",i);
}
void f(int i, int j)
{
  if(i>40)
    return;
  i+=j;
  f(i,j);
  printf("%d ",i);
}

 

 
 
 
 

7.

Output of following Code?

#include<stdio.h>
void fun(int);
int main()
{
  int i=3;
  fun(i);
  printf("%d ",i);
  return 0;
}
void fun(int i)
{
  ++i ;
}

 

 
 
 
 

8.

Output of following Code?

#include <stdio.h>
void xyz(int, int);
void main()
{
  int a=1;
  xyz(++a,a++);
  xyz(a++,++a);
}
void xyz(int x, int y)
{
  printf("%d %d ",x,y);
}

 

 
 
 
 

9.

Output of following Code?

#include<stdio.h>
void f1();
void f2();
void f2()
{
  printf("6 ");
}
int main()
{
  printf("3 ");
  f1();
  printf("7 ");
  f2();
  printf("2 ");
  return 0;	
}
void f1()
{
  printf("7 ");
  f2();
  printf("3 ");
}

 

 
 
 
 

10.

Output of following Code?

#include<stdio.h>
void fun(int);
int main()
{
  int x=4;
  fun(--x);
  printf("%d ", x);
  return 0;
}
void fun(int a)
{
  printf("%d ", --a);
  if(a>0)
  {
    fun(a-1);
  }
  printf("%d ", a);
}

 

 
 
 
 

Question 1 of 10