adplus-dvertising

Welcome to the Functions MCQs Page

Dive deep into the fascinating world of Functions with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Functions, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Functions, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Functions. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Functions. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Functions MCQs | Page 24 of 39

Q231.
What will be the output of the program?
#include<stdio.h>

int fun(int i)
{
    i++;
    return i;
}

int main()
{
    int fun(int);
    int i=3;
    fun(i=fun(fun(i)));
    printf("%d\n", i);
    return 0;
}
Discuss
Answer: (a).5
Q232.
What will be the output of the program?
#include<stdio.h>
int fun(int);
int main()
{
    float k=3;
    fun(k=fun(fun(k)));
    printf("%f\n", k);
    return 0;
}
int fun(int i)
{
    i++;
    return i;
}
Discuss
Answer: (a).5.000000
Q233.
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int i=0;
    i++;
    if(i<=5)
    {
        printf("Compscibits");
        exit(1);
        main();
    }
    return 0;
}
Discuss
Answer: (d).Prints "Compscibits"
Q234.
Point out the error in the program.
f(int a, int b)
{
    int a;
    a = 20;
    return a;
}
Discuss
Answer: (c).Redeclaration of a
Q235.
Point out the error in the program
#include<stdio.h>
int f(int a)
{
  a > 20? return(10): return(20);
}
int main()
{
    int f(int);
    int b;
    b = f(20);
    printf("%d\n", b);
    return 0;
}
Discuss
Answer: (c).Error: return statement cannot be used with conditional operators
Q236.
Point out the error in the program
#include<stdio.h>

int main()
{
    int a=10;
    void f();
    a = f();
    printf("%d\n", a);
    return 0;
}
void f()
{
    printf("Hi");
}
Discuss
Answer: (a).Error: Not allowed assignment
Q237.
Which of the following statements are correct about the program?
#include<stdio.h>

int main()
{
    printf("%p\n", main());
    return 0;
}
Discuss
Answer: (b).Runs infinitely without printing anything
Q238.
There is a error in the below program. Which statement will you add to remove it?
#include<stdio.h>

int main()
{
    int a;
    a = f(10, 3.14);
    printf("%d\n", a);
    return 0;
}
float f(int aa, float bb)
{
    return ((float)aa + bb);
}
Discuss
Answer: (b).Add prototype: float f(int, float)
Q239.
Which of the following statements are correct about the function?
long fun(int num)
{
    int i;
    long f=1;
    for(i=1; i<=num; i++)
        f = f * i;
    return f;
}
Discuss
Answer: (c).The function calculates the factorial value of an integer
Q240.
What is the notation for following functions?
1. int f(int a, float b)
{
/* Some code */
}

2. int f(a, b)
int a; float b;
{
/* Some code */
}
Discuss
Answer: (c).1. ANSI Notation 2. KR Notation

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!