-
Notifications
You must be signed in to change notification settings - Fork 0
C Programming Interview Questions 002
Q1. What is Preprocessor?
Ans: A Preprocessor Directive is considered as a built-in predefined function or macro that acts as a directive to the compiler and it gets executed before the actual C Program is executed.
Q2. Why is C called the Mother of all Languages?
Ans: C introduced many core concepts and data structures like arrays, lists, functions, strings, etc. Many languages designed after C are designed on the basis of C Language. Hence, it is considered the mother of all languages.
Q3. What is the purpose of printf() and scanf() in C Program?
Ans: printf() is used to print the values on the screen. To print certain values, and on the other hand, scanf() is used to scan the values. We need an appropriate datatype format specifier for both printing and scanning purposes. For example,
%d: It is a datatype format specifier used to print and scan an integer value.
%s: It is a datatype format specifier used to print and scan a string.
%c: It is a datatype format specifier used to display and scan a character value.
%f: It is a datatype format specifier used to display and scan a float value.
Q4. What is an array?
Ans. The array is a simple data structure that stores multiple elements of the same datatype in a reserved and sequential manner. There are three types of arrays, namely,
One Dimensional Array
Two Dimensional Array
Multi-Dimensional Array
Q5. What is /0 character?
Ans: The Symbol mentioned is called a Null Character. It is considered as the terminating character used in strings to notify the end of the string to the compiler.
Q6. What is the main difference between the Compiler and the Interpreter?
Ans: Compiler is used in C Language and it translates the complete code into the Machine Code in one shot. On the other hand, Interpreter is used in Java Programming Langauge and other high-end programming languages. It is designed to compile code in a line-by-line fashion.
Q7. Can I use int datatype to store the 32768 value?
Ans: No, Integer datatype will support the range between -32768 and 32767. Any value exceeding that will not be stored. We can either use float or long int.
Q8. What is Dynamic Memory allocation?
Ans: Dynamic Memory Allocation is the process of allocating memory to the program and its variables in runtime. The dynamic Memory Allocation process involves three functions for allocating memory and one function to free the used memory.
Q9. Where can we not use &(address operator in C)?
Ans: We cannot use & on constants and on a variable that is declared using the register storage class.
Q10. Differentiate between getch() and getche().
Ans: Both functions are designed to read characters from the keyboard and the only difference is that
getch(): reads characters from the keyboard but it does not use any buffers. Hence, data is not displayed on the screen.
getche(): reads characters from the keyboard and it uses a buffer. Hence, data is displayed on the screen.