C Fundamentals MCQs

303 questionsC-ProgramPage 9 of 34

Practice free C Fundamentals multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 303 questions — no login required.

Question 73easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 0, y = 2;
    int z = ~x & y;
    printf("%d\n", z);
}
Question 74easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a = 4, n, i, result = 0;
    scanf("%d", &n);
    for (i = 0;i < n; i++)
    result += a;
}
Question 75easy
What will be the output of the following C code?
#include<stdio.h>
enum hello
{
    a,b=99,c,d=-1
};
main()
{
    enum hello m;
    printf("%d\n%d\n%d\n%d\n",a,b,c,d);
}
Advertisement
Question 76easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    j = 10;
    printf("%d\n", j++);
    return 0;
}
Question 77easy
What will be the output of the following C code?
#include <stdio.h>
#define MAX 2
enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX};
int main()
{
    enum bird b = PARROT;
    printf("%d\n", b);
    return 0;
}
Question 78easy
What will be the output of the following C code?
#include<stdio.h>
enum shyam
{
    a=2,b=3.56
};
enum shyam s;
main()
{
    printf("%d%d",a,b);
}
Advertisement
Question 79easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a[5] = {1, 2, 3, 4, 5};
    int i;
    for (i = 0; i < 5; i++)
        if ((char)a[i] == '5')
            printf("%d\n", a[i]);
        else
            printf("FAIL\n");
}
Question 80easy
One of the major difference between typedef and #define is that typedef interpretation is performed by the . . . . . . . . whereas #define interpretation is performed by the . . . . . . . .
Question 81easy
Which of the following typecasting is accepted by C?