Taking your last example first: do you understand the gerund phrase? This is a phrase that begins with a gerund, where the -ing form of the verb acts like a noun.
I enjoy (sitting on my roof)
I remember (seeing the Beatles in concert)
In the same way "knowing ..." is a gerund phrase that is the object of "do you remember (X)?"
Do you remember (knowing how to play the guitar)?
Take this and change it to the present perfect, which indicates a life experience:
(I have known how to play the guitar.) Do you remember having known how to play the guitar?
(I have worked with Java) Do you recall having worked with Java?
In a similar way, the "to be" verb "is" can be used as a gerund:
(It is open) I remember it being open.
(It is defined in the manual) It is no less confusing, even after being defined in the manual.
This syntax is convoluted and I personally don't recommend using it, if possible. Most of these examples are better when written with simpler grammar:
There is a difference between the practical knowledge you get from working in Java, and the knowledge required to pass this test.
Have you known more than one Amit ... in your life?
I think the difference is primarily one of register. get asked is conversational whereas am asked is neutral.
to be asked
to get asked
get + past participle asked emphasizes the transitive nature of ask. Perhaps that makes it a tad "rougher".
Best Answer
These two sentences are both in the passive voice, indicated by the passive(past) participle held. Both are passive voice, so this has no effect on our choice of sentence.
The first is being held is present continuous and the second is held is present simple. Here is a tutorial that explains the differences in usage for these two forms.
Present continuous is used for a situation which is temporary, or happens regularly before and after a given time, or is happening before and after the moment of speaking.
Present simple is used for things that are regularly, continually or are generally true.
Astronomical things change over immensely long timescales, so we talk about them as if they were generally true. The correct sentence therefore uses present simple:
The Earth is held by the gravity of the Sun and orbits around it.