Top C Programming Interview Questions With Answers Part 1



1.What is c?

  • C is a high-level and general purpose programming language that is ideal for developing firmware or portable applications.
  • Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System (OS) in the early 1970s.
What is c


2.What is the difference between Call by Value and Call by Reference?

  • When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable.
  • Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function.
What is the difference between Call by Value and Call by Reference


3.Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

  • Placing comment symbols /* */ around a code, also referred to as “commenting out”, is a way of isolating some codes that you think maybe causing errors in the program, without deleting the code.
  • The idea is that if the code is in fact correct, you simply remove the comment symbols and continue on.
How does this aid in debugging


4.What is a stack?

A stack is one form of a data structure.

  • Data is stored in stacks using the FILO (First in Last Out) approach.
  • At any particular instance, only the top of the stack is accessible, which means that in order to retrieve data that is stored inside the stack, those on the upper part should be extracted first.
What is a stack


5.What is a sequential access file?

When writing programs that will store and retrieve data in a file, it is possible to designate that file into different forms.
A sequential access file is such that data are saved in sequential order:

  • One data is placed into the file after another
  • To access a particular data within the sequential access file, data has to be read one data at a time, until the right one is reached.
What is a sequential access file


6.What is variable initialization and why is it important?

  • This refers to the process wherein a variable is assigned an initial value before it is used in the program.
  • Without initialization, a variable would have an unknown value, which can lead to unpredictable outputs when used in computations or other operations.
What is variable initialization and why is it important


7.What is spaghetti programming?

  • Spaghetti programming refers to codes that tend to get tangled and overlapped throughout the program.
  • This unstructured approach to coding is usually attributed to lack of experience on the part of the programmer.
  • Spaghetti programing makes a program complex and analyzing the codes difficult, and so must be avoided as much as possible.
What is spaghetti programming


8.Differentiate Source Codes from Object Codes

  • Source codes are codes that were written by the programmer.
  • It is made up of the commands and other English-like keywords that are supposed to instruct the computer what to do.
  • However, computers would not be able to understand source codes.
  • Therefore, source codes are compiled using a compiler.
  • The resulting outputs are object codes, which are in a format that can be understood by the computer processor.
  • In C programming, source codes are saved with the file extension .C, while object codes are saved with the file extension .OBJ

9.In C programming, how do you insert quote characters (‘and “) into the output screen?

  • This is a common problem for beginners because quotes are normally part of a printf statement.
  • To insert the quote character as part of the output, use the format specifies \’ (for single quote), and \” (for double quote).

10.What is the use of a ‘\0’ character?

It is referred to as a terminating null character, and is used primarily to show the end of a string value.

What is the use of a \0 character




Related Searches to C Programming interview Questions: