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.

Question 1

The number of components in a doubly linked list is

  1. 1
  2. 2
  3. 3
  4. 4

Answer to Question 1

Question 2

What is the output of the program?

    #include <stdio.h>
    void main()
    {
        unsigned short a = -4;              // Assume short is 2 bytes
        printf("\n %u", a);
    }

  1. Error: Variable of type unsigned char cannot store negative values
  2. 4
  3. -4
  4. 65532

Answer to Question 2

Question 3

Which of the following is a non-linear data structure?

  1. Stack
  2. Queue
  3. Linked List
  4. Tree

Answer to Question 3

Question 4

Function time (time_t*) is used to get the

  1. current system time
  2. time taken for the program to execute
  3. file updation time
  4. file creation time

Answer to Question 4

Question 5

Macros

  1. Expands the code size
  2. Perform dumb substitution
  3. Reduce the speed of program execution
  4. Both A and B

Answer to Question 5

Question 6

Which of the options helps the programmer in debugging a program?

  1. Watch
  2. Building a project
  3. Conditional compilation
  4. Both A and C

Answer to Question 6

Question 7

How can you correct improper naming of function?

  1. By type defining the function
  2. By declaring pointer to functions
  3. By # defining the name
  4. By redefining the function

Answer to Question 7

Question 8

Memory conservation is possible using

  1. Unions
  2. Static variables
  3. Arrays
  4. Bit fields

Answer to Question 8

Question 9

What is the output of the program?

    #include <stdio.h>
    #define MAX 20
    void  main()
    {
        printf("%d", ++MAX));
    }

  1. No error, output is 20
  2. No error, output is 21
  3. Error: Define directive needs an identifier
  4. Error: Lvalue required

Answer to Question 9

Question 10

What is the output of the program?

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

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

  1. 11
  2. 25
  3. Error in compilation
  4. 13

Answer to Question 10

Question 11

'C' language was developed to achieve

  1. Portability
  2. Modularity
  3. Platform independence
  4. Reusability

Answer to Question 11

Question 12

How many bytes are allocated for "int" declaration?

  1. minimum 2
  2. only 2
  3. minimum 4
  4. only 4

Answer to Question 12

Question 13

Which of the following data types has the same size irrespective of the operating system?

  1. char*
  2. int
  3. float
  4. char

Answer to Question 13

Question 14

What is the output of the program?

    #include <stdio.h>
    void main()
    {
        int m = (m = 1, m++, --m);
        printf("\n %d ", m);
    }

  1. Error: undefined symbol 'm'
  2. 2
  3. 1
  4. 3

    Answer to Question 14

Question 15

What is the output of the program?

    #include <stdio.h>
    void main()
    {
        printf("%d", sizeof(int) ? 1 ? 2 : 3 ? 4 : 5);
    }

  1. Error: Lvalue required
  2. syntax error: missing : before )
  3. 2
  4. 3

Answer to Question 15

Question 16

A switch statement is similar to

  1. while
  2. do - while
  3. multiple if - else if - else
  4. for

Answer to Question 16

Question 17

Which of the following function returns an integer data type?

  1. strncpy
  2. strcmp
  3. strstr
  4. strcat

Answer to Question 17

Question 18

Which of the following statements is correct?

  1. when a pointer is incremented by 1 the address contained in the pointer is incremented by 1
  2. when a pointer is incremented by 1 the address contained in the pointer is incremented by size of integer
  3. when a pointer is incremented by 1 the address contained in the pointer is incremented according to the type of pointer
  4. when a pointer is incremented by 1 the address contained in the pointer is incremented according to the type it is pointing to

Answer to Question 18

Question 19

What is the output of the program?

    #include <stdio.h>
   
    void main()
    {
        static int a[] = {5, 10, 15, 20};
        int* ptr = a;
        int** ptr_ptr = &ptr;
        printf("\n %d",**ptr_ptr++);
    }

  1. 5
  2. 10
  3. 15
  4. 20

Answer to Question 19

Question 20

The compiler evaluates the operator '*' as either a pointer indirection or multiplication based on

  1. the operator precedence
  2. the number of operands
  3. the type of operands
  4. its location in the source code

Answer to Question 20

Answers

Answer 1 - C

Back to question 1

Answer 2 - D

Back to question 2

Answer 3 - D

Back to question 3

Answer 4 - A

Back to question 4

Answer 5 - D

Back to question 5

Answer 6 - D

Back to question 6

Answer 7 - B

Back to question 7

Answer 8 - D

Back to question 8

Answer 9 - D

Back to question 9

Answer 10 - A

Back to question 10

Answer 11 - A

Back to question 11

Answer 12 - A

Back to question 12

Answer 13 - D

Back to question 13

Answer 14 - C

Back to question 14

Answer 15 - B

Back to question 15

Answer 16 - C

Back to question 16

Answer 17 - B

Back to question 17

Answer 18 - C

Back to question 18

Answer 19 - A

Back to question 19

Answer 20 - B

Back to question 20

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