Home • About Simply Explained  • Contact Us • 

hello
Questions answered by Mr Pramod S Nair  India   (Expert Rank: 2226) Member has an expert rating of 100+
 

Where is John o Groats?

Discuss this question

Question found in Miscellaneous
John o' Groats is a village in Scotland and it is situated in the county of Caithness. It is mistakenly regarded as the most northerly settlement on the mainland of Great Britain, but actually that distinction goes to the nearby hamlet of Dunnet Head.

John o'Groats takes its name from one Jan de Groot, a Dutchman who obtained a grant for the ferry from the Scottish mainland to the island of Orkney from the Scottish King James IV in 1496. The last house, the last house museum and the castle of Mey are some of the places of interest here.

click to see other answers to this question
Discuss Answer

Do fish sleep?

Discuss this question

Question found in Animals & Nature
Yes, fish do sleep. But this behavior can be drastically different in different species of fish. Almost all fish spend time in an energy-saving state that can be called rest or sleep but it is probably different than the sleep in most land
animals. Some fish and amphibians reduce their awareness but do not ever become unconscious like the higher vertebrates do. Fish have time periods when they become less aware of their surroundings but their brain waves do not change, and they do not exhibit REM sleep. They aren't quite asleep but they don't seem to be fully awake either. And fish do not close their eyes because they have no eyelids.

Some fish undergo a yearly sleep cycle. They hibernate and their metabolic rate slows down. Although they do not hibernate like mammals, as environmental temperatures fall, their metabolic rate and activity decrease, and they go into a stupor and stop feeding. They usually adopt a position towards the bottom of the pond.

Some fish are motionless in the water during the night, while other fish, like rockfish and grouper, don't appear to sleep at all. They rest against rocks, bracing themselves with their fins. Some freshwater fish, like catfish, swim up under a log or river bank for shelter during the day. Some fish (like tuna and shark) rely on water moving constantly through their moths to breathe, so inactivity is not an option for them.

click to see other answers to this question
Discuss Answer

In 1872, two Hungarian towns on either side of the Danube river merged to become one city. What was the name of the two towns?

Discuss this question

Question found in People & Places
The Hungarian capital city Budapest is that town that was made by the merger of two towns. Until 17th November 1873, there were two cities separated by the river Danube. They were Buda or Obuda on the Western bank of Danube and Pest on the Eastern bank. On 17th November 1873 they were amalgamated to form Budapest.

click to see other answers to this question
Discuss Answer

What is UK population now?

Discuss this question

Question found in People & Places
Just above 60 million.

click to see other answers to this question
Discuss Answer

What does sand dollars eat?

Discuss this question

Question found in Animals & Nature
Sand dollars are a type of Echinoderm (which are notable for their movable spines) are closely related to starfish and sea urchins. There are about 6,000 living species of them.

They usually eat tiny particles of food that float in the water. They mainly feed on small worms, algae, detritus and some times small fishes. They eat the food by consuming it on the underside of itself, and with a set of five teeth, chew and swallow its food.

click to see other answers to this question
Discuss Answer

What is interesting about the temperature of -40 degrees?

Discuss this question

Question found in Science In General
As our expert Mr Scott Liddell pointed -40 degrees Celsius is equal to -40 degrees Fahrenheit.

click to see other answers to this question
Discuss Answer

In these two programs below

in one we have to declare 'sum'

variable as 'static' and in other not.

Why?

#include

sumdig(int);

void main()

{

int a;

a=sumdig(12345);

printf("\n%d\n\n",a);

}

sumdig(int num)

{

static int sum;

int a,b;

a=num%10;

b=(num-a)/10;

sum=sum+a;

if(b!=0)

sumdig(b);

else

return(sum);

}

#include

int add(int);

void main()

{

int num,sum;

scanf("%d",&num);

sum=add(num);

printf("sum =%d\n",sum);

}

int add(int n)

{

int sum=0,temp;

if(n==0)

return(0);

else

{

temp=n%10;

n=n/10;

sum=temp + add(n);

}

return(sum);

}

Discuss this question

Question found in Programming
Dear ASHISH SINGHAL,

As you know both the programs does the same task i.e, returning the sum of all the digits in a number passed into a function. But each of the code does this functionality in a slightly different way. I will explain the piece of logic that is different in these programs and that will clear your doubt.

The key difference is in the way in which the 'sum' variable, which is used to keep the running total or sum, is declared in each of the code.

In the first program, we are declaring the sum variable inside the body of sumdig() function. The whole body of sumdig() is a local block according to the scope law in C, and that law states that a variale declared inside a local block lives only during the execution of the local block. When local block ends the variable evaporates from the memory. Here we are calling the sumdig() function multiple times and we need the sum variable to hold a running total got from each function execution. If we declare the sum variable as a normal scoped variable we won't be able to keep the running total, as for each call of the sumdig() function, the c compiler will recreate the sum variable there by losing it's previous contents. If we declare a variable as a static one then the compiler will extend it's living time till the end of the total program and such static variables are initialized only once in the total scope of the program. So here the 'static int sum;' get's initialized only on the first call of sumdig() and it will retain the values stored in it from the previous function calls.

NB : I think you have a small typo in the first code. Here the return(sum), statement shouldn't fall inside the else part, so remove the else part else you will not get the digits sum as the result.

In the second program the add() function is a part of a statement 'sum=temp + add(n);' and so each time the add(n) is found in the statement the compiler jumps to the next add() function and the previous add() waits for it's retun. So when the last add() get's executed then the return velues from each function is return to the previous one in a cascading and reverse order. so the summation statement get's executed in a single step and there is no need for the sum variable to store the previous sum as the previous sum comes as the return of the add() function to the previous function call.

Suppose the number is 123 so the steps will be like this

1. In the first function call the statement is sum = 3 + add(12) ---> the add(12) function is called and the rest of the statement 'sum = 3 +' waits for the add () functions return value.

2. Inside the add(12) function there is a statement which gets populated as sum = 2 + add(1). Now the add(1) is called and rest of the function waits.

3. Inside the add(1) function there is a statement which gets populated as sum = 1 + add(0). Now the add(1) is called and rest of the function waits.

4. Inside the add(0) function function the (b!=0) checking gets true and returns 0 to the add(1) function.

5. So Inside the add(1) function the statement gets populated as sum = 1 + 0. Now sum is 1 and it gets cascaded to add(12).

6. So Inside the add(12) function the statement gets populated as sum = 2 + 1. Now sum is 3 and it gets cascaded to add(123), ie, the first function call.

7. So Inside the add(123) function the statement gets populated as sum = 3 + 3. Now sum is 6 and it is returned to the main program.

As we are using the cascading returns as part of our summation statement there is no need for keeping a static variable.

click to see other answers to this question
Discuss Answer

In what way is uv-b radiation hazardous to the health of humans?

Discuss this question

Question found in Science In General
Prolonged exposure of any of the UV radiations can cause serious health hazards for human beings. They affect the eyes, skin and overall immunity of the humans.

UVB rays can damage the collagen fibers and this will contribute to premature aging of skin.
They can also cause DNA damage and skin cancer. The radiation excites DNA molecules in skin cells, causing covalent bonds to form between adjacent thymine bases, producing thymidine dimers. Thymidine dimers do not base pair normally, which can cause distortion of the DNA helix, stalled replication, gaps, and misincorporation. These can lead to mutations, which can result in cancerous growths.

High intensities of UVB light are hazardous to the eyes, and exposure can cause welder's flash (photokeratitis or arc eye) and may lead to cataracts (The opacity that develops in the crystalline lens of the eye or in its envelope.), pterygium (growth of the conjunctiva.), and pinguecula (conjunctival degeneration) formation.

Sunscreens and sunglasses can provide defensive measures to these radiations.

click to see other answers to this question
Discuss Answer

What is the name of the MP in stroud?

Discuss this question

Question found in People & Places
From 1997 David Drew of Labour Party is the member of parliament from Stroud.

click to see other answers to this question
Discuss Answer

How long would it take a flight from London to get to Maui?

Discuss this question

Question found in Miscellaneous
The approximate distance from Kahului Airport in Maui to London Heathrow is 7,237 miles ( 11,644 kms) and a flight via San Francisco or LA can take around 18 hours.

click to see other answers to this question
Discuss Answer
Page - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 -
 Top of Page Terms and Conditions Privacy Disclaimer

© Simply Explained