echo '' ;
C Programming Language

C Quiz-2

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. Problem-Solving Practice: Many C quizzes include practical problem-solving questions that require participants to apply their programming knowledge to solve specific problems. This helps improve problem-solving skills and the ability to implement algorithms in C.
  2. Time Management: C Quizzes often have a time limit for each question, helping participants develop effective time management skills. This is particularly valuable in a real-world programming environment where efficient coding is essential.

C Quiz 02 to 07

Ques 2: 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 6

(D) 5 8

(C) 4,6



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

void xyz(int p1, int *p2)
{
    ++p1;
    ++*p2;
    printf("%d%d",p1,*p2);
}

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

(A) 10 11 12 13 13

(B) 11 12 13 13 14

(C) 10 11 12 12 13

(D) 11 12 13 14 14

(D) 11 12 13 14 14



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

(C) 6 7



Ques 5 :

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

(E) Error

(E) Error



Ques 6 :

Which one of the following functions is the correct choice for moving blocks of binary data that are of arbitrary size and position in memory?

(A) memset()

(B) memcpy()

(C) strncpy()

(D) memmove()

(D) memmove()



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



C Quiz 08 to 14

Ques 8 :

What will be output when you execute the following code?

#include "stdio.h"
int main()
{
    char a=250;
    int expr;
    expr= a+ !a + ~a + ++a;
    printf("%d",expr);
    return 0;
}

(A) 249

(B) 250

(C) -6

(D) 0

(C) -6



Ques 9 :

What will be the output of the following program?

main()
{
    printf(3+"Gyantonic"+4);
}

(A) ntonic

(B) tonic

(C) ic

(D) nic

(C) ic



Ques 10: How many storage class specifiers are in the “C” language?

(A) 3

(B) 4

(C) 5

(D) 6

4



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

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

(A) 2 2

(B) 2 4

(C) 2 6

(D) 2 8

(D) 2 8



Ques 13 :

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

main()
{
    int x=20,y=35;
    x=y++ + x++;
    y= ++y + ++x;
    printf("%d%d",x,y);
}

(A) 5 7 8 4

(B) 5 7 9 4

(C) 5 8 9 4

(D) 5 6 9 3

(D) 5 6 9 3



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

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

(A) 0

(B) 1

(C) error

(D) none of these

(A) 0



C Quiz 15 to 20

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

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

(A) a=0

(B) a=garbage value

(C) error

(D) none of these

(A) a=0



Ques 16: what is the output of the following program?

void main()
{
    int a=80;
    if(a++>80)
        printf("welcome%d",a);
    else
        printf("hello%d",a);
}

(A) hello 81

(B) welcome 81

(C) hello 80

(D) welcome 80

(A) hello 81



Ques 17:

What will be output when you execute the following code?

static extern int a=5;
static int b=6;
main()
{
    printf("%d",a);
    printf("%d",b);
    return 0;
}

(A) a=0 b=6

(B) a=5 b=0

(C) a=5 b=6

(D) none of these

(C) a=5 b=6



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

void xyz(int p1, int *p2)
{
    ++p1;
    ++*p2;
    printf("%d%d",p1,*p2);
}

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

(A) 10 11 13 14 14

(B) 11 12 14 15 15

(C) 12 13 15 16 16

(D) 11 12 13 14 14

(C) 12 13 15 16 16



Ques 19 :

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 )

(C) 4



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

void fun(auto int _)
{
    print("%d",_);
}

main()
{
    fun(23);
    return 0;
}

(A) 0

(B) garbage

(C) error

(D) 23

(C) Error



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