C Programming Interview Questions and Answers - 7

Question: 31

What is the use of semicolon(;) at the end of every program statement?

It has to do with the parsing process and compilation of the code.

A semicolon acts as a delimiter, so that the compiler knows where each statement ends, and can proceed to divide the statement into smaller elements for syntax checking.

 

Question: 32

What is the difference between single equal “=” and double equal “==” operators in C?

Single equal is an assignment operator used to assign the values to the variables.

But, double equal is relational operator used to compare two variable values whether they are equal or not.

Question: 33

Where should typecast functions not used in C?

Type cast function should not be used in const and volatile declaration.

Because, constant value can’t be modified by the program once they are defined.

And, volatile variables values might keep on changing without any explicit assignment by the program as operating system will be modifying these values.

Question: 34

What is the use of “# define” in C?

#define is a pre-processor directive which is used to define constant value. This constant can be any of the basic data types.

Question: 35

How will you print “Hello World” without semicolon?

int main (void)

{

if (printf(“Hello World”));

}

Related Questions