C Quiz 5

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:

  • Continuous Learning: Regular participation in C quizzes encourages continuous learning. As programming languages evolve, staying engaged with quizzes helps individuals stay current with the latest updates and best practices in C programming.

C Quiz- 01 to 07

Ques 1 : What will be the output of the following program?

main()
{
   printf(รข??%cรข??,รข??Gyantonicรข??[4]);
}

(A) G

(B) n

(C) t

(D) none of these

Answer : t



Ques 2: How many times the below loop will get executed?

main()
{
    int i,j;
    i = 10;
    for (j=i==10 ; j<=10 ; j++)
    {
        printf(รข??\n%dรข??,j);
    }
}

(A) 1

(B) 10

(C) 11

(D) infinite loop

Answer : 10



Ques 3 :

int x[] = { 1, 4, 8, 5, 1, 4 };
int *ptr, y;
ptr  = x + 4;
y = ptr - x;

What does y in the sample code above equal?

(A) -3

(B) 0

(C) 4

(D) 4 + sizeof( int )

Answer : 4



Ques 4 : What the below statement will print if a=10

printf(“%d %d”,a, !a++); 

(A) 11 0

(B) 10 10

(C) 10 0

(D) 0 10



Ques 5 : What is the output of following program?

void f1()
{
    int a=0;
    ++a;
    printf("%d",a);
}

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

(A) 0 1 1 10

(B) 10 0 1 10

(C) 1 2 3 4

(D) 1 1 1 10

Answer : 1 1 1 10



Ques 6 : what is the output of following program?

void main()
{
    int a;
    a=1;
    while(a-->=1)
    while(a-->=0);
    printf("%d",a);
}

(A) 3

(B) -3

(C) 0

(D) error

Answer : -3



Ques 7 : What is the output of following program?

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

(A) 12

(B) 13

(C) 14

(D) nothing display on screen.

Answer : 14



C Quiz- 07 to 14

Ques 8 : Which of the following program structure/component/statement is not an example for implementation of modularization ?

(A) DLL

(B) Functions

(C) type casting



Ques 9 : 11 ^ 5 What does the operation shown above produce?

(A) 1

(B) 6

(C) 8

(D) 14

Answer : 14



Ques 10: What the below statement will print if a=10 and b = 20?

printf(“%d”,a==b);

(A) 20

(B) 10

(C) 1

(D) 0



Ques 11 : What is the output of following program?

void main()
{
    int a=89;
    int p;
    p=&a;
    *(int*)p=8;
    printf("%d",a);
    return 0;
}

(A) 7

(B) 8

(C) 89

(D) error



Ques 12 :

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 13 :

What will be the output of  the following program

main( )
{
      int gyan[] = { 10, 20, 30, 40, 50 };
      int i, *ptr ;
      ptr = gyan;
      for ( i = 0 ; i <4 ; i++ )
     {
          fun(ptr++);
          printf ( รข??\n%dรข??, *ptr ) ;
       }
  }

void fun(int *i)
{
      *i = *i + 1;
 }

(A) 11 21 31 41

(B) 20 30 40 50

(C) 21 31 41 51

(D) 10 20 30 40



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

Answer : 2,2.000000



C Quiz- 05 to 20

Ques 15 : What will be output when you will execute following code?

void main()
{
    if(!10>-10)
    printf("C");
    else
    printf("C++");
}

(A) C

(B) C++

(C) nothing display on screen

(D) none of these

Answer : C



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

Answer : 1



Ques 17 :

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

what will be the output when following code is executed

(A) 12,11,11,11

(B) 12,10,11,13

(C) 22,10,11,13

(D) 22,13,13,13

Answer : 22,13,13,13



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



Ques 19 : What is the output of following program?

void main()
{
    printf("%d%d",sizeof(10),sizeof(5,5));
}

A) 2 2

(B) 2 4

(C) 2 6

(D) 2 8

Answer : 2 8



Ques 20 : What is the output of following program?

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

(A) 1

(B) 4

(C) 5

(D) 6

Answer : 5



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.

Please turn AdBlock off, and continue learning

Notice for AdBlock users

Please turn AdBlock off