Learn C MCQs

Prepare C MCQs (Multiple choice Questions) for exam and job interviews.

What is the size of an int in C?

1) Depends on the system

2) 2 bytes

3) 4 bytes

4) 8 bytes

Answer : Option 1

Which of the following is used for memory deallocation in C?

1) free()

2) clear()

3) delete()

4) None of the above

Answer : Option 1

Which keyword is used to define a macro in C?

1) const

2) macro

3) #macro

4) #define

Answer : Option 4

What is the output of printf("%d", 10 / 3);?

1) 3

2) Error

3) None

4) 3.33

Answer : Option 1

What is the correct way to access an element in an array in C?

1) array->index

2) index.array

3) array.index()

4) array[index]

Answer : Option 4

Which keyword is used to define a union in C?

1) combine

2) None of the above

3) struct

4) union

Answer : Option 4

How do you declare a constant in C?

1) define a as 10;

2) None of the above

3) constant int a = 10;

4) const int a = 10;

Answer : Option 4

What does sizeof() operator return?

1) The size of the variable in bytes

2) The length of a string

3) The memory address of a variable

4) None of the above

Answer : Option 1

Which function is used to concatenate strings in C?

1) strcat()

2) strjoin()

3) None of the above

4) strcopy()

Answer : Option 1

Which function is used to find the length of an array in C?

1) sizeof()

2) length()

3) strsize()

4) array_length()

Answer : Option 1