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

8/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>
int main()
{
    int i = 1;
    if (i++ && (i == 1))
        printf("Yes\n");
    else
        printf("No\n");
}

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 a = -5;
    int k = (a++, ++a);
    printf("%d\n", k);
}

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 i = 0;
    int j = i++ + i;
    printf("%d\n", j);
}

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 var = 010;
    printf("%d", var);
}

Select an option to see the answer and solution.

The keyword typedef cannot be used to give alias names to pointers.

Select an option to see the answer and solution.

What will be the output of the following C code if the code is executed on a 32 bit platform?
#include <stdio.h>
enum India
 {
    c = 0,
    d = 10,
    h = 20,
    s = 3
} a;
 
int main()
{
        a = c;
	printf("Size of enum variable = %d bytes", sizeof(a));
	return 0;
}

Select an option to see the answer and solution.

What will be the output of the following C function?
#include <stdio.h>
int main()
{
    reverse(1);
}
void reverse(int i)
{
    if (i > 5)
        exit(0);
    printf("%d\n", i);
    return reverse(i++);
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

C99 standard guarantees uniqueness of . . . . . . . . characters for external names.

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 a = -5;
    int k = (a++, ++a);
    printf("%d\n", k);
}

Select an option to see the answer and solution.

Which of the following operators has the lowest precedence?

Select an option to see the answer and solution.

Are logical operator sequence points?

Select an option to see the answer and solution.

Which expression has to be present in the following?
exp1 ? exp2 : exp3;

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 = 2;
    int b = 0;
    int y = (b == 0) ? a :(a > b) ? (b = 1): a;
    printf("%d\n", y);
}

Select an option to see the answer and solution.

Which among the following is NOT a logical or relational operator?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char a = '0';
    char b = 'm';
    int c = a && b || '1';
    printf("%d\n", c);
}

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 = 2;
    int z = x ^ y & 1;
    printf("%d\n", z);
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
    int x = 5 * 9 / 3 + 9;
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.