The primary method of determining if someone has the mental aptitude required to be an enlisted member of the United States Military is the Armed Forces Vocational Aptitude Battery (ASVAB).
The ASVAB consists of nine subtests, which the military uses to form composite score which show what military jobs you qualify for.
However, most importantly, four of the ASVAB subtests (Word Knowledge, Paragraph Comprehension, Mathematics Knowedge, and Arithmetic Reasoning) comprise a score that the military calls the Armed Forces Qualification Test (AFQT) score. This score determines whether or not you are qualified to join the service of your choice. Each service branch has their own minimums. For details, see my article, Minimum ASVAB Scores.