Programming for Problem Solving (3110003) MCQs

MCQs of Functions

Showing 11 to 20 out of 29 Questions
11.
Arguments received by a function in C language are called ___
(a) Formal arguments
(b) Actual arguments
(c) Definite arguments
(d) Ideal arguments
Answer:

Option (a)

12.
What is the default return value if it is not specified in function definition?
(a) 0
(b) -1
(c) 1
(d) None of these
Answer:

Option (c)

13.
What is the output?

main()
{
    int i=abc(10);
    printf("%d",--i);
}
int abc(int i)
{
    return i++;
}

(a) 10
(b) 9
(c) 11
(d) None of these
Answer:

Option (b)

14.
Which one is the correct statement?
(a) The body of a function should have only one return statement.
(b) Function can return only one value in call by value environment.
(c) Function can return multiple values.
(d) None of these
Answer:

Option (b)

15.
Which is the complete function?
(a) int fun();
(b) int func(int x)
{
return x=x+1;
}
(c) void fun(int)
{
printf("Hello");
}
(d) void fun(x)
{
printf("Hello");
}
Answer:

Option (b)

16.
Choose the correct statement about Functions in C
(a) A Function is a group of C statements that can be reused any number of times.
(b) Every Function has a return type.
(c) Every Function may not return a value.
(d) All the these
Answer:

Option (d)

17.
What is the output?

void show();
void main()
{
    show();
    printf("WORLD ");
 }
void show()
{
    printf("HELLO ");
}

(a) WORLD HELLO
(b) HELLO WORLD
(c) WORLD
(d) Error
Answer:

Option (b)

18.
How many values can a C Function return at a time?
(a) Only one value
(b) Maximum of two values
(c) Maximum of three values
(d) Any number of values
Answer:

Option (a)

19.
What is the output?

int show()
{
    return 10;
}
void main()
{
    int a;
    printf("COUNT=");
    a=show();
    printf("%d", a);
}

(a) COUNT=
(b) COUNT=0
(c) COUNT=10
(d) Error
Answer:

Option (c)

20.
What is the output?

int show()
{
    return 15;
    return 35;
}
void main()
{
    int a;
    printf("COUNT=");
    a=show();
    printf("%d", a);
}

(a) COUNT=15
(b) COUNT=35
(c) COUNT=0
(d) Error
Answer:

Option (a)

Showing 11 to 20 out of 29 Questions