The answers have already been posted, but even if you couldn't find the questions you should be able to figure out their targets.
1.There are eight balls. One of them is defective.
You have a collection of items, and one has a special quality (it's defective). The only thing that you could possibly be asked is to find that one item amongst the collection.
You've got 8 items, which is 2^3, so take a wild guess and it's almost certainly going to be a divide-and-conquer binary-search problem.
The more interesting problem is where there are 9 balls, and you need to find the special ball with only two weight comparisons.
2.There are three electric birds inside a room, but switchers are placed outside.
I don't know what an electric bird is, but there are three objects. You have 'swiches outside', which means you are able to set some boolean property (on/off) but are not sure of the effect.
Given the three objects and the boolean property, an educated guess is that you will need to consider three-state logic (each of the object / birds should exhibit one of three states). Three state logic is like a nullable boolean - something is 'true', 'false', or 'not really either / indeterminate'.
It would be much better to go through this sort of logic in your interview that rote off the answers that you've read online.