Set - 2

Question 11 :

Tell how to check whether a linked list is circular ?

Answer :

Create two pointers, each set to the start of the list. Update each as follows:

while (pointer1) {
	pointer1 = pointer1->next;
	pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
	if (pointer1 == pointer2) {
		print (\"circular\n\");


Question 12 :

What is the difference between ARRAY and STACK?

Answer :

STACK follows LIFO. Thus the item that is first entered would be the last removed.
In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be followed here to remove a particular element.

Question 13 :

What is the difference between NULL AND VOID pointer?

Answer :

NULL can be value for pointer type variables.
VOID is a type identifier which has not size.
NULL and void are not same. Example: void* ptr = NULL;

Question 14 :

What is precision?

Answer :

Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point.

Question 15 :

What is impact of signed numbers on the memory?

Answer :

Sign of the number is the first bit of the storage allocated for that number. So you get one bit less for storing the number. For example if you are storing an 8-bit number, without sign, the range is 0-255. If you decide to store sign you get 7 bits for the number plus one bit for the sign. So the range is -128 to +127.