C Programming Language: Test Your Skills! Trivia Quiz

10 Questions | Total Attempts: 63

SettingsSettingsSettings
Please wait...
C Programming Language: Test Your Skills! Trivia Quiz

Are you looking to test your skills when it comes to the C programming language? This is the most popular language when it comes to writing operating software due to its flexibility and easy to use. The name from this application came up as a result of it coming after the B language. See how good you are in using it by taking this quiz.


Questions and Answers
  • 1. 
    Point out the correct statements are correct about the program below? #include<stdio.h> int main() { char ch; while(x=0;x<=255;x++) printf("ASCII value of %d character %c\n", x, x); return 0; }
    • A. 

      The code generates an infinite loop

    • B. 

      The code prints all ASCII values and its characters

    • C. 

      Error: x undeclared identifier

    • D. 

      Error: while statement missing

  • 2. 
    Which of the following is the correct usage of conditional operators used in C?
    • A. 

      A>b ? c=30 : c=40;

    • B. 

      A>b ? c=30;

    • C. 

      Max = a>b ? a>c?a:c:b>c?b:c

    • D. 

      Return (a>b)?(a:b)

  • 3. 
    What will be the output of the program? #include<stdio.h> #include<math.h> int main() { float n=1.54; printf("%f, %f\n", ceil(n), floor(n)); return 0; }
    • A. 

      2.000000, 1.000000

    • B. 

      1.500000, 1.500000

    • C. 

      1.550000, 2.000000

    • D. 

      1.000000, 2.000000

  • 4. 
    What will be the output of the program? #include<stdio.h> int main() { float d=2.25; printf("%e,", d); printf("%f,", d); printf("%g,", d); printf("%lf", d); return 0; }
    • A. 

      2.2, 2.50, 2.50, 2.5

    • B. 

      2.2e, 2.25f, 2.00, 2.25

    • C. 

      2.250000e+000, 2.250000, 2.25, 2.250000

    • D. 

      Error

  • 5. 
    Point out the error in the program #include<stdio.h> int main() { int i; #if A printf("Enter any number:"); scanf("%d", &i); #elif B printf("The number is odd"); return 0; }
    • A. 

      Error: unexpected end of file because there is no matching #endif

    • B. 

      The number is odd

    • C. 

      Garbage values

    • D. 

      None of above

  • 6. 
    If a function contains two return statements successively, the compiler will generate warnings.
    • A. 

      True

    • B. 

      False

  • 7. 
    What will be the output of the program ? #include<stdio.h> int main() { float arr[] = {12.4, 2.3, 4.5, 6.7}; printf("%d\n", sizeof(arr)/sizeof(arr[0])); return 0; }
    • A. 

      5

    • B. 

      4

    • C. 

      6

    • D. 

      7

  • 8. 
    Which of the following statements correct about the below program? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u1 = {512}; union a u2 = {0, 2}; return 0; } 1: u2 CANNOT be initialized as shown. 2: u1 can be initialized as shown. 3: To initialize char ch[] of u2 '.' operator should be used. 4: The code causes an error 'Declaration syntax error'
    • A. 

      1,2

    • B. 

      2,3

    • C. 

      1,2,3

    • D. 

      2,4

  • 9. 
    Is there any difference int the following declarations? int fun(int arr[]); int fun(int arr[2]);
    • A. 

      True

    • B. 

      False

  • 10. 
    What will be the output of the program? #include<stdio.h> int get(); int main() { const int x = get(); printf("%d", x); return 0; } int get() { return 20; }
    • A. 

      Garbage value

    • B. 

      20

    • C. 

      Error

    • D. 

      0