C Programming Interview Questions

C programming interview questions

C is the general and basic programming language that will create a base for other programming languages. C programming language was designed by Dennis Ritchie in Bells Lab. And it appeared around 46 years ago that is in 1972 and it was stably established on 11 December 2011. It is a crucial language of computer and it is coded in assembly language and it can run on from supercomputers to the embedded systems. ANSI C (American National Standards Institute) has standardized the C programming language since 1989 and even by the International Organization for Standardization (ISO).

Read Top C programming interview questions and answers

Download C programming interview questions PDF

C programming interview questions

Call by value: 
A process in which the values of the actual parameters sent by the calling function are copied to the formal parameters of the called function.

Call by reference: 
A process in which the parameters of a calling function are passed to the parameters of the called function using an address.

Sometimes the task we are required to do might not fit in the allocated data and code segments. Far pointers help to access rest of the memory inside a program. Far pointers are the information present outside the data segment (generally 64 kb). Such pointers are used when we need to access an address outside of the current segment.

A pointer can be used with a function-

  • When an address is to be passed to a function
  • When an array elements are to be accessed through a function. Passing base address will give access to the whole array.

Void pointer is a generic pointer in programming. If the pointer type is unknown, we make use of the void pointer.

Yes, Struct is one of the data type in C that have variable size. It is because the size of the structure depends on the fields which can be variable as set by the user.

Yes. As pointers have access to a particular memory location, the security level decreases and restricted memory areas can be accessed. Other demerits include memory holes, process and memory panics, etc.

Bit masking refers to selecting a particular set of bits from the byte(s) having many values of bits. Bit masking is used to examine the bit values and can be done by 'AND' operation of byte, bitwise.

Flag values are used to make decisions between two or more options during the execution of a program. Generally, flag values are small (often two) and it tries to save space by not storing each flag according to its own data type.

The best way to store flag values is to keep each of the values in their own integer variable. If there are large number of flags, we can create an array of characters or integers. We can also store flag values by using low-order bits more efficiently.

Normalization is the process by which an address is converted to a form such that if two non-normalized pointers point to the same address, they both are converted to normalized form, thereby having a specific address

One can determine the exact size of a data type by using the sizeof operator. The storage size of the data type is obtained in bytes by using the syntax: sizeof(data_type).

Pointers are variables that are used to store addresses. The concept of the pointer is considered to be one of the difficult part of learning the C and C++ programming languages. There are several easy ways to write programs without pointers, but in case of dynamic memory allocation, the knowledge of pointers is a must.

Knowing about memory locations and addresses defined will enable you with the ideas of how every variable function in a program.

Application of C Programming Language

  • To develop embedded software
  • It is to create a computer application
  • It is effective to create a compiler for various computer languages to convert them into low-level language that is the machine understandable language.
  • It can be used to develop an Operating system and UNIX is one which is developed by the C .programming language.
  • It is used for creating software for various applications and even hardware.