C Language Interview Questions and Answers for Experienced - 9

Question: 41

What is Macro?

Macro is a name which is given to a value or to a piece of code/block in a program.

Instead of using the value, we can use macro which will replace the value in a program.

Syntax: #define<MACRO_NAME>VALUE

Question: 42

What is the difference between while loop and do while loop?

In the while loop the condition is first executed. If the condition is true then

It executes the body of the loop. When the condition is false it comes out of the loop.

 

In the do while loop first the statement is executed and then the condition is checked.

The do while loop will execute atleast one time even though the condition is false at the very first time.

Question: 43

How do you open the file?

The File is opened by the statement

        fp=fopen(“file_name”,”mode”);

Where fp means file pointer, mode is the file opening mode, such as write,read, or append mode.

Question: 44

What are the types of errors occurred in C program?

There are four types of errors occurred during the program execution.

  1. Syntax errors
  2. Runtime errors
  3. Logical errors
  4. Latent errors

Question: 45

What is the modulus operator?

The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol.

Related Questions