echo '' ;
C Programming Language

C Quiz-6

Participating in a C quiz can offer several benefits for individuals looking to improve their programming skills and knowledge of the C programming language. Here are some potential advantages:

  • Resume Enhancement: Mentioning participation and achievements in C quizzes on a resume or portfolio can showcase a candidate’s dedication to learning and improving their programming skills, potentially making them more attractive to employers.

C Quiz 01 to 07

Q1: What is the output of the following program?

void main()
{
    int a,b;
    for(a=b=10;a;printf("%d%d%d",a,b))
    a=b++<=12;
    printf("%d%d",a+10,b+10);
}

(A) 1 12 1 12 1 13 0 14 10 24

(B) 1 11 1 11 1 13 0 14 10 24

(C) 1 11 1 12 1 13 0 14 10 24

(D) 1 11 1 12 1 14 0 14 10 24

(B) 1 11 1 12 1 13 0 14 10 24



Q2: What is the output of the following program?

main()
{
    int a,b;
    a=b=100;
    scanf("%d%d",a,&b);    //Entered Values are 40 85
    printf("%d %d",a,b);
}

(A) 40 85

(B) 0 85

(C) 100 85

(D) 100 100

(C) 100 85



Q3: What is the output of the following program?

void f1()
{
    extern int g;
    static int s=5;
    int a;
    ++g;
    a=s++;
    printf("%d%d%d",a,s,g);
    if(a<=6)
    f1();
    printf("%d%d%d",a,s,g);
}

void f2()
{
    static int s;
    int a;
    a=++s;
    ++g;
    printf("%d%d%d",a,s,g);
    if(a<=2)
    f2();
    printf("%d%d%d",a,s,g);
}

main()
{
    f1();
    f2();
}

error: ‘g’ undeclared (first use in this function)



Q4: What will be the output when you execute the following code?

#include<stdio.h>

int main()
{
    volatile int a=11;
    printf("%d",a);
    return 0;
}

(A) 11

(B) Garbage

(C) -2

(D) We cannot predict

(A)11



Q5: What will be output when you execute the following code?

#include
const enum Alpha
{
      X,
      Y=5,
      Z
}p=10;

int main()
{
    enum Alpha a,b;
    a= X;
    b= Z;
    printf("%d",a+b-p);
    return 0;
}

(A) -4

(B) -5

(C) 10

(D) 11

(A) -4



Q6: What is the output of the following program?

void main()
{
    int i=10;
    printf("%d%d%d",++i, i++, ++i);
}

(A) 11 11 13

(B) 13 11 11

(C) 11 12 13

(D) 13 12 11

(B) 13 11 11



Q7: What will be the output

main()
{
    int i, j, *ptr, *ptr1;
    i = 10;
    j = 10;
    ptr = &i;
    ptr1 = &j;
    if(ptr == ptr1)
    {
        printf("True");
    }
    else
    {
         printf("False");
    }
}

(A) True

(B) False

(C) Syntax Error

(D) Run time Error

(B) False



C Quiz 08 to 14

Q8: what will be the output when the following code is executed

int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);

(A) 12,11,11,11

(B) 12,10,11,13

(C) 22,10,11,13

(D) 22,13,13,13

(D) 22,13,13,13



Q9: What is the output of the following program?

void main()
{
    float a;
    a=8.5;
    if(a==8.5)
        printf("1");
    else
        printf("2");
}

(A) 1

(B) 2

(C) error

(D) none of these

(A) 1



Q10: What will be the output

main()
{
    if(1,0)
    {
         printf("True");
    }
    else
    {
         printf("False");
    }
}

(A) True

(B) False

(C) Compilation Error

(D) Run time Error

(B) False



Q11: How many times the below loop will get executed?

main()
{
    int i;
    for(i=9;i;i=i-2)
    {
        printf("\n%d",i);
    }
}

(A) 5

(B) 6

(C) Compilation Error

(D) Infinite

(D) Infinite



Q12: What is the output of the following program?

void main()
{
    int a;
    a=10;
    while(a++<=15)
    printf("%d",a);
    printf("%d",a+10);
}

(A) 10 11 12 13 14 15 16

(B) 11 12 13 14 15 16 27

(C) 10 11 12 13 14 15 25

(D) 11 11 12 13 14 15 25

(C) 11 12 13 14 15 16 27



Q13: What is the output of the following program?

void main()
{
    int a;
    a=1;
    while(a<=1)
    if(a%2)
    printf("%d",a++);
    else
    printf("%d",++a);
    printf("%d",a+10);
}

(A) 0 11

(B) 0 12

(C) 1 11

(D) 1 12

(D) 1 12



Q14: How many times the below loop will get executed?

main()
{
    int i;
    for(i=20, i=10; i<=20; i++)
    {
        printf("\n %d", i);
    }
}

(A) 1

(B) Run time Error

(C) 11

(D) Compilation Error

(E) 10,11…19,20

(E) 10,11…19,20



C Quiz 15 to 20

Q15: What is the output of the following program?

void main()
{
    int a;
    a=1;
    while(a<=10)
    {
        printf("%d",a);
        if(a>3)
        break;
        a++;
    }
    printf("%d",a+10);
}

(A) 1 2 3 4 13

(B) 1 2 3 3 14

(C) 1 2 3 3 13

(D) 1 2 3 4 14

(B) 1 2 3 4 14



Q16: What is the output of the following program?

void main()
{
    a=3.5;
    printf("%d",a);
}

(A) 3.5

(B) 3

(C) error

(D) garbage

(C) error



Q17: What will be the output of the following c program?

#include "stdio.h"
int main()
{
    int _ = 5;
    int __ = 10;
    int ___;
    ___ = _ + __;
    printf("%i", ___);
    return 0;
}

(A) 5

(B) 10

(C) 15

(D) Compilation Error

(C) 15



Q18: What will be printed as the result of the operation below:

#define swap(a,b) a=a+b;b=a-b;a=a-b;
void main()
{
    int x=5, y=10;
    swap (x,y);
    printf("%d %d",x,y);
    swap2(x,y);
    printf("%d %d",x,y);
}

int swap2(int a, int b)
{
    int temp;
    temp=a;
    b=a;
    a=temp;
    return 0;
}

(A) 5,10

(B) 10,5

(C) 0,5

(D) 10,0

(B) 10,5



Q19: What is the output of the following program?

void main()
{
    printf("%d%d",100,200,300);
}

(A) 100 200

(B) 200 300

(C) 300 200

(D) 100 200 300

(A) 100 200



Q20: What is the output of the following program?

void main()
{
    printf("1");
    goto XYZ;
    printf("2");
    XYZ:
    printf("3");
}

(A) 1 2

(B) 2 3

(C) 1 3

(D) 3 1

(C) 1 3



Next

It’s important to note that while quizzes can be beneficial, they are just one aspect of a comprehensive learning strategy. Practical application, hands-on coding, and building projects are equally important for mastering C programming or any programming language.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from ArunEworld

Subscribe now to keep reading and get access to the full archive.

Continue reading