In this article, we are going to see about some most important and basic to advanced C Programming Interview Questions and Answers. these questions are made based on the Interview preparation, and for the preparation of competitive exams. also, these questions have a high probability that can be asked in your university exam or any coding competitions because these are general and most important questions that one needs to focus on to crack the Interview part related to c programming.

c programming Interview questions and answers


C was primarily developed as a

  1. systems programming language
  2. general-purpose language
  3. data processing language
  4. none of the above
Answer - (1) system programming language

C is a

  1. high-level language
  2. low-level language
  3. high-level language with some low-level features
  4. low-level language with some high-level features
Answer - (3) high-level language with some low-level features

Which of the following comments are not true?

C provides no input-output features
C provides no file access features
C borrowed most of its ideas from BPCl
C provides no features to manipulate composite objects
  1. 1 only
  2. 1,2 and 3
  3. 1,2,3 and 4 
  4. None of the above
Answer - (4) None of the above

Which of the following are not keywords in C?

  1. printf
  2. main
  3. IF
  4. none of the above
Answer - (3) IF

C does no automatic array bound checking. this is

  1. not true always
  2. false
  3. C's asset 
  4. C's shortcoming and always true
Answer - (4) C's shortcoming and always true

Any C program

  1. must contain at least one function
  2. need not contain any function
  3. needs input data
  4. none of the above
Answer - (1) must contain at least one function

Preprocessing is typically done

  1. either before or at the beginning of the compilation process
  2. after compilation but before execution
  3. after loading
  4. none of the above
Answer - (1) either before or at the beginning of the compilation process

Which of the following comments about the preprocessor directive # are correct?

  1. It converts the formal argument in the macro definition into a string
  2. It strips out redundant blanks
  3. It concatenates adjacent strings if any
  4. All of the above
Answer - (4) All of the above

In a program, the constant is defined

  1. before main
  2. after main
  3. anywhere, but starting on a new line
  4. none of the above
Answer - (3) anywhere, but starting on a new line

Choose the correct statement:

  1. The use of goto enhances the logical clarity of a code
  2. The use of goto makes the debugging task easier
  3. Use goto when you want to jump out of a nested loop
  4. Never use goto
Answer - (3) Use goto when you want to jump out of a nested loop 

Which of the following about conditional compilation is not true?

It is taken care of by the compiler.
It is setting the compiler option conditionally
It is Compiling a program based on a condition
It is taken care of by the pre-processor.
  1. 2 only
  2. 3 and 4 only
  3. 1 and 2
  4. all of the above
Answer - (2) 3 and 4 only

The minimum number of temporary variables needed to swap the contents of two variables is

  1. 1
  2. 2
  3. 3
  4. 0
Answer - (4) 0

The purpose of the following program fragment

b = s + b;
s = b - s;
b = b - s;
wheres, be are two integers is to
  1. transfer the contents of s to b
  2. transfer the contents of b to s
  3. exchange(swap) the contents of s and b
  4. negate the contents of s and b
Answer - (3) exchange(swap) the contents of s and b

If an integer needs two bytes of storage, then the maximum value of an unsigned integer is

  1. 2^16 - 1 
  2. 2^15 - 1
  3. 2^16
  4. 2^15
Answer - (1) 2^16 - 1

If an integer needs two bytes of storage, then the maximum value of a signed integer is

  1. 2^16 - 1 
  2. 2^15 - 1
  3. 2^16
  4. 2^15
Answer - (2) 2^15 - 1

Choose the false statements:

  1. An identifier may start with an underscore
  2. An identifier may end with an underscore
  3. IF is a valid identifier
  4. The number of significant characters in an identifier is implementation-dependent
Answer - (3) IF is a valid identifier

int i = 5;
is a statement in a C program. Which of the following are true?

  1. During execution, the value of i may change but not its address
  2. During execution, both the address and value may change
  3. Repeated execution may result in different addresses for i
  4. i may not have an associated address
Answer - (3) Repeated execution may result in different addresses for i

Which of the following comments about the ++ operator are correct?

  1. It is a unary operator
  2. The operator can come before or after the operator
  3. If cannot be applied to an expression and it associated with the right
  4. All of the above
Answer - (4) All of the above

For the C preprocessor, which of the following is/are true?

takes care of conditional compilation
takes care of macros
takes care of includes files
acts before compilation
  1. 1 and 2
  2. 3 only
  3. 1,2 and 3
  4. All of the above
Answer - (4) All of the above

The declaration enum cities [Bethlethem, Jericho, Nazareth = 1, Jerusalem] assign the value 1 to

  1. Bethlehem
  2. Nazareth
  3. Bethlehem and Nazareth
  4. Jericho and Nazareth
Answer - (4) Jericho and Nazareth

Note - More Questions and Answers will be added from time to time.