C MCQ Questions and Answers on Functions and Pointers 3

Image

Study C MCQ Questions and Answers on Functions and Pointers. Questions are on Recursion, Pass by Value and Pass By Reference. Attend C technical interviews easily after reading these Multiple Choice Questions.

Go through C Theory Notes on Functions before reading questions.



1) What are the data type of variables that can be returned by a C Function.?
A) int, float, double, char
B) struct, enum
C) Pointers to variables, arrays, functions, struct variables, enum variables etc
D) All the above
Answer [=]
Answer[=]
2) What is the output of a C Program with functions and pointers.?
void texas(int *,int *);
int main()
{
    int a=11, b=22;
    printf("Before=%d %d, ", a, b);
    texas(&a, &b);
    printf("After=%d %d", a, b);
    
    return 0;
}
void texas(int *i, int *j)
{
    *i = 55;
    *j = 65;
}
A) Before=11 22, After=11 22
B) Before=11 22, After=55 65
C) Before=11 22, After=0 0
D) Compiler error
Answer [=]
Answer[=]
3) What is the output of C Program with functions.?
int main()
{
    int a = 66;
    printf("%d %d %d,\n", a, ++a, a++);
    a = 66;
    printf("%d %d %d,\n", ++a, a++, a);
    a = 66;
    printf("%d %d %d", ++a, a, a++);
    return 0;
}
A)
68 68 66,
68 66 66,
68 68 66
B)
68 68 66,
66 66 68,
68 68 66
C)
68 68 66,
68 66 68,
68 68 66
D)
68 68 66,
68 66 68,
68 68 68
Answer [=]
Answer[=]
4) What is the output of a C program.?
int main()
{
    int a = 1;
    printf("%d %d %d,\n", a, ++a, a++);
    a = 1;
    printf("%d %d %d,\n", ++a, a++, a);
    a = 1;
    printf("%d %d %d", ++a, a, a++);
    return 0;
}
A)
3 3 1,
3 3 3,
3 3 1
B)
3 1 1,
3 1 3,
3 3 1
C)
3 3 1,
3 1 3,
3 1 1
D)
3 3 1,
3 1 3,
3 3 1
Answer [=]
Answer[=]
5) What is the output of a C Program.?
void show(int,int,int);
int main()
{
    int a = 1;
    show(++a, a++, a);
    return 0;
}
void show(int i, int j, int k)
{
    printf("%d %d %d,\n", i, j, k);
}
A)
1 1 3,
B)
3 1 3,
C)
3 1 1,
D)
3 3 3,
Answer [=]
Answer[=]
6) What is the output of C Program with pointers.?
int main()
{
    int a = 4;
    int *p;
    p=&a;
    while(*p > 0)
    {
        printf("%d ", *p);
        (*p)--;
    }
    return 0;
}
A) 0 0 0 0
B) 4 4 4 4
C) 4 3 2 1
D) Compiler error
Answer [=]
Answer[=]
7) What is the output of C Program with functions.?
void show();
int show();
int main()
{
    printf("ANT\n");
    return 0;
}
void show()
{
     printf("Integer") ;
}
int show()
{
    printf("Void");
}
A) ANT
B) Integer
C) Void
D) Compiler error
Answer [=]
Answer[=]


 

8) What is the output of C Program with functions.?
void show(int);
void show(float);
int main()
{
    printf("ANT\n");
    return 0;
}
void show(int a)
{
     printf("Integer") ;
}
void show(float b)
{
    printf("Void");
}
A) Integer Void
B) ANT Integer Void
C) ANT
D) Compiler error
Answer [=]
Answer[=]
9) What is the output of C Program with pointers.?
int main()
{
    int a=10;
    int *p, **q;
    p=&a;
    q=&p;
    printf("%d ", a);
    *p=15;
    printf("%d ", a);
    **q=20;
    printf("%d ", a);
    return 0;
}
A) 10 10 10
B) 10 0 0
C) 10 15 20
D) Compiler error
Answer [=]
Answer[=]
10) What is the output of C Program with pointers.?
int main()
{
    int a=20;
    int *p, *q;
    p=&a;
    q=p;
    printf("%d ", a);
    *p=30;
    printf("%d ", a);
    *q=40;
    printf("%d ", a);
    return 0;
}
A) 20 0 0
B) 20 20 20
C) 20 30 40
D) Compiler error
Answer [=]
Answer[=]
11) What is the output of C Program with pointers.?
int main()
{
    int a=20;
    //a memory location=1234
    printf("%d %d %d", a, &a, *(&a));
    return 0;
}
A) 20 20 20
B) 20 1234 1234
C) 20 1234 20
D) 20 20 20
Answer [=]
Answer[=]
12) What is the output of C Program with functions.?
int main()
{
    int a=20;
    printf("CINEMA ");
    return 1;
    printf("DINOSAUR");
    return 1;
}
A) CINEMA DINOSAUR
B) CINEMA
C) DINOSAUR
D) Compiler error
Answer [=]
Answer[=]
13) What is the output of C Program with recursive function.?
int sum(int);
int main()
{
    int b;
    b = sum(4);
    printf("%d", b);
    
}
int sum(int x)
{
    int k=1;
    if(x<=1)
     return 1;
    k = x + sum(x-1);
    return k;
}
A) 10
B) 11
C) 12
D) 15
Answer [=]
Answer[=]
14) What is the output of C Program with Recursive Function.?
int mul(int);
int main()
{
    int b;
    b = mul(3);
    printf("%d", b);
}
int mul(int x)
{
    if(x<=1)
     return 1;
    return (x * mul(x-1));
}
A) 2
B) 3
C) 6
D) 1
Answer [=]
Answer[=]


 

15) A recursive function can be replaced with __ in c language.
A) for loop
B) while loop
C) do while loop
D) All the above
Answer [=]
Answer[=]
16) A recursive function is faster than __ loop.
A) for
B) while
C) do while
D) None of the above
Answer [=]
Answer[=]
17) A recursive function without If and Else conditions will always lead to.?
A) Finite loop
B) Infinite loop
C) Incorrect result
D) Correct result
Answer [=]
Answer[=]
18) What is the C keyword that must be used to achieve expected result using Recursion.?
A) printf
B) scanf
C) void
D) return
Answer [=]
Answer[=]
19) How many functions are required to create a recursive functionality.?
A) One
B) Two
C) More than two
D) None of the above
Answer [=]
Answer[=]
20) Choose a correct statement about Recursive Function in C language.
A) Each recursion creates new variables at different memory locations
B) There is no limit on the number of Recursive calls
C) Pointers can also be used with Recursion but with difficulty.
D) All the above
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Some good C Books

Book Price
1. C: The Complete Reference  Check Price
2. Let Us C Check Price
3. Programming in ANSI C Check Price
4. The C Programming Language Check Price

We may get some affiliate commission for the above purchases.