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

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

Select an option to see the answer and solution.

What will be the output of the following C code?
main()
{
    enum resut {pass, fail};
    enum result s1,s2;
    s1=pass;
    s2=fail;
    printf("%d",s1);
}

Select an option to see the answer and solution.

What will be the output of the following C code snippet?
#include <stdio.h>
void main()
{
    unsigned int x = -5;
    printf("%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 = 5 * 3 + 2 - 4;
    printf("%d", a);
}

Select an option to see the answer and solution.

All keywords in C are in . . . . . . . .

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 = 4;
    int *const p = &k;
    int r = 3;
    p = &r;
    printf("%d", p);
}

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 c = 2 ^ 3;
    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 = 1;
    int y =  x == 1 ? getchar(): 2;
    printf("%d\n", y);
}

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 y = 0;
    if (1 |(y = 1))
        printf("y is %d\n", y);
    else
        printf("%d\n", y);
 
}

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 y = 1;
    if (y & (y = 2))
        printf("true %d\n", y);
    else
        printf("false %d\n", y);

}

Select an option to see the answer and solution.

The following C code can be rewritten as . . . . . . . .
c = (n) ? a : b;

Select an option to see the answer and solution.

Which of the following is a User-defined data type?

Select an option to see the answer and solution.

Which of the following declaration is illegal?

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';
    char b = 'B';
    int c = a + b % 3 - 3 * 2;
    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 i = 10;
    int *p = &i;
    printf("%d\n", *p++);
}

Select an option to see the answer and solution.

What will be the data type of the result of the following operation?
(float)a * (int)b / (long)c * (double)d

Select an option to see the answer and solution.

Which among the following are the fundamental arithmetic operators, i.e, performing the desired operation can be done using that operator only?

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 p = 10, q = 20, r;
    if (r = p = 5 || q > 20)
        printf("%d", r);
    else
        printf("No Output\n");
}

Select an option to see the answer and solution.

Which of the following statement is false?

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

Select an option to see the answer and solution.