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

6/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()
{
    printf("examveda\r\nclass\n");
    return 0;
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following cannot be a variable name in 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 i = -3;
    int k = i % 2;
    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>
void main()
{
   int a = 5, b = -7, c = 0, d;
   d = ++a && ++b || ++c;
   printf("\n%d%d%d%d", a,  b, c, d);
}

Select an option to see the answer and solution.

Which type of conversion is NOT accepted?

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 == 1 && x : 0;
    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>
int main()
{
    int a = 10;
    double b = 5.6;
    int c;
    c = a + b;
    printf("%d", 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 = 1, y = 2;
    int z = x & y == 2;
    printf("%d\n", z);
}

Select an option to see the answer and solution.

A variable declared in a function can be used in main().

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

Select an option to see the answer and solution.

What will be the output of the following C code considering the size of a short int is 2, char is 1 and int is 4 bytes?
#include <stdio.h>
int main()
{
    short int i = 20;
    char c = 97;
    printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
    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()
{
    int x = 97;
    int y = sizeof(x++);
    printf("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>
void main()
{
    int a = 2 + 4 + 3 * 5 / 3 - 5;
    printf("%d", a);
}

Select an option to see the answer and solution.

A user defined data type, which is used to assign names to integral constants is called . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code if input given is 2?
#include<stdio.h>
enum day
{
    a,b,c=5,d,e
};
main()
{
    printf("Enter the value for a");
    scanf("%d",a);
    printf("%d",a);
}

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 b = 6;
    int c = 7;
    int a = ++b + c--;
    printf("%d", a);
}

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(); //bitwise or
    int j = g() | (f() + g()); //bitwise or
}

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 b = 5 & 4 & 6;
    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()
{
    double b = 5 & 3 && 4 || 5 | 6;
    printf("%lf", b);
}

Select an option to see the answer and solution.