C Language MCQ’S | Functions

Exercise ::

Functions – Find Output of Program
Functions – General Questions
Functions – Find Output of Program
Functions – Point Out Errors
Functions – Point Out Correct Statements
Functions – True / False Questions
Functions – Yes / No Questions

6.
What will be the output of the program?

#include<stdio.h>
int fun(int);

int main()
{
    int a=30;
    fun(a);
    printf(" %d",a);
    return 0;
}
int fun(int b)
{
    b=50;
    printf("%d",b);
}

A. 50, 30
B. 30, 50
C. 30, 30
D. None

7.
What will be the output of the program?

#include<stdio.h>
int fun(int);

int main()
{
    int a=300;
    printf(" %d",a);
    fun(a);
    return 0;
}
int fun(int b)
{
    b=350;
    printf(" %d",b);
}

A. 350, 300
B. 300, 350
C. 300, 300
D. 350 350

8.
What will be the output of the program?

#include<stdio.h>
int reverse(int);

int main()
{
    int no=5;
    reverse(no);
    return 0;
}
int reverse(int no)
{
    if(no == 0)
        return 0;
    else
        printf("%d,", no);
    reverse (no--);
}


A. Print 5, 4, 3, 2, 1
B. Print 1, 2, 3, 4, 5
C. Print 5, 4, 3, 2, 1, 0
D. Infinite loop

9.
What will be the output of the program?

#include<stdio.h>
int fun(int p,int q);

int main()
{
    int a=15,b=20,c;
    c=fun(a,b);
    printf("%d",c);
    return 0;
}
int fun(int p,int q)
{
    return(p>q?p:q);
}

A. 10
B. 15
C. 20
D. none

10.
What will be the output of the program?

#include<stdio.h>
int fun(int p,int q);

int main()
{
    int a=15,b=20,c;
    c=fun(a,b);
    printf("%d",c);
    return 0;
}
int fun(int p,int q)
{
    return(p>q?p*p:q*q);
}

A. 100
B. 225
C. 400
D. 200