Name of a cognitive test assessing whether a child can think independently
The first one is a test if a child has understood conservation of matter. It is an example of a conservation task. These belong to the tests used in the framework of Piaget to test what stage of development a child is in.
Here is a video demonstration of the cookie task. Here is another question on this site pertaining to a different conservation task.

The second one is an example of a false-belief task test for the Theory of Mind. See here for some criticism of the false-belief task, questioning if it truly tests what it aims to test.

I don't think it's appropriate to say either of these is used to test if children are "thinking on their own" for what it's worth. They're about developmental stages.