Site icon DataFlair

C Quiz to Test Your Knowledge

c quiz

C programming language offers various features and functionalities to the programmers. It has various important topics which you must know to improve your coding skills. To help you to get better at C programming, we prepared a quiz that focused on the advanced concepts and topics of the C programming language. Let’s start!!!

Time limit: 0

Quiz Summary

0 of 50 Questions completed

Questions:

Information

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading…

You must sign in or sign up to start the quiz.

You must first complete the following:

Results

Quiz complete. Results are being recorded.

Results

0 of 50 Questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 point(s), (0)

Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)

Categories

  1. Not categorized 0%
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  1. Current
  2. Review / Skip
  3. Answered
  4. Correct
  5. Incorrect
  1. Question 1 of 50
    1. Question

     What will be the output of the following program?

    int main()

    {

    int x = 0;

    while (x <= 5)

    {

    printf(“%d”, x);

    if (x > 4)

    goto func1;

    x++;

    }  

    getchar();

    return 0;

    }

     

    void foo()

    {

    func1:

    printf(“Tech”);

    }

    Correct
    Incorrect
  2. Question 2 of 50
    2. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

    char string[] = “DoNotRush!”;

    char *s1 = string, *s2 = string;     

    int x;

    for(x = 0; x < 2; x++)

    {

    printf(” %c “, *string);

    ++s1;     

    }

    for(x = 0; x < 3; x++)

    {

    printf(” %c “, *s2);

    ++s2;     

    }

    return 0;

    }

    Correct
    Incorrect
  3. Question 3 of 50
    3. Question

    Which string function should you use to split strings into a series of tokens in C?

    Correct
    Incorrect
  4. Question 4 of 50
    4. Question

     What is the output of the following program?

    #include <stdio.h>

    void func(char **ptr) { }

    int main(int argc, char **argv)

    {

       func(argv);

       getchar();

       return 0;

    }

    Correct
    Incorrect
  5. Question 5 of 50
    5. Question

     What is the output of the following program?

    #include <stdio.h>

    int func(int i)

    {

      if(i%2) return (i–);

      else return func(func(i+1));

    }

    int main()

    {

        int i;

        i = func(102);

        printf(“%d”,i);

    }

     

    Correct
    Incorrect
  6. Question 6 of 50
    6. Question

    What is the output of the following program?

    #include<stdio.h>

    int main()

    {

    static int zero=3;

    if(–zero){

    main();

    printf(“%d*0”,zero);

    }  

    }

    Correct
    Incorrect
  7. Question 7 of 50
    7. Question

      In C, when you declare two or more functions as the same name but different parameters then what is it called?

    Correct
    Incorrect
  8. Question 8 of 50
    8. Question

    What is the output of the following program?

    # include <stdio.h>

    int main()

    {

    int a=0;

    for(a=0; a<20; a++)

    {

    switch(a)

    {

    case 0:

    a+=10;

    case 1:

    a+=21;

    case 5:

    a+=4;

    default:              

    a-=1;

    break;

    }

    printf(“%d  “, a);

    }

    return 0;

    }

    Correct
    Incorrect
  9. Question 9 of 50
    9. Question

     What will be the result of the below expression?

    strcmp(‘Tech’,’TECH’);

    Correct
    Incorrect
  10. Question 10 of 50
    10. Question

     What is the output of the following program?

    #include <stdio.h>

    int main()

    {

    if (remove(“Testing.txt”) != 0)

    perror(“An error”);

    else

    puts(“A Success!”);

    return 0;

    }

    Correct
    Incorrect
  11. Question 11 of 50
    11. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

        int value = 21 << 1 << 21 >> 16 << 4;

        printf(“%d”, value);

        return 0;

    }

    Correct
    Incorrect
  12. Question 12 of 50
    12. Question

    What is the output of the following program?

    #include <stdio.h>

    int main(void)

    {

    int val;

    int data = 12;

    val = 42 || –data;

    printf(“%d %d”, val, data);

    return 0;

    }

    Correct
    Incorrect
  13. Question 13 of 50
    13. Question

    What is the output of the following program?

    #include<stdio.h>

    struct Tech

    {

        int val;

        struct Tech next_one;

    };

       

    int main()

    {

        struct Tech data;

        data.val = 25;

        data.next_one = data;

        printf(“%d”, data.next_one.val);

        return 0;

    }

    Correct
    Incorrect
  14. Question 14 of 50
    14. Question

    Which command will help you to interchange one text into another?

    Correct
    Incorrect
  15. Question 15 of 50
    15. Question

    What is the use of the function srand()?

    Correct
    Incorrect
  16. Question 16 of 50
    16. Question

    Instead of the printf(), which function do you use to print the output from the following?

    Correct
    Incorrect
  17. Question 17 of 50
    17. Question

     What is the output of the following program?

    #include<stdio.h>

    int main()

    {

      int data = 0121;

      printf(“%d”, data);

      return 0;

    }

    Correct
    Incorrect
  18. Question 18 of 50
    18. Question

    What is the output of the following program?

    #include <stdio.h>

    #define SIZE 20

    int main()

    {

    int area = SIZE*SIZE;

    printf(“%d”, area);

    return 0;

    }

    Correct
    Incorrect
  19. Question 19 of 50
    19. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

    int data;

    for (data = 1; data <= 6; data++) {

    printf(“HI”);

    if (data == 4)

    continue;

    }

    return (0);

    }

    Correct
    Incorrect
  20. Question 20 of 50
    20. Question

    What is the use of a break statement in C?

    Correct
    Incorrect
  21. Question 21 of 50
    21. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

    int val = 20;

    float val1;

    printf(“%d “, sizeof(++val – val1));

    printf(“%d “, ++val);

    return 0;

    }

    Correct
    Incorrect
  22. Question 22 of 50
    22. Question

    What is the output of the below program?

    #include <stdio.h>

    int main()

    {

    static int x = 5;

    int y = 10;

    {

    int x = 10;

    x++;

    y–;

    }

    printf(“%d %d”, x, y);

    return 0;

    }

    Correct
    Incorrect
  23. Question 23 of 50
    23. Question

    What is the output of the following program?

    #include<stdio.h>

    int main(){

    char ch = 0;

    int x = 1;

    printf(“%d”, sizeof(x) == sizeof(ch+x));

    return 0;

    }

    Correct
    Incorrect
  24. Question 24 of 50
    24. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

      char a[] = “Quiz in C”;

      printf(“%s”, a+2);

      return 0;

    }

    Correct
    Incorrect
  25. Question 25 of 50
    25. Question

     What is the number of tokens in the below statement?

    printf(“a = %d, &a = %x, x=%d”, a,&a,x);

    Correct
    Incorrect
  26. Question 26 of 50
    26. Question

     What will be the output of the following program?

    #include <stdio.h>

    #include <stdlib.h>

     

    int main()

    {

      for (int j=5; j>0; j-=2 )

      {

        printf(“%d”, j+1);

      }

      return 0;

    }

    Correct
    Incorrect
  27. Question 27 of 50
    27. Question

     What is the output of the following program?

    #include<stdio.h>

    int main()

    {

    for(int i=0;i<3;i++){

        printf(“#”);

        for(int j=1;j<1;j++){

            printf(“*”);

        }

    }

       return 0;

    }

     

    Correct
    Incorrect
  28. Question 28 of 50
    28. Question

     What is the output of the following program?

    #include<stdio.h>

     

    int main()

    {

     struct {int data;} val = {data = 2};

     printf(“%d”,val.data);

     return 0;

    }

    Correct
    Incorrect
  29. Question 29 of 50
    29. Question

     What does the below statement do?

    scanf(“%2s”, str);

    Correct
    Incorrect
  30. Question 30 of 50
    30. Question

    What is the output of the following program?

    #include<stdio.h>

     

    int main()

    {

        char *str = “Just a Quiz”;

        int num = 5;

        printf(“%.*s”, num, str);

        return 0;

    }

    Correct
    Incorrect
  31. Question 31 of 50
    31. Question

     What is the output of the following program?

    #include<stdio.h>

    struct st

    {

        int x=1021;

    };

     

    int main()

    {

        printf(“%d”, sizeof(struct st));

        return 0;

    }

    Correct
    Incorrect
  32. Question 32 of 50
    32. Question

    From below, which operator do you use to access the structure variables?

    Correct
    Incorrect
  33. Question 33 of 50
    33. Question

    What is the output of the following program?

    #include <stdio.h>

    #if X == 2

        #define Y 4

    #else

        #define Y -1

    #endif

     

    int main()

    {

        printf(“%d”, Y);

        return 0;

    }

    Correct
    Incorrect
  34. Question 34 of 50
    34. Question

    Can you guess the output of the following?

    # include <stdio.h>

    # define gets  “Hi There”

    int main()

    {

       printf(gets);

       return 0;

    }

    Correct
    Incorrect
  35. Question 35 of 50
    35. Question

     From below, which function is not safe to use if you want to read from the console?

    Correct
    Incorrect
  36. Question 36 of 50
    36. Question

     What is the output of the following code?

    #include<stdio.h>

    #define f(a,b) a##b

    int main()

    {

       int var1 = 25;

       printf(“%d”, f(var,1));

       return 0;

    }

    Correct
    Incorrect
  37. Question 37 of 50
    37. Question

     What is the output of the following program?

    #include <stdio.h>

    int main()

    {

        int i = 5;

        printf(“%d %d %d”, i/2, i–, ++i);

        return 0;

    }

    Correct
    Incorrect
  38. Question 38 of 50
    38. Question

    Which of the following statements is correct in C?

    Correct
    Incorrect
  39. Question 39 of 50
    39. Question

    Which of the following statements is correct for the return type of function?

    Correct
    Incorrect
  40. Question 40 of 50
    40. Question

    Which of the following methods do C support?

    Correct
    Incorrect
  41. Question 41 of 50
    41. Question

    What is the output of the following program?

    #include <stdio.h>

    int main()

    {

        int x = 58;

        int * ptr = &x;

        –(*ptr);

        ++(*ptr);

        printf(“%d”, x);

       

        return 0;

    }

    Correct
    Incorrect
  42. Question 42 of 50
    42. Question

     Can you guess the output of the below program?

    for(;;){

        printf(“Hello!”);

    }

    Correct
    Incorrect
  43. Question 43 of 50
    43. Question

    What is the right way to include your own header file in C?

    Correct
    Incorrect
  44. Question 44 of 50
    44. Question

    What will be the output of the following program?

    #include <stdio.h>

    int func(int a, int b, int c)

    {

    return a + b – c;

    }

    void main()

    {

    int (*ptr)(int, int, int);

    ptr = &func;

    printf(“%d”,(*ptr)(4, 6, -5));

    }

    Correct
    Incorrect
  45. Question 45 of 50
    45. Question

    What is the output of the below program?

    #include<stdio.h>

    int main()

    {

    for(int i=0;i<1;i++){

        printf(“H”);

        for(int j=1;j<2;j++){

            printf(“i,”);

            for(int k=1;k<2;k++){

                printf(” How are you?”);

            }

        }

    }

       return 0;

    }

    Correct
    Incorrect
  46. Question 46 of 50
    46. Question

     What is the use of mem functions in C?

    Correct
    Incorrect
  47. Question 47 of 50
    47. Question

    Under the header file math.h, if you declare a function named sqrt(-x) then what will it return?

    Correct
    Incorrect
  48. Question 48 of 50
    48. Question

     If you want to print the time in UTC format then which function should you use?

    Correct
    Incorrect
  49. Question 49 of 50
    49. Question

     What is the output of the following program?

    #include<stdio.h>

    #include<stdlib.h>

    int main()

    {

       int a=20, b=10;

       printf(“%d”, a+(~b)%3);

       return 0;

    }

    Correct
    Incorrect
  50. Question 50 of 50
    50. Question

    Which preprocessor directive should you use when you want to give additional info to the compiler?

    Correct
    Incorrect

Summary

In this tutorial, we discussed some questions from the important topics of C programming. These are some advanced level types of C Quiz questions. So, you will require greater understanding of the C programming language. This tutorial will help you to improve and test your knowledge in C programming.

Exit mobile version