interview questions for c language


Q11: Differentiate between the macros and the functions.

Ans: There are the following descriptions of contrasts between macros and functions:

  • Macro call substitutes the templates for growth.
  • The Macro call speeds up the program but also increases the program's size.
  • Macro is basic and prevents function calls from causing problems.
  • In a function, the call control and parameters are passed to the function.
  • It reduces and compacts the functions.
  • It takes time to pass parameters and obtain the returned value and slower the program to run.

Q12: Compare and contrast compilers from interpreters.

Ans: Compilers and interpreters commonly discuss how to execute program codes. The performers execute one line of program codes, whereas the compilers take the complete program and turn it into object code before it is executed. The main distinction is that a program can meet and halt syntax problems for interpreters in the middle of execution. Compilers, however, examine the syntax of the whole program and only execute if no syntax problems are detected.

Q13: What is the difference between functions getch() and getche()?

Ans: Both functions accept the user's input character value. If you use getch(), you do not see the key pushed on the screen, it is recorded and given to a variable automatically. The key pushed by the user appears on the screen while being allocated to a single variable when using getche().

Q14: What is the difference between near, far, and huge pointers?

Ans: The selector and offset are the components of a virtual address. An explicit selector has no near-pointer, but a large pointer has an explicit selector. The selection is not updated when the pointer arithmetic is executed on the distant pointer, although it can be modified if the pointer is large. The keywords and implementation-specific are non-standard. In a modern platform, these are irrelevant.

Q15: What is the significance of an algorithm to C programming?

Ans: An algorithm must be designed first before a program can be built. A step-by-step method on how to obtain a solution is provided using an algorithm. They also serve as a template for starting and ending a program, including procedure and calculation.