The aptitude exams are there to find out how well you can do something without being taught. So it is very unlikely that you will be taught these in school but you have to keep practising on your own to get better at solving them.

Each one of them has a rule and you must be able to identify the rule to be able to solve them.

Start by studying the given samples