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

11/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("C programming %s", "Class by\n%s Shyam", "WOW");
}

Select an option to see the answer and solution.

function tolower(c) defined in library works for . . . . . . . .

Select an option to see the answer and solution.

Associativity of an operator is . . . . . . . .

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 = 8;
    b++;
    printf("%lf", b);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
enum class
{
    a,b,c
};
enum class m;
main()
{
    printf("%d",sizeof(m));
}

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

Select an option to see the answer and solution.

What will be the data type of the following expression? (Initial data type: a = int, var1 = double, var2 = float)
expression (a < 50)? var1 : var2;

Select an option to see the answer and solution.

Why do variable names beginning with the underscore is not encouraged?

Select an option to see the answer and solution.

Which of the following method is accepted for assignment?

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 = 10000;
        int y = 34;
        printf("Hello World! %d\n", y);
        return 0;
    }

Select an option to see the answer and solution.

Which of the following is NOT possible with any 2 operators in C?

Select an option to see the answer and solution.

What will be the final value of c in the following C code snippet? (Initial values: a = 1, b = 2, c = 1)
c += (-c) ? a : b;

Select an option to see the answer and solution.

Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.

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 = 5.3 % 2;
    printf("Value of 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 const k = 5;
    k++;
    printf("k is %d", k);
}

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

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 + 2 * 5;
    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>
enum Shyam
{
    a,b,c=5
};
enum Shyam s;
main()
{
    c++;
    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()
{
    const int i = 10;
    int *ptr = &i;
    *ptr = 20;
    printf("%d\n", i);
    return 0;
}

Select an option to see the answer and solution.