Top 10 C language Interview Question and Answer
Authored By: Ankita Prajapati
C Language is a general-purpose computer programming language. It was created in the 1970s by Dennis Ritchie, and remains very widely used and influential. By design, C’s features cleanly reflect the capabilities of the targeted CPUs. You must understand the basics of C Language to secure a job related to it. Read the top C Language Interview Question and Answers.
Question 1: What do you mean by Dangling Pointer variable in C programming?
Answer: In C programming, a pointer is used to identify a variable’s location in memory. The term “dangling pointer variable” refers to a pointer variable that has been erased yet the pointer is still referring to the same position in memory.
Question 2: What do you mean by the scope of the variable? What is the scope of the variables in C?
Answer: The portion of the code where variables stated in the program can be directly accessible is referred to as the variable’s scope. All identifiers in C have lexical (or statically) scoped definitions.
Question 3: What are static Variables and Functions?
Answer: Static variables and static functions are those that have the keyword “Static” in their declarations. The scope of variables declared with the Static keyword is limited to the function in which they are used.
Learn the concepts of C with YourEngineer
Question 4: Differentiate between calloc() and malloc()?
Answer: The memory dynamic memory allocating routines calloc() and malloc(). The sole distinction between them is that malloc() will not load a value into any of the designated memory addresses, but malloc() would.
Question 5: What are the valid places where the programmer can apply the Break Control statement?
Answer: A loop and a switch control statement can both contain a break control statement.
Question 6: Differentiate between Actual Parameters and Formal Parameters.
Answer: Actual parameters are those that are transmitted from the main function to the subdivided function, while formal parameters are those that are specified at the subdivided function conclusion.
Question 7: Can a C program be compiled or executed in the absence of a main()?
Answer: Although the software won’t be run, it will be compiled. Any C program must have a main() to run.
Question 8: What do you mean by a Nested Structure?
Answer: A structure is referred to as being nested when a data member from one structure is used to refer to a data member from another function.
Question 9: What is Preprocessor?
Answer: A built-in predefined function or macro known as a preprocessor directive serves as a directive to the compiler and is executed before the execution of the real C program.
Question 10: What are the basic Datatypes supported in C programming Language?
Answer: In general, there are four categories used to group datatypes in the C language. These are what they are:
- Simple Datatypes
- Descendant Datatypes
- Types of Enumerated Data
- Virtual Datatypes
Data type name
Data type size
Data type range
-128 to 127
0 to 255
-128 to 127
0 to 255
-32,768 to 32,767
0 to 65,535
-2,147,483,648 to 2,147,483,647
0 to 4,294,967,295
3.4E-38 to 3.4E+38
1.7E-308 to 1.7E+308
3.4E-4932 to 1.1E+4932
What is YourEngineer?
YourEngineer is the first Engineering Community Worldwide that focuses on spreading Awareness, providing Collaboration and building a focused Career Approach for Engineering Students.