Genesis Insoft The name you can TRUST
twitterlogo facebooklogo
Home  |  Contact Us |  Careers
C Question Bank / FAQs

This is a mock Exam for the C programmers. It is created by Genesis InSoft Limited (admin@genesisinsoft.com) and may be freely distributed so long as it is unmodified. Please email us if you have any corrections or comments.

Question1

Reusability of code in C is supported by

  1. Functions
  2. Macros
  3. Pointers
  4. Files

Answer to Question 1

Question 2

The entry point of the 'C' program is with

  1. #include
  2. main(int argc, char * argv)
  3. c_main
  4. MAIN()

Answer to Question 2

Question 3

When a const variable is declared, it is stored

  1. in RAM
  2. in ROM
  3. on heap
  4. in CPU registers

Answer to Question 3

Question 4

What is the output of the program?

    #include <stdio.h>

    int main(int argc, char *argv[])
    {
        printf(" %d", printf("Hello Genesis"));
        return 0;
    }

  1. Hello Genesis
  2. 13 Hello Genesis
  3. Hello Genesis 13
  4. None of the above

Answer to Question 4

Question 5

What is the output of the program?

    #include <stdio.h>

    void main()    
    {
        printf("\n Hi" " %s ", "Genesis"" InSoft");
    }

  1. Hi %s Genesis InSoft
  2. Hi Genesis
  3. Hi Genesis InSoft
  4. Hi %s Genesis InSoft

Answer to Question 5

Question 6

What is the output of the program?

    #include <stdio.h>
   
    main()
    {
        switch (5)
        {
            case 5: printf(" 5 ");
            default: printf(" 10 ");
            case 6: printf(" 6 ");
        }
    }

  1. 5
  2. 5 10
  3. 5 10 6
  4. 5 6

Answer to Question 6

Question 7

What is the output of the program?

    #include <stdio.h>

    void main()
    {
        int x = 9;
        Continue: printf("\n Continue ");
        if(!x)
            goto gen;
        gen: printf(" Genesis ");
    }

  1. Genesis
  2. Continue Genesis
  3. Continue
  4. None of the above

Answer to Question 7

Question 8

Which argument of function 'strncmp()' specifies number of characters to be compared?

  1. first
  2. second
  3. third
  4. fourth

Answer to Question 8

Question 9

Which of the following is not a storage class in C?

  1. Static
  2. Register
  3. Extern
  4. Stack

Answer to Question 9

Question 10

Which of the following 'return' statement is correct?

  1. return, return;
  2. return(1, 2, 3);
  3. return(return 4);
  4. (return 5, return 6);

Answer to Question 10

Question 11

The second argument to fopen() function is?

  1. char
  2. const char *
  3. int *
  4. FILE *

Answer to Question 11

Question 12

What is the data type of FILE?

  1. integer
  2. union
  3. pointer
  4. structure

Answer to Question 12

Question 13

The first argument of fwrite function is typecast to

  1. char *
  2. FILE *
  3. int *
  4. void *

Answer to Question 13

Question 14

Which of the following storage class variables cannot be used with pointers?

  1. extern
  2. static
  3. register
  4. Both A and C

Answer to Question 14

Question 15

What is the output of the program?

    #include <stdio.h>

    void main()
    {
        int (*myprintf)(const char*, ...) = printf;
        myprintf("Genesis InSoft Limited");
    }

  1. Genesis InSoft Limited
  2. No output
  3. Undefined symbol myprintf
  4. Prototype mismatch

Answer to Question 15

Question 16

What is the output of the program?

    #include <stdio.h>

    void main()
    {
        char buffer[10] = {"Genesis"};
        printf(" %d ", &buffer[4]- (buffer));
    }

  1. 3
  2. 4
  3. 0
  4. Illegal pointer subtraction

Answer to Question 16

Question 17

If "arr" is an array of 5 x 5 dimension, arr[2][4] is same as

  1. **(a+3+4) 
  2. *(a+3)+*(a+4)
  3. **(a+3)+4
  4. *(*(a+2)+4)

Answer to Question 17

Question 18

What is the significance of the free() function?

  1. It erases the contents of any type and cleans the pointer
  2. It places the memory address with the pointer in free store
  3. It assigns the pointer a NULL value
  4. It disables the memory address with the pointer

Answer to Question 18

Question 19

The following statement is used in C for

char *ptr = (char*) malloc(Length);

  1. For faster execution of programs
  2. For reducing the code
  3. For conservation of memory
  4. Both A and B

Answer to Question 19

Question 20

What is the output of the program?   

    #include <stdio.h>
    #define sq(a) a * a      

    void main()    
    {
        printf("%d", sq(3 + 2));
    }        

  1. 25
  2. 11
  3. 10
  4. Compilation error 

Answer to Question 20

Answers

Answer 1 - A

Back to question 1

Answer 2 - B

Back to question 2

Answer 3 -  B

Back to question 3

Answer 4 - C

Back to question 4

Answer 5 - C

Back to question 5

Answer 6 - C

Back to question 6

Answer 7 - B

Back to question 7

Answer 8 - C

Back to question 8

Answer 9 - D

Back to question 9

Answer 10 - B

Back to question 10

Answer 11 - B

Back to question 11

Answer 12 - D

Back to question 12

Answer 13 - D

Back to question 13

Answer 14 - C

Back to question 14

Answer 15 - A

Back to question 15

Answer 16 - B

Back to question 16

Answer 17 - D

Back to question 17

Answer 18 - B

Back to question 18

Answer 19 - C

Back to question 19

Answer 20 - B

Back to question 20

Copyright © 2000 to 2011 Genesis InSoft Limited. All Rights Reserved.