We can split this into small problems and since the pencils are replaced each time it becomes simpler, since one result will not change the other result.
1. What is the probability that you pick one pencil and it's green?
2. What is the probability that you pick one pencil and it's yellow? (Ignore what happened in step 1 and do a new calculation here)
The question asks us to find the probability that both these things happen ("and"), so we can just multiply the two answers from step 1 and 2 to get the final answer.