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 27 of 39

Q261.
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
Q262.
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"
Q263.
Point out the error in the program

f(int a, int b)
{
    int a;
    a = 20;
    return a;
}
Discuss
Answer: (c).Redeclaration of a
Q264.
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
Q265.
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
Q266.
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
Q267.
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)
Q268.
In the following 'C' code, in which order the functions would be called ?

a = ( f1(23,14 ) * f2 (12/14)) + f3 () ;
Discuss
Answer: (a).f1,f2,f3
Q269.
What error would the following function give on compilation ?
f(int a,int b)
 {
 int a;
 a = 20;
 return a;
 }
Discuss
Answer: (c).Redeclaration of a
Q270.
What will be the value retuned by the following function, when it is called with a value 11?
recur(int num)
 if ( ( num/2) !=0 )
 return ( recur(num/2 ) * 10+num%2 );
 else return 1;
Discuss
Answer: (c).1011

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!