C programming - Programming Language (MCQ) questions

Dear Readers, Welcome to C programming multiple choice questions and answers with explanation. These objective type C programming questions are very important for campus placement test and job interviews.

Specially developed for the C programming freshers and professionals, these model questions are asked in the online technical test and interview of many IT companies.

1)   Using _______ statement is how you test for a specific condition.
- Published on 26 Feb 17

a. Select
b. If
c. Switch
d. For
Answer  Explanation 

ANSWER: If

Explanation:
No explanation is available for this question!


2)   C programming : State true of false.     

It is possible to pass a structure variable to a function either by value or by address.

- Published on 19 Oct 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


3)   C programming : Suppose that x is a one dimensional array, then choose the correct answer regarding array.
- Published on 19 Oct 15

a. *(x + n) is same as &x[n]
b. *&x[n] is same as x + n
c. *(x + n) is same as x[n] +1
d. *(x + n) is same as *x[n]
Answer  Explanation 

ANSWER: *(x + n) is same as &x[n]

Explanation:
No explanation is available for this question!


4)   C programming : If you want to store dissimilar data together, then which type you will use?
- Published on 19 Oct 15

a. array
b. structure
c. stack
d. None of the above.
Answer  Explanation 

ANSWER: structure

Explanation:
No explanation is available for this question!


5)   C programming : Trace the output

int main()
{
    int a=12,b=39;
    printf ("%d",a&b);
    return 0;
}

- Published on 19 Oct 15

a. 468
b. 0
c. 4
d. None of the above.
Answer  Explanation 

ANSWER: 4

Explanation:
No explanation is available for this question!


6)   C programming : Trace the output.

void main()
{
    int i=2,j=2;
    while(i+1?--i:j++)
         printf("%d",i);    
}

- Published on 19 Oct 15

a. 1
b. 2
c. ERROR
d. None of the above.
Answer  Explanation 

ANSWER: 1

Explanation:
No explanation is available for this question!


7)   C programming : Match the following:

a. calloc( )  ------- i. Frees previouslyallocated space.
b. free( ) ----------- ii. Modifiespreviouslyallocated space.
c. malloc( ) ------- iii. Allocates spacefor array.
d. realloc( ) ------- iv. Allocatesrequested size ofspace.

- Published on 19 Oct 15

a. a-iii, b-i, c –iv, d -ii
b. a-iii, b-ii, c –i, d -iv
c. a-iii, b-iv, c –i, d -ii
d. a-iv, b-ii, c –iii, d -i
Answer  Explanation 

ANSWER: a-iii, b-i, c –iv, d -ii

Explanation:
No explanation is available for this question!


8)   Identify the wrong syntax
(C programming)

- Published on 26 Jun 15

a. typedef struct { member declaration; } NAME; NAME V1, V2;
b. typedef struct tag{ member declaration; } NAME; NAME V1, V2;
c. typedef struct { member declaration; } NAME; NAME V1, V2;
d. typedef struct tag { member declaration; } NAME; NAME V1, V2;
Answer  Explanation 

ANSWER: typedef struct tag { member declaration; } NAME; NAME V1, V2;

Explanation:
No explanation is available for this question!


9)   What is the default return-type of getchar()? (C programming)
- Published on 26 Jun 15

a. char
b. int
c. char *
d. Reading character doesn't require a return-type
Answer  Explanation 

ANSWER: int

Explanation:
The getchar needs to remove some abnormal state. Say for example read error or end of file (EOF = -1). Here the returned value is not 0-255 so It is not possible to represent such cases with char type.


10)   Which of the following cannot be checked in a switch-case statement?
(C programming)

- Published on 26 Jun 15

a. Character
b. Integer
c. Float
d. enum
Answer  Explanation 

ANSWER: Float

Explanation:
The switch-case is defined by the language specification to use an int value so you cannot use a float value.


1 2 3 4 5 6