Dexterity - 'c Programming Contest'

20 Questions | Total Attempts: 1201

SettingsSettingsSettings
Please wait...
Dexterity -

Organizing by IT Department


Questions and Answers
  • 1. 
    Which of the following is not a valid variable name declaration?
    • A. 

      Int _a9;

    • B. 

      Int a_9;

    • C. 

      Int 9_a;

    • D. 

      Int _9a

  • 2. 
    Which of the following is a valid C variable name?
    • A. 

      Int number;

    • B. 

      Float floating;

    • C. 

      double doubleint;

    • D. 

      All

  • 3. 
    Which is correct with respect to size of the datatypes?
    • A. 

      Char > int > float

    • B. 

      Int > char > float

    • C. 

      Char < int < double

    • D. 

      Double > char > int

  • 4. 
    Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 - 1
    • A. 

      * / % + - =

    • B. 

      = * / % + -

    • C. 

      / * % - + =

    • D. 

      * % / - + =

  • 5. 
    What is the output of this C code? int main() { int x = 2, y = 0; int z = (y++) ? y == 1 && x : 0; printf("%d\n", z); return 0; }
    • A. 

      1

    • B. 

      0

    • C. 

      Undefined behavior

    • D. 

      Compile time error

  • 6. 
    Which of the following is not an arithmetic operation?
    • A. 

      A *= 10;

    • B. 

      A /= 10;

    • C. 

      A != 10;

    • D. 

      A %= 10;

  • 7. 
    What is the output of this C code?     #include <stdio.h>     void main()     {         double x = 123828749.66;         int y = x;         printf("%d\n", y);         printf("%lf\n", y);     }
    • A. 

      0, 0.0

    • B. 

      123828749, 123828749.66

    • C. 

      12382874, 12382874.0

    • D. 

      123828749, 0.000000

  • 8. 
    What is the output of this C code?     #include <stdio.h>     void main()     {         int x = 4, y, z;         y = --x;         z = x--;        printf("%d%d%d", x,  y, z);     }
    • A. 

      3 2 3

    • B. 

      2 3 3

    • C. 

      3 2 2

    • D. 

      2 3 4

  • 9. 
    Property which allows to produce different executable for different platforms in C is called?
    • A. 

      File inclusion

    • B. 

      Selective inclusion

    • C. 

      Conditional compilation

    • D. 

      Recursive macros

  • 10. 
    What will be the output of the following program? #include<stdio.h> #define square(x) x*x  void main() {        int i;        i = 64/square(4);        printf("%d", i);  }
    • A. 

      4

    • B. 

      64

    • C. 

      16

    • D. 

      None

  • 11. 
    What is the output of this C code?     #include <stdio.h>     const int a = 1,  b = 2;     int main()     {         int x = 1;         switch (x)         {         case a:             printf("yes ");         case b:             printf("no\n");             break;         }    }
    • A. 

      Yes no

    • B. 

      Yes

    • C. 

      No

    • D. 

      Compile time error

  • 12. 
    Comment on the output of this C code?     #include <stdio.h>     int main()     {         int a = 1;         if (a)       printf("All is Well ");    printf("I am Well\n");         else             printf("I am not a River\n");     }
    • A. 

      Output will be All is Well I am Well

    • B. 

      Output will be I am Well I am not a River

    • C. 

      Output will be I am Well

    • D. 

      Compile time errors during compilation

  • 13. 
     What will be the value of i and j after execution of following program? #include<stdio.h> void main() { int i, j; for(i=0,j=0;i<10,j<20;i++,j++) { printf("i=%d %t j=%d", i, j); } }
    • A. 

      10 10

    • B. 

      10 20

    • C. 

      20 20

    • D. 

      Run time error

  • 14. 
    What is the output of this C code?     #include <stdio.h>     int main()     {         int i = 0;         while (i = 0)             printf("True\n");         printf("False\n");     }
    • A. 

      True (infinite time)

    • B. 

      True (1 time) False

    • C. 

      False

    • D. 

      Compile error

  • 15. 
    What is the output of this C code?     #include <stdio.h>     int main()     {    printf("before continue ");         continue;   printf("after continue\n");     }
    • A. 

      Before continue after continue

    • B. 

      Before continue

    • C. 

      After continue

    • D. 

      Compile time error

  • 16. 
    Comment on the following statement:  int (*a)[7];
    • A. 

      An array “a” of pointers.

    • B. 

      A pointer “a” to an array.

    • C. 

      A ragged array.

    • D. 

      None of the mentioned

  • 17. 
    What is the output of this C code?     #include <stdio.h>     void main()     {  int a[2][3] = {1, 2, 3, , 4, 5};         int i = 0, j = 0;         for (i = 0; i < 2; i++)         for (j = 0; j < 3; j++)         printf("%d", a[i][j]);     }
    • A. 

      1 2 3 junk 4 5

    • B. 

      Compile time error

    • C. 

      1 2 3 0 4 5

    • D. 

      1 2 3 3 4 5

  • 18. 
    What is the output of this C code?     #include <stdio.h>     void main()     {         static int x = 3;         x++;         if (x <= 5)         {             printf("hi");             main();         } }
    • A. 

      Run time error

    • B. 

      Hi

    • C. 

      Infinite hi

    • D. 

      Hi hi

  • 19. 
    Which files will get closed through the fclose() in the following program? #include<stdio.h> int main() {     FILE *fs, *ft, *fp;     fp = fopen("A.C", "r");     fs = fopen("B.C", "r");     ft = fopen("C.C", "r");     fclose(fp, fs, ft);     return 0; }
    • A. 

      "A.C" "B.C" "C.C"

    • B. 

      "B.C" "C.C"

    • C. 

      "A.C"

    • D. 

      Error in fclose()

  • 20. 
    What will be the output of the program ? #include<stdio.h> int main() {     enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};     printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT);     return 0; }
    • A. 

      -1, 0, 1, 2, 3, 4

    • B. 

      -1, 2, 6, 3, 4, 5

    • C. 

      -1, 0, 6, 2, 3, 4

    • D. 

      -1, 0, 6, 7, 8, 9

Back to Top Back to top