C Programming Question Bank with Answers Pdf - 1

Question: 1

What is arithmetic operator in C?

C Arithmetic operators are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus in C programs.

Arithmetic operators are +, -, *, /, %.

Question: 2

Is pointer arithmetic a valid one?

Pointer arithmetic is not valid one. Pointer addition, multiplication and division are not allowed as these are not making any sense in pointer arithmetic.

Question: 3

What is the difference between call by value and call by reference?

When using Call by Value, you are sending the value of a variable as parameter to a function.

Where Call by Reference sends the address of the variable. Also under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the functions.

Question: 4

When can void pointer and null pointer be used in C?

Void pointer is a generic pointer that can be used to point another variable of any data type.

Null pointer is a pointer which is pointing to nothing.

Question: 5

Is void pointer arithmetic a valid one?

Arithmetic operation on void pointer is not valid one. Void pointer is a generic pointer.

It is not referring int, char or any other data type specifically.

So, we need to cast void pointer to specific type before applying arithmetic operations.

Error Report!

Related Questions