Code Buzz (Language : C)

30 Questions | Total Attempts: 29

SettingsSettingsSettings
Please wait...
Code Buzz (Language : C)

"A good programmer is someone who always looks both ways before crossing a one-way street" Do you have a wide vision on programming? Do you have control on several languages? Let's check ! Techtix, KGEC in association with Coding Ninjas presents Code Buzz, the competition to test your technical knowledge in Java, C & Python. Code Buzz this year has got total prizes worth Rs. 4,500. Take this challenge and register for Code Buzz this year


Questions and Answers
  • 1. 
    What do the following declaration signify? char **argv;
    • A. 

      Argv is a pointer to pointer.

    • B. 

      Argv is a pointer to a char pointer.

    • C. 

      Argv is a function pointer.

    • D. 

      Argv is a member of function pointer.

  • 2. 
    Declare the following statement? "A pointer to an array of three chars".
    • A. 

      Char *ptr[3]();

    • B. 

      Char (*ptr)*[3];

    • C. 

      Char (*ptr[3])(); 

    • D. 

      Char (*ptr)[3];

  • 3. 
    Which of the following statements are FALSE about the below code? int main(int ac, char *av[]) { }
    • A. 

      Ac contains count of arguments supplied at command-line

    • B. 

      Av[] contains addresses of arguments supplied at a command line

    • C. 

      In place of ac and av, argc and argv should be used.

    • D. 

      The variables ac and av are always local to main()

  • 4. 
    The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
    • A. 

      128 characters

    • B. 

      256 characters

    • C. 

      67 characters

    • D. 

      It may vary from one operating system to another

  • 5. 
    Which of the following statement is correct prototype of the malloc() function in c ?
    • A. 

      Int* malloc(int);

    • B. 

      Char* malloc(char);

    • C. 

      Unsigned int* malloc(unsigned int);

    • D. 

      Void* malloc(size_t);

  • 6. 
    How many times the while loop will get executed if a short int is 2 byte wide? #include<stdio.h> int main() {     int j=1;     while(j <= 255)     {         printf("%c %d\n", j, j);         j++;     }     return 0; }
    • A. 

      Infinite times

    • B. 

      255 times

    • C. 

      256 times

    • D. 

      254 times

  • 7. 
    What will function gcvt() do?
    • A. 

      Convert floating-point number to a string

    • B. 

      Convert vector to integer value

    • C. 

      Convert 2D array in to 1D array.

    • D. 

      Covert multi Dimensional array to 1D array

  • 8. 
    What will be the output of the program? #include<stdio.h> int main() {     int i;     i = scanf("%d %d", &i, &i);     printf("%d\n", i);     return 0; }
    • A. 

      1

    • B. 

      2

    • C. 

      Garbage Value

    • D. 

      Error: cannot assign scanf to variable

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

      2, 3

    • B. 

      2.000000, 3

    • C. 

      2.000000, 0

    • D. 

      2, 0

  • 10. 
    What will be the output of the program? #include<stdio.h> int main() {     int i;     i = printf("How r u\n");     i = printf("%d\n", i);     printf("%d\n", i);     return 0; }
    • A. 

      How r u 7 2

    • B. 

      How r u 8 2

    • C. 

      How r u 1 1

    • D. 

      Error: cannot assign printf to variable

  • 11. 
    What will the function randomize() do in Turbo C under DOS?
    • A. 

      Returns a random number.

    • B. 

      Returns a random number generator in the specified range.

    • C. 

      Returns a random number generator with a random value based on time.

    • D. 

      Return a random number with a given seed value.

  • 12. 
    Point out the error in the program? #include<stdio.h> int main() {     FILE *fp;     fp=fopen("trial", "r");     fseek(fp, "20", SEEK_SET);     fclose(fp);     return 0; }
    • A. 

      Error: unrecognised Keyword SEEK_SET

    • B. 

      Error: fseek() long offset value

    • C. 

      No error

    • D. 

      None of above

  • 13. 
    Point out the error in the program? #include<stdio.h> int main() {     char ch;     int i;     scanf("%c", &i);     scanf("%d", &ch);     printf("%c %d", ch, i);     return 0; }
    • A. 

      Error: suspicious char to in conversion in scanf()

    • B. 

      Error: we may not get input for second scanf() statement

    • C. 

      No error

    • D. 

      None of above

  • 14. 
    To print out a and b given below, which of the following printf() statement will you use? #include<stdio.h> float a=3.14; double b=3.14;
    • A. 

      Printf("%f %lf", a, b);

    • B. 

      Printf("%Lf %f", a, b);

    • C. 

      Printf("%Lf %Lf", a, b);

    • D. 

      Printf("%f %Lf", a, b);

  • 15. 
    Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+");
    • A. 

      Reading

    • B. 

      Writing

    • C. 

      Appending

    • D. 

      Read and Write

  • 16. 
    What is the purpose of "rb" in fopen() function used below in the code? FILE *fp; fp = fopen("source.txt", "rb");
    • A. 

      Open "source.txt" in binary mode for reading

    • B. 

      Open "source.txt" in binary mode for reading and writing

    • C. 

      Create a new file "source.txt" for reading and writing

    • D. 

      None of above

  • 17. 
    Which of the following statement is correct?
    • A. 

      Strcmp(s1, s2) returns a number less than 0 if s1>s2

    • B. 

      Strcmp(s1, s2) returns a number greater than 0 if s1<s2

    • C. 

      Strcmp(s1, s2) returns 0 if s1==s2

    • D. 

      Strcmp(s1, s2) returns 1 if s1==s2

  • 18. 
    Which of the following statements are correct ? 1:            A string is a collection of characters terminated by '\0'. 2:            The format specifier %s is used to print a string. 3:            The length of the string can be obtained by strlen(). 4:            The pointer CANNOT work on string.
    • A. 

      1, 2

    • B. 

      1, 2, 3

    • C. 

      2, 4

    • D. 

      3, 4

  • 19. 
    If the size of pointer is 32 bits What will be the output of the program ? #include<stdio.h> int main() {     char a[] = "Visual C++";     char *b = "Visual C++";     printf("%d, %d\n", sizeof(a), sizeof(b));     printf("%d, %d", sizeof(*a), sizeof(*b));     return 0; }
    • A. 

      10, 2 2, 2

    • B. 

      10, 4 1, 2

    • C. 

      11, 4 1, 1

    • D. 

      12, 2 2, 2

  • 20. 
    If char=1, int=4, and float=4 bytes size, What will be the output of the program ? #include<stdio.h> int main() {     char ch = 'A';     printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));     return 0; }
    • A. 

      1, 2, 4

    • B. 

      1, 4, 4

    • C. 

      2, 2, 4

    • D. 

      2, 4, 8

  • 21. 
    What will be the output of the program in 16-bit platform (Turbo C under DOS) ? #include<stdio.h> int main() {     printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));     return 0; }
    • A. 

      8, 1, 4

    • B. 

      4, 2, 8

    • C. 

      4, 2, 4

    • D. 

      10, 3, 4

  • 22. 
    What will be the output of the program ? #include<stdio.h> #include<string.h> int main() {     static char s[] = "Hello!";     printf("%d\n", *(s+strlen(s)));     return 0; }
    • A. 

      8

    • B. 

      0

    • C. 

      16

    • D. 

      Error

  • 23. 
    What will be the output of the program ? #include<stdio.h> int main() {     printf(5+"Good Morning\n");     return 0; }
    • A. 

      Good Morning

    • B. 

      Good

    • C. 

      M

    • D. 

      Morning

  • 24. 
    What will be the output of the program ? #include<stdio.h> #include<string.h> int main() {     printf("%d\n", strlen("123456"));     return 0; }
    • A. 

      6

    • B. 

      12

    • C. 

      7

    • D. 

      2

  • 25. 
    What will be the output of the program ? #include<stdio.h> int main() {     char p[] = "%d\n";     p[1] = 'c';     printf(p, 65);     return 0; }
    • A. 

      A

    • B. 

      A

    • C. 

      C

    • D. 

      65

Back to Top Back to top