Vidyalelo
C Programming · all questions

Function
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

223

Questions

4/12

Page

Pick an option on a question to see the right answer and solution.

Which of following is not accepted in C?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int *m();
void main()
{
    int k = m();
    printf("%d", k);
}
int *m()
{
    int a[2] = {5, 8};
    return a;
}

Select an option to see the answer and solution.

Global variables are . . . . . . . .

Select an option to see the answer and solution.

What is the scope of an automatic variable?

Select an option to see the answer and solution.

What will be the output of the following C code having void return-type function?
#include <stdio.h>
void foo()
{
    return 1;
}
void main()
{
    int x = 0;
    x = foo();
    printf("%d", x);
}

Select an option to see the answer and solution.

If the file name is enclosed in double quotation marks, then . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void foo();
int main()
{
    void foo();
    foo();
    return 0;
}
void foo()
{
    printf("2 ");
}

Select an option to see the answer and solution.

Which of the following storage class supports char data type?

Select an option to see the answer and solution.

register keyword mandates compiler to place it in machine register.

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define SYSTEM 20
int main()
{
    int a = 20;
    #if SYSTEM == a
    printf("HELLO ");
    #endif
    #if SYSTEM == 20
    printf("WORLD\n");
    #endif
}

Select an option to see the answer and solution.

Functions have static qualifier for its declaration by default.

Select an option to see the answer and solution.

Can we use a function as a parameter of another function? [Eg: void wow(int func())].

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    static int x;
    if (x++ < 2)
    main();
}

Select an option to see the answer and solution.

Assignment statements assigning value to local static variables are executed only once.

Select an option to see the answer and solution.

The #else directive is used for . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void foo(auto int i);
int main()
{
    foo(10);
}
void foo(auto int i)
{
    printf("%d\n", i );
}

Select an option to see the answer and solution.

Conditional inclusion can be used for . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    {
        int x = 8;
    }
    printf("%d", x);
}

Select an option to see the answer and solution.

Comment on the output of the following C code.
#include <stdio.h>
#define var 20);
int main()
{
    printf("%d\n", var
}

Select an option to see the answer and solution.

What will be the sequence of allocation and deletion of variables in the following C code?
#include <stdio.h>
int main()
{
    int a;
    {
        int b;
    }
}

Select an option to see the answer and solution.