Vidyalelo
C Programming · all questions

C Fundamentals
practice.

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

303

Questions

15/16

Page

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

What will be the output of the following C code?
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer() 
{
    return example1;
}
 
int main()
{
   (answer() == a)? printf("yes"): printf("no");
   return 0;
}

Select an option to see the answer and solution.

Point out the error (if any) in the following C code?
#include<stdio.h>
enum hello
{
    a,b,c;
};
main()
{
    enum hello m;
    printf("%d",m);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = -2;
    if (!0 == 1)
        printf("yes\n");
    else
        printf("no\n");
}

Select an option to see the answer and solution.

String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int y = 1, x = 0;
    int l = (y++, x++) ? y : x;
    printf("%d\n", l);
}

Select an option to see the answer and solution.

The name of the variable used in one function cannot be used in another function.

Select an option to see the answer and solution.

Do logical operators in the C language are evaluated with the short circuit?

Select an option to see the answer and solution.

Which operators of the following have same precedence?
P. "!=", Q. "+=", R. "<<="

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 0, y = 2;
    if (!x && y)
        printf("true\n");
    else
        printf("false\n");
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    if (~0 == 1)
        printf("yes\n");
    else
        printf("no\n");
}

Select an option to see the answer and solution.

Which keyword is used to prevent any changes in the variable within a C program?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 2, y = 0;
    int z = y && (y |= 10);
    printf("%d\n", z);
    return 0;
}

Select an option to see the answer and solution.

Which of the following is not an arithmetic operation?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
enum hi{a,b,c};
enum hello{c,d,e};
main()
{
    enum hi h;
    h=b;
    printf("%d",h);
    return 0;
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    if (7 & 8)
    printf("Honesty");
        if ((~7 & 0x000f) == 8)
            printf("is the best policy\n");
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
enum Shyam
{
    a,b,c=5
};
int main()
{
    enum Shyam s;
    b=10;
    printf("%d",b);
}

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 y = 3;
    int x = 5 % 2 * 3 / 2;
    printf("Value of x is %d", x);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 1, y = 2;
    if (x && y == 1)
        printf("true\n");
    else
        printf("false\n");
}

Select an option to see the answer and solution.

Which of the following type-casting have chances for wrap around?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.