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

7/12

Page

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

Which among the following is the correct syntax to declare a static variable register?

Select an option to see the answer and solution.

The below two lines are equivalent to . . . . . . . .
#define C_IO_HEADER <stdio.h>
#include C_IO_HEADER

Select an option to see the answer and solution.

Which part of the program address space is p stored in the following C code?
#include <stdio.h>
int *p;
int main()
{
    int i = 0;
    p = &i;
    return 0;
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

When compiler accepts the request to use the variable as a register?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void f();
int main()
{
    #define foo(x, y) x / y + x
    f();
}
void f()
{
    printf("%d\n", foo(-3, 3));
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the return-type of the function sqrt()?

Select an option to see the answer and solution.

Can function definition be present in header files?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
double i;
int main()
{
   printf("%g\n",i);
   return 0;
}

Select an option to see the answer and solution.

Comment on the following 2 C programs.
#include <stdio.h> //Program 1
int main()
{
    int a;
    int b;
    int c;
}

#include <stdio.h> //Program 2
int main()
{
    int a;
    {
        int b;
    }
    {
        int c;
    }
}

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;
    printf("x is %d", x);
}

Select an option to see the answer and solution.

#include <somefile.h> are . . . . . . . . files and #include "somefile.h" . . . . . . . . files.

Select an option to see the answer and solution.

What will be the output of the following C code snippet?
#include (stdio.h)
void main()
{
    printf("hello");
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Register storage class can be specified to global variables.

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following are C preprocessors?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define MIN 0
#ifdef MIN
#define MAX 10
#endif
int main()
{
    printf("%d %d\n", MAX, MIN);
    return 0;
}

Select an option to see the answer and solution.

Which of the following function declaration is illegal?

Select an option to see the answer and solution.