1)You have 10 marbles and one is heavy. How many minimum iterations are needed to find the heavy marble.
2) There are two jars of capacity 5 and 3 liter. How to measure 7 liter of water using these two jars.
The first question gives incomplete data. If you assumed one marble is of weight X and the other nine are of weight <X, the question is about search efficiency; in this case I suspect they are looking for someone to do a binary-like search: comparing 5 marbles to the other five, discarding the lighter pile, comparing two of those to another two, and either selecting the odd marble out if both sets of two or equal, or comparing one of those sets. This gives you a minimum of 2 iterations (for best-case; 3 iterations to select the heaviest marble no matter the situation). If the marbles are of arbitrary weight and you need to find the heaviest, then the answer is completely different.
1) Compare 5 marbles to another 5. The heavier pile contains the heavy marble. Discard the lighter pile.
2) From the heavy pile, compare any 2 marbles with any other 2.
IF the same piles are the same weight, the heavy marble is the one you're not holding. The end.
3) ELSE, compare the two marbles from the heavier set found in step 2. The end.
The second question has already been answered, assuming infinite supply of water:
-Fill 5 liter jar to capacity
-From the 5 liter jar, fill the 3 liter jar to capacity
-Empty the 3 liter jar
-From the 5 liter jar, transfer the remaining 2 liters to the 3 liter jar
-Fill the 5 liter jar to capacity
You now have 5L in a five liter jar, and 2L in a three liter jar.