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

12/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>
void main()
{
    float x = 0.1;
    printf("%d, ", x);
    printf("%f", x);
}

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 x = 4, y, z;
    y = --x;
    z = x--;
    printf("%d%d%d", x,  y, z);
}

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 = 0, z = 3;
    x > y ? printf("%d", z) : return z;
}

Select an option to see the answer and solution.

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;
}

Select an option to see the answer and solution.

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());
}

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++) ? 2 : y == 1 && x;
    printf("%d\n", z);
    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()
{
    char a = 'a';
    int x = (a % 10)++;
    printf("%d\n", x);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    1 < 2 ? return 1 : return 2;
}

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 = 3; //, y = 2;
    const int *p = &x;
    *p++;
    printf("%d\n", *p);
}

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 = 2 + 3 - 4 + 8 -  5 % 4;
    printf("%d\n", a);
}

Select an option to see the answer and solution.

C99 standard guarantees uniqueness of . . . . . . . . characters for internal 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 k = 0;
    double b = k++ + ++k + k--;
    printf("%d", k);
}

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 k = 8;
    int m = 7;
    k < m ? k = k + 1 : m = m + 1;
    printf("%d", k);
}

Select an option to see the answer and solution.

Which of the following is not a valid variable name declaration?

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 = 3;
    int b = ++a + a++ + --a;
    printf("Value of b is %d", b);
}

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

Select an option to see the answer and solution.

Which is valid C expression?

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 = 1, b = 2, c = 3, d = 4, e;
    e = c + d = b * a;
    printf("%d, %d\n", e, d);
}

Select an option to see the answer and solution.

While swapping 2 numbers what precautions to be taken care?
b = (b / a);
a = a * b;
b = a / b;

Select an option to see the answer and solution.

What is the problem in the following variable declaration?
float 3Bedroom-Hall-Kitchen?;

Select an option to see the answer and solution.