echo '' ;
C Programming Language

C Quiz-1

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. Skill Enhancement: Quizzes often cover a range of topics within C programming, allowing participants to test and enhance their skills in areas such as syntax, data types, control structures, functions, and more.
  2. Knowledge Validation: Quizzes can help individuals gauge their understanding of key concepts in C programming. By answering questions, participants can identify areas where they need to focus on improving their knowledge.

C Quiz 01 to 07

Q-01: Can a program be invoked from another program?

(A) True

(B) False

(A) True (a program can invoke another program using system calls.)



Q-02: 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

(B) Error



Q-03: How many times main()  will get called?

main()
{
       printf("\n Main Called Again");
       main();
}

(A) 1

(B) 100

(C) main can not be called recursively

(D) Infinite

(D) Infinite (There is no condition in the main() to stop the recursive calling of the main() hence it will be called infinite no of times.)



Q-04: While Loop Understanding

How many times the while loop will get executed?

main ( )
{
   int a = 1 ;
   while ( a <= 100) ;
   {
       printf ( â??%dâ??, a++ ) ;
   }
}

(A) 100

(B) 1

(C) 0

(D) Infinite

(D) Infinite



Q-05: What is the output of the following program?

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

(A) 2

(B) 3

(C) 4

(D) 5

Ans: (D) 5



Q-06: What is the output of the following program?

void abc(int a) {   ++a;  }

void main()
{
   int a=10;
   abc();
   abc();
   printf("%d",a);
}

(A) 10

(B) 11

(C) 12

(D) 13

Ans: (A) 10



Q-07: Bit Wise Operator Understanding

11 ^ 5

What does the operation shown above produce?

(A) 1

(B) 6

(C) 8

(D) 14

Ans :(D) 14



C Quiz 08 to 14

Q-08

Suppose a,b,c are integer variables with values 5,6,7 respectively. 

What is the value of the expression  : !((b+c)>(a+10)) 

(A) 1

(B) 6

(C) 15

(D) 0

Let's break down the expression and substitute the given values:

The expression is: !((b + c) > (a + 10))

Given values:

a = 5

b = 6

c = 7

Substitute these values into the expression:

!((6 + 7) > (5 + 10))

Now, perform the operations inside the parentheses:

!(13 > 15)

Finally, compare 13 and 15:

!(false)

The logical NOT (!) operator negates the result, so the final value of the expression is true.



Q-09: How many variable scopes are there in “C” language?

(A) 2

(B) 3

(C) 4

(D) 5

Ans ; (C) 4 [body, function, program and file scope in “C”. ]



Q-10 : What will be the output of the following program?

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

(A) 2

(B) 320

(C) 64

(D) Compilation Error

(C) 64



Q-11 :

What is the output of the following code?

void main()
{
    int i;
    i=0;
    if(i=15,10,5)
        printf("Programing %d",i);
    else
        printf("Skills %d",i);
    getch ();
}

(A) Skills 15

(B) Programing 5

(C) Programing 15

(D) Skills 5

(C) Programing 15



Q-12: What is the output of the following program?

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

(A) 4

(B) 5

(C) 6

(D) nothing is displayed on the screen

(B) 5



Q-13 :

What will be the output

main()
{
   int i;
   i = 10;
   printf("%d\t",5,6);
   printf("%d", i , i++);
}

(A) 5 11

(B) 6 10

(C) 6 11

(D) 5 10

(A) 5 11


C Quiz 14 to 20

Q-14: What is the output of the following program?

void abc(int a)
{
    ++a;
    printf("%d",a);
}

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

(A) 11 12 12

(B) 11 12 13

(C) 12 12 12

(D) 12 12 13

(C) 12 12 12



Q-15 :

What will be output when you execute following code?

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

(A) 5 25

(B) 25 15

(C) 25 5

(D) 25 40

(B) 25 15



Q-16: what is the output of the following program?

main()
{
    auto a;
    register r;
    static s;
    extern e;
    printf("%d",sizeof a);
    printf("%d",sizeof r);
    printf("%d",sizeof s);
    printf("%d",sizeof e);
    return 0;
}

(A) 2 4 2 4

(B) 2 2 4 2

(C) 2 2 2 2

(D) 2 4 2 2

None of the option, It will vary based on compler



Q-17: What is the output of the following program?

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

(A) 100 100 0000144 0x0064

(B) 100 100.00 0000144 0x0064

(C) 100 100 0000144 0x0032

(D) 100 100 0000127 0x0064

(A) 100 100 0000144 0x0064



Q-18: What is the output of the following program?

void main()
{
    int a=2;
    switch(a);
    {
         case 1: printf("A");
         case 2: printf("B");
         case 3: printf("C");
         break;
         case 4: printf("D");
         default: printf("E");
         break;
     }
}

(A) A B C

(B) A B C E

(C) A B C D E

(D) error

(D) Error

error: break statement not within loop or switch



Q-19: What is the output of the following program?

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

(A) 43

(B) 64

(C) 31

(D) none of these

(C) 31



Q-20: What is the output of the following program?

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

(A) 1 1 2 1

(B) 1 2 1 1

(C) 1 2 2 1

(D) 1 2 1

(D) 1 2 1



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