C Interview Questions For TCS Interview

C language interview questions that are asked in TCS are not easy to answer without solid preparation? As per the academic requirements stated by the TCS recruitment board, having thorough knowledge of basic C programming is a must. Other than C, additional knowledge of Java, C++, .net and SAP doubles the chances of cracking any software job interview including TCS. Among them the C language is given topmost preference by TCS. So the interview question that are asked about programming languages include basic as well as tough questions on C programming.  Check out some of the frequently asked C interview questions with answers that will help you crack TCS  job interview easily.

TCS Image

Common C Interview Questions For TCS Interview

The common C questions asked in TCS interview are given below:

What are macros and what is the use of macros?

Macros can be defined as short statements that can be expanded into longer set of statements during the time of execution in C. Macros have an advantage if used as it can save programming time by shortening the logic and yet keeping the execution time same.

What is the definition of typecasting?

Typecasting is a explicit type conversion where the data type of a variable or expression can be converted from one type to another via user intervention. In C programs it is often required to change variables from one type to another as we have to take input of multiple types. Thus typecasting is very important.

In C program, state the easiest way to pass arguments( values and arrays)?

When we use arrays in functions or methods, there are two parameters: the formal parameters and the actual parameters that is the arguments. These arguments are passed to the main function. If these arguments are of primitive data type, then pass by value methods is used. In case it is a non primitive data type then pass by reference method is used.

What does the ‘void’ keyword do?

When creating a new method or function inside a class in C programs it is mandatory that we have a predefined data type for each function for avoiding problems in syntax or a compilation error. Thus if any function does not have a predefined data type then it is declared as void function. In the syntax we write ‘void’ on the left of the function name. A void function will not have any return type.

What is Pragma Directive?

Some directives can be used to turn ON and OFF a compiling systems by execution of specific features. For example a compiler can perform operations like loop optimization and this can be invoked by using the Pragma directive.

Also Check: TCS interview questions: HR and Technical

What is an abstract class? Can it be instantiated?

Abstract class can be used as a parental blueprint of the main class with common properties and methods. Abstract class does not have constructors, but it has the advantage that its methods can be inherited by derived classes. Thus in C programs that involves inheritance of subclass from super class, abstract class can be used to declare certain methods and variables. And an Abstract class cannot be instantiated.

What is a heap in C program?

A heap in C program is the memory location where malloc(), calloc(), and realloc() get memory. Heap has a disadvantage that getting memory from it is a much slower process. On the advantageous side, heap is much more flexible than a stack as at any point of time memory can be allocated and deallocated in the desired order. For deallocation, we need to use the call free() command. Another feature of heap is that recursive data structures are implemented using the heap memory. Even the Strings are accessed from that. If memory is allocated in a heap it can be saved in it until the runtime of the program.

Explain usage of C language in heterogeneous linked list? How is it used?

In heterogeneous linked list there are different types of data types and nodes present. In this we need to connect one node to another for which a pointer is required. This pointer will connect one node to another and create an entire heterogeneous linked list. An ordinary pointer cannot perform this function therefore a void pointer is used for it. This is because void pointer being a generic pointer type can store  pointer variables of any data type.

What are the three levels of data abstraction?

The three levels of data abstraction are:

·          Physical level data abstraction: This is the lowest level of data abstraction which defines the storage of data.

·          Logical Level data abstraction: The second level of data abstraction is logical level which describes data stored in the memory databases and defines the relationships between the stored data.

·          View level data abstraction: This is the highest level of data abstraction which defines a part of the entire database memory to us in full details.

We hope that these C language interview questions will help all the aspiring candidates who are about to sit for TCS job interviews.

Leave a Reply

Your email address will not be published. Required fields are marked *