C Programming Basics Questions and Answers Pdf - 1

Question: 1

What is the difference between Logical AND and Bitwise AND?

Logical AND (&&): Only used in conjection with two expressions, to test more than one condition. If both the conditions are true then returns 1.

If false then return 0.

Bitwise AND (&): Only used in bitwise manipulation. It is an Unary operator.

Question: 2

What is the difference between int, char, float and double data types?

Integer data type allows a variable to store numeric values. The storage size of int data type is 2 or 4 or 8 byte. It varies depend upon the processor in the CPU.

Character data type allows a variable to store only one character. Storage size of character data type is 1.

Float data type allows a variable to store decimal values. Storage size of float data type is 4. This also varies depend upon the processor in the CP.

Double data type is also same as float data type which allows up to 10 digits after decimal.

Question: 3

What is the difference between variable declaration and variable definition in C?

Variable declaration tells the compiler about data types and size of the variable. Whereas, variable definition allocates memory to the variable.

Variable can be declared many times in a program. but definition can happen only one time for a variable in a program.

Variable declaration is for assignment of properties and identification to a variable. Whereas, variable definition is for assignments of storage space to a variable.

Question: 4

What is the difference between auto variables and static variable in C?

Both auto and static variables are local variables.

Static variables can retain the value of the variable between different function calls.

But, scope of auto variable is within the function only. It can’t retain the value of the variable between different function calls.

Question: 5

List out any unary operators and their functions.

++ Increment

-- Decrement

* Indirection

& Address of

! Negation (logical NOT)

Related Questions