C Fundamentals MCQs

303 questionsC-ProgramPage 25 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 217easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 2, y = 0;
    int z = x && y = 1;
    printf("%d\n", z);
}
Question 218easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int b = 5 - 4 + 2 * 5;
    printf("%d", b);
}
Question 219easy
What will be the output of the following C code?
#include<stdio.h>
enum Shyam
{
    a,b,c=5
};
enum Shyam s;
main()
{
    c++;
    printf("%d",c);
}
Advertisement
Question 220easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    const int i = 10;
    int *ptr = &i
    *ptr = 20;
    printf("%d\n", i);
    return 0;
}
Question 221easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    float x = 0.1;
    printf("%d, ", x);
    printf("%f", x);
}
Question 222easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 4, y, z;
    y = --x;
    z = x--;
    printf("%d%d%d", x,  y, z);
}
Advertisement
Question 223easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int x = 1, y = 0, z = 3;
    x > y ? printf("%d", z) : return z;
}
Question 224easy
Comment on the output of the following C code.
#include <stdio.h>
int main()
{
    int i, n, a = 4;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        a = a * 2;
}
Question 225easy
What will be the final values of i and j in the following C code?
#include <stdio.h>
int x = 0;
int f()
{
    if (x == 0)
        return x + 1;
    else
        return x - 1;
}
int g()
{
    return x++;
}
int main()
{
    int i = (f() + g()) || g();
    int j = g() || (f() + g());
}