echo '' ;

C Quiz-4

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:

  1. Preparation for Interviews: C programming quizzes often include questions similar to those asked in technical interviews for software development positions. Participating in quizzes can help individuals prepare for such interviews and increase their confidence in discussing C-related topics.
  2. Community Engagement: Online platforms that host C quizzes often have forums or communities where participants can discuss questions, share insights, and learn from each other. Engaging with a community can broaden one’s perspective and provide additional learning resources.

C Quiz 01 to 07

Ques 1 : what is the output of following program?

void main()
{
    int a;
    float f;
    a=12/5;
    f=12/5;
    printf("%d%f",a,f);
}

(A) 2,2.000000

(B) 2,2.00

(C) 2,2

(D) none of these

(A) 2,2.000000



Ques 2 :

What will be output when you will execute 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



Ques 3 :

What will be output when you will execute following code?

void main()
{
    int a;
    a=5;
    if(a=15)
        printf("welcome%d",a);
    else
        printf("hello%d"a);
}

(A) welcome 5

(B) welcome 15

(C) hello 5

(D) hello 15

Answer : welcome 15



Ques 4 : what is the output of 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


Ques 5 : what is the output of following program?

void main()
{
    int a;
    a=100;
    printf("%d%d",++a,a++);
}

(A) 101 101

(B) 101 102

(C) 102 100

(D) 102 101

Answer : 102 100



Ques 6 :

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

main()
{
    char s1[]="Cisco"
    char s2[]= "systems";
    printf("%s",s1);
}

(A) system

(B) error

(C) Cisco

(D) Compilation fail


Ques 7 : What is the output of following program?

void f1()
{
    static int s=5;
    ++s;
    printf("%d",s);
}

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

(A) 5 6

(B) 6 6

(C) 6 7

(D) 5 5

Answer : 6 7



C Quiz 08 to 14

Ques 8 : what is the output of following program?

void main()
{
    printf("%d%d",47%5,47%-5);
    printf("%d%d%d",-47%5,-47%-5,5%7);
}

(A) 2,-2,-2,-2,5

(B) 2,2,-2,-2,5

(C) 2,-2,2,-2,5

(D) 2,2,-2,-2,0

Answer : 2,2,-2,-2,5



Ques 9 : What is the output of following program?

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

(A) 1 2 3 4 5 6 ……………….infinite

(B) 1 2 3 4 5 5 ……………….infinite

(C) 1 2 3 4 4 4 ……………….infinite

(D) 1 2 3 4 4 3 ……………….infinite

Answer : 1 2 3 4 4 4 ……………….infinite



Ques 10 :

Which of the following is integral data type?

(A) void

(B) char

(C) float

(D) double


Ques 11 : What is the output of the following program?

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

}

(A) 2 11

(B) 1 11

(C) 2 12

(D) 1 12

Answer : 1 12



Ques 12 : What is the output of the following code?

#include "stdio.h"
extern int a;
main()
{
    void fun();
    printf("\n a=%d",a);
    fun();
    return 0;
}

int a=7;

void fun()
{
     printf("\n in fun a=%d",a);
}

(A) a=0 in fun a=0

(B) a=7 in fun a=7

(C) a=7 in fun a=0

(D) error

Answer : a=7 in fun a=7



Ques 13 :

What will be output of following program?

#include<stdio.h>
int main()
{
    int a = 320;
    char *ptr;
    ptr =( char *)&a;
    printf("%d ",*ptr);
    return 0;
}

(A) 2

(B) 64

(C) 320

(D) None of above



Ques 14 : What is the output of following program?

void main()
{
    int a;
    a='a'>'A';
    printf("%d",a);
}

(A) 0

(B) 1

(C) garbage

(D) none of these



C Quiz 15 to 20

Ques 15 : 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

Answer : 11 12 13 14 15 16 27



Ques 16 :

What will be output of following program?

void convention(int,int,int);

int main()
{
    int a=5;
    convention(a,++a,a++);
    return 0;
}

void  convention(int p,int q,int r)
{
    printf("%d %d %d",p,q,r);
}

(A) 5 6 5

(B) 6 7 5

(C) 7 7 5

(D) 6 6 5

Answer : 7 7 5



Ques 17 : What is the output of following program?

void main()
{
    int i;
    for(i=1;i++<=1;i++)
    for(i++;i++<=6;i++)
    i++;
    printf("%d",i);
}

(A) 11

(B) 12

(C) 13

(D) none of these

Answer : 12



Ques 18 : What is the output of following program?

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

(A) 4

(B) 5

(C) 6

(D) nothing display on screen

Answer : 5



Ques 19 :

What will be output when you will execute following code?

void main()
{
    printf("%d",-2&&2);
}

(A) 0

(B) 1

(C) -2

(D) 2

Answer : 1



Ques 20 : What is the output of the following program?

void main()
{ 
    int a,b;
    a=b=1;
    a=a++ + ++b;
    b=b++ + ++a;
    printf("%d%d",a,b);
}

(A) 4 7

(B) 5 7

(C) 4 8

(D) 5 8

Answer : 5 8



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