TCS Type Tough C Interview Questions

Below are few tough C interview questions (supposedly tough, if not, it means you have prepared well :)). You definitely could expect questions from C during TCS interviews. Below questions could help your preparation a bit.

Interview Question 1 :

Some directives are used to turn ON and OFF compiler specific features. For example, a compiler could be able to perform loop optimization and this could be invoked via these directives. What are these directives called ?

Answer : Pragma Directive. (This is bit tough question which you might not be aware of.)

Interview Question 2 :

#ifndef preprocessor directive can be used to avoid multiple inclusions of a header file. State True or False.

Answer: Yes, it is True. For example the below code includes "headerfile.h" only if it is not already included.

#ifndef headerfile.h
#define headerfile.h
#endif

Interview Question 3 :

Can an abstract class be instantiated. What is the real use of an abstract class?

Answer: No, abstract class cannot be instantiated. It serves as a parental blueprint or a benchmark class with common properties and methods which can be inherited by derived classes.

  • Fresher IT Jobs