Skip to content

C Programming Interview Questions 001

Dibyendu Barman edited this page Dec 9, 2022 · 1 revision

1. What do you mean by Dangling Pointer Variable in C Programming?
Ans: A Pointer in C Programming is used to point to the memory location of an existing variable. In case that particular variable is deleted and the Pointer is still pointing to the exact memory location, then that particular pointer variable is called a Dangling Pointer Variable.

2. What do you mean by the Scope of the variable? What is the scope of the variables in C?
Ans: The scope of the variable can be defined as the part of the code area where the variables declared in the program can be accessed directly. In C, all identifiers are lexically (or statically) scoped.

3. What are static variables and functions?
Ans: The variables and functions that are declared using the keyword Static are considered as Static Variable and Static Functions. The variables declared using the Static keyword will have their scope restricted to the function in which they are declared.

4. Differentiate between calloc() and malloc()
Ans: calloc() and malloc() are memory dynamic memory allocating functions. The only difference between them is that calloc() will load all the assigned memory locations with the value 0 but malloc() will not.

5. What are the valid places where the programmer can apply the Break Control Statement?
Ans: Break Control statement is valid to be used inside a loop and Switch control statements.

6. How can we store a negative integer?
Ans: To store a negative integer, we need to follow the following steps. Calculate the two’s complement of the same positive integer.
Eg: 1011 (-5)
Step-1 − One’s complement of 5: 1010
Step-2 − Add 1 to the above, giving 1011, which is -5

7. Differentiate between Actual Parameters and Formal Parameters.
Ans: The Parameters which are sent from the main function to the subdivided function are called Actual Parameters and the parameters which are declared a the Subdivided function end are called Formal Parameters.

8. Can a C program be compiled or executed in the absence of a main()?
Ans: The program will be compiled but will not be executed. To execute any C program, main() is required.

9. What do you mean by a Nested Structure?
Ans: When a data member of one structure is referred by the data member of another function, then the structure is called a Nested Structure.

10. What is a C Token?
Ans: Keywords, Constants, Special Symbols, Strings, Operators, and Identifiers used in the C program are referred to as C Tokens.

Clone this wiki locally