Best C Interview Questions and Answers

By | May 20, 2020
C Interview Questions
Table of Contents show

If you are a Computer Science student, then you must have heard of C programming language or may have some experience with it. There was a time when C was one of the most popular languages, but with the increasing demand of OOPs concepts, developers need to move to other high-level programming languages. It is also important for a developer to have some knowledge of C, because it is the building blocks of many popular programming languages such as C++, C#, Java, and Python. If you have mentioned C language with your other skills in your CV, then the interviewer definitely going to ask you some questions from it. Here we have selected Top Questions of C language which are mostly asked during the interviews.

C Interview Questions

Question: Who is the creator of the C programming language?

Answer: Dennis Ritchie invented the C programming language at Bell Labs.


Question: Give some key Features of C.


  • It is portable that means code written on one computer can run on other computers.
  • It comes with a feature called Modularity which can break the programs into small modules.
  • The compiling speed of C language is very high due to its Procedural Concept.
  • Code security is also good.

Question: What break keyword do in C?

Answer: A keyword break is used to break a loop or switch statement so that the and walk out from it.

Question:  How many reserved keywords C have?

Answer: 32

Question: What is the full form of ASCII?

Answer: American Standard Code for Information Interchange.

Question: What is the default value of int static variable?

Answer: 0

Question: How \(backslash) used in printf()?

Answer: \(backslash) use in escaping.


printf(“hello \n world);

Question: Are N++ and N+1 take the same time to execute, if not why?

Answer: No, N++ and N+1 do not take the same time to execute. N++ can execute faster than N+1 because the N++ statement run in a single instruction, but N+1 take more operation to perform.

Question: Give some differences between local and global variables.

Answer: Local variables are declared inside the function, whereas the global variable declares outside the function. Only that function can access the local variable which had declared it, however, any function can use the global variable.

Question: What is a pointer on a pointer?

Answer: A pointer variable that contains the address of another pointer variable.


int **pointer

Question: What is the base address of an array?

Answer: The first element address of the array is known as the base address, and with the help of base address we can find the address of the consecutive array elements.

Question: Does main() function require to compile a program?

Answer: No program can be compiled without the main() function, and it won’t execute.

Question: What is structure in C?

Answer: A structure is a data structure in C which is a collection of heterogeneous data items.

Question: What is prefixed increment?

Answer: In prefixed increment, the value of the variable increase first.


int a=0;
++a   // increment operation.

Question: How dynamic data structure in C is efficient as compared to the static data structure?

Answer: The dynamic data structure shows their efficiency in memory allocation, which is the main asset of dynamic data structure over the static data structure. In the dynamic data structure, memory access only occurs when it’s needed, which prevent from memory wastage.

Question: Can we create a new header file?

Answer: Yes.

Question: What is a dangling pointer?

Answer: A dangling pointer is a pointer to storage that is no longer allocated. For example, when a pointer is pointing a memory address of a variable, but when the variable is deleted and the pointer is still pointing the memory location this pointer will be termed as a dangling pointer.

Question: What typedef keyword do in C?

Answer: typedef keyword is used to give an alternate name to a reserved datatype keyword.


typedef unsigned char ch;                 // now ch has become a char data type
ch string1[20], string2[30];

Question: What are modifiers? Name some of the modifiers used in C.

Answer: Modifiers are the prefix of a datatype which is used to modify the memory allocation of the datatype.


long int a; //here long is a modifier and the “a”will occupy 8 bits of space in the memory.
Short int b;// short is the modifier and “b” will occupy 2 bit of space in the memory


  1. short
  2. long
  3. unsigned
  4. signed

Question: What is typecasting in C?

Answer: A typecasting is a method in C which can convert the data type of a variable into another data type.


float a;
int b = (int) a;          // type casting from float to int
printf(“%d”, b);

Question: What is an Infinite loop?

Answer: When a loop run continuously for infinite time or the loop statement never get false is known as infinite loop.


int a =1;
printf(“run infinite time”);

Question: What malloc() and calloc() function do?

Answer: Both malloc () and calloc () perform the same function, which is they provide dynamic memory allocation to a variable.

malloc() use to reserve a single block of memory and return a pointer where as calloc() is used to allocates multiple block of memory.

// malloc() and calloc() syntax
Mptr = (int*) malloc(20*sizeof(int));
Cptr= (int*) calloc(20, sizeof(int));

Question: What is a NULL pointer?

Answer: Many times we require a pointer to points nothing that time we use NULL pointer. A NULL pointer is that pointer which points to nothing. The NULL pointer mostly used in the linked list.

Question: Name the function used to convert a string to a number.


  1. atof(): convert a string to a float
  2. atoi(): convert a string to an integer
  3. atol(): convert a string to a long integer.

Question: What is #pragma?

Answer: The #pragma is a preprocessor directive that allows each compiler to implement compiler-specific features that can be turned on and off by using the #pragma statement.

Objective C

Objective C is an alternate programming language use by IOS system for their applications. Apple-IOS use Swift and Objective C to build IOS software and applications for their different devices. If you want to land in Apple company as an Objective-C developer here we have provided the most important Objective-C interview questions which will definitely help you crack to the interview.

Objective C Interview questions

Question: What is OOPs?

Answer: Object-Oriented Programming is a model of programming languages that use class and objects to create the program. Here object can be defined as a data field which can have unique attributes and behavior.

Question: What is Objective C?

Answer: Objective C is a programming language used to design OS X and iOS software. It is a superset of C language because it supports object-oriented programming and a dynamic runtime.

Question: What is Polymorphism?

Answer: Polymorphism is a concept in OOP’s which says that the same operator can perform a different kind of operations on different data types.

Question: What is Dot Notation?

Answer: Dot notation is used by the class instance or objects to invoke the class attributes, properties, and methods.

Question: What is Abstraction?

Answer: Abstraction is a technique of hiding the unnecessary code from the user.

Question: Who designed Objective-C?

Answer: Tom Love and Brad Cox

Question: What is the paradigm of Objective-C?

Answer: Objective C is a Reflective, Class-Based Object-oriented programming language.

Question: What is the protocol in Objective C?

Answer: Objective C supports single inheritance but with the help of protocol, we can perform multiple inheritances. In other programming languages, it is known by interface or trait.

Question: Name the protocols that Objective C uses.


  • Ad hoc protocols aka informal protocols
  • Compiler-enforced protocol aka formal protocols

Question: Name Objective C components.


  • Preprocessor orders
  • Interface
  • Method
  • Variables
  • Statement and expression
  • Comments

Question: Why do we use #import in Objective C?

Answer: #import is used as an upgrade of #include that solve the problem of recursive include.

Question: What is the difference between #import and #include?

Answer: #import added in Objective C to replace #include because #include was not able to solve the problem of recursive include. #import make sure that the file included in the source only once.

Question: What is an accessor method?

Answer: An access method related to an object which set which value and property of a class can a class instance invokes.

Question: What is the use of Category in Objective C?

Answer: Categories are used to add extra functionality to an object without making any changes in it.

Question: What is NSArray in objective C?

Answer: In Objective C we use the Foundation Framework NSArray class to handle the Array objects. The NSArray contains many methods to create and manipulate arrays.

Question: What does @synthesize do in Objective-C?

Answer: The @synthesize creates accessor (getter and setter) methods for a variable.

Question: What is Fast enumeration in Objective C?

Answer: When we enumerate through a collection in objective C is known as fast enumeration.

Question: What are collections in Objective C name some of them?

Answer: A collection is a foundation framework object in Objective C which are used to store objects.

Some of the most important collections in Objective C are:

  • NSSet
  • NSArray
  • NSDictionary
  • NSMutableSet
  • NSMutableArray
  • NSMutableDictionary

Question: What is the syntax of method calling in Objective C?

Answer: Method calling syntax outside the class:

[class_name method_name]

Method calling in the same class:

[self method_name]

Question: What is the difference between copy and readonly?

Answer: When we use copy, it creates getters and setters whereas Readonly, only create getters no setters.

Question: What is NSObject in objective C and what its use?

Answer: NSObject is the root class of most Objective C classes and all other classes are derived from it. NSObject is used to allocate and initialize other objects like arrays, string, dictionaries, etc.

Question: When would we use NSArray and NSMutableArray?


  • NSArray: We use NSArray when we do not want any changes in the declares array items.
  • NSMutableArray: We use NSMutableArray when we want an array that declared items to be changed.

Question: How do we create a string object in Objective C?

Answer: We can use NSString and its sub-class NSMutableString to create string Objects.

Question: What is the difference between function calls and messages?

Answer: In a function call, the function and arguments linked together in compiled code whereas the message and receiving object do not link until the program gets executed.

Question: What is id in Objective C?

Answer: The id is a kind of pointer which points an object in Objective C.

Question: What are the blocks in Objective C?

Answer: A block in Objective c helps to form a distinct segment of code that can be passed around the functions or methods as if they were values.

Question: What is a Responder Chain in Objective C?

Answer: When the responder objects get linked in series, they form a Responder chain, which starting point is a responder and endpoint is an app object. The responder chain is used to handle the event if the first responder would not able to handle the event, so the event gets passed to the second object present in the Responder chain.

Question: Does the Objective C support method or function overloading?

Answer: No, Objective C does not support function overloading so for each function we need to define different names.

Question: What is Cocoa?

Answer: Cocoa is an application Environment and covers Object-oriented parts that help to create OSX and iOS Applications.



However, C is not used to build mainstream applications or software, but still, developers use it to write the script for Operating systems. C is very close to hardware and it’s code executes very fast, which make it a perfect programming language to create high quality operating systems. In many interviews related to Operating systems, you may face questions from C, so it’s better to be prepared before you go for the interview. All the questions we have mentioned above will definitely going to help you to crack the interview. There is no guaranty that the interviewer will ask you the same questions, the only purpose of these C interview questions to provide you with a basic understanding of what kind of questions you can expect during the interview.

If you like this article or have any suggestions, please comment down below and let us know.

You might be also interested in:

Leave a Reply

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