What viewers would have assumed from the beginning of TOS is that until proven otherwise Starfleet is like a 20th century navy. Thus they would assume that Starfleet Academy is like a modern service academy of various modern nations, especially the USA.
Generally speaking we would assume that future officers entered Starfleet Academy aged 17 to 22 (usually at 18) and usually had a four year course before graduating age 21 to 26 (usually at 22). Sometimes a cadet would take longer to graduate, thus explaining Merrick failing a simulator test in his fifth year and sometimes they would be rushed through to graduate early when there was a war or fear of war.
Generally speaking we would assume that the minimum age for enlistment as an enlisted man would usually be 18 with some 17 year old enlistments.
This would be consistent with the mid 20th century American navy.
Captain Kirk's biography in The Making of Star Trek (1968) says that Kirk entered Starfleet Academy at 17, the minimum legal age. If Kirk entered the academy in September of one year aged 17.000 to 17.999 he would have completed his first or "plebe" year the next June aged about 17.75 to 18.749.
In "Shore Leave" Kirk encounters Finnegan, an upperclassman who harassed Kirk during Kirk's Plebe year:
FINNEGAN: I never answer questions from plebes, Jimmy boy.
KIRK: I'm not a plebe. This is today, fifteen years later. What are you doing here?
Adding about 14.000 to 15.999 to kirk's age of 17.000 to 18.749 gives an age of about 31 to 34.748 for Kirk in "Shore Leave" a first season episode that might be about a year or so before second season episodes. And in the second season episode "The Deadly Years" Kirk's age is established:
COMPUTER: Working. Subject's physical age based on physiological profile, between sixty and seventy two. Aging rapidly.
KIRK: No, I'm thirty four. I'm thirty four years old.
So this suggests that Kirk did enter Starfleet Academy aged about 17.
In "Charlie X" Charlie is said to be seventeen several times. Yeoman Janice Rand, annoyed by his attentions, tried to find a suitably aged girlfriend for Charlie:
RAND: Oh, Charlie. I was looking for you. I'd like you to meet Tina Lawton, Yeoman Third Class. Charlie Evans.
TINA: Hello, Charlie.
RAND: I thought you might enjoy meeting someone your own age.
CHARLIE: Can I talk to you, alone.
RAND: Charlie, Tina's
TINA: Excuse me. I must be wanted somewhere.
I figured that Yeoman Tina "Lizard Girl" Lawton was 17 or 18 and about the minimum age to be a starship crewperson.
When I first saw Star Trek II: The Wrath of Khan Midshipman Peter Preston looked a bit short and young to be in Starfleet, until I recognized the actor Ike Eisenmann and figured that he should have been about 18. Curiously both the script and the novelization by Vonda Mcintyre describe Peter Preston as 14. Presumably they were written before someone changed their mind and cast an older (but not very tall) actor in the role.
So if we assume that for the typical and ordinary admission into Starfleet Academy seventeen is the minimum age, as it is today, what should we make of this dialog from "Coming of Age":
Other young people enter)
T'SHANIK: Oliana. (to Wesley) T'Shanik of Vulcana Regar.
WESLEY: Wesley Crusher of the Enterprise.
T'SHANIK: You do not look as if you meet the age requirements.
WESLEY: Uh, I'll be sixteen next month.
OLIANA: Happy birthday.
It does seem a bit early to take the normal entrance examinations to enter Starfleet academy about 1.0833 years before the minimum legal age to enter. So possibly what Wesley, Oliana, T'Shanik and Mordock were trying for was a space in a special program for early entry for young geniuses.
Many fans have debated how military Starfleet is. But it is obviously at least partly military and at least partially civilian.
Under current law, it is legal to enroll children and adults of all ages in schools of all types, although mandatory schooling usually has legal age ranges.
Under current law in most US states, 16 is the minimum age to have most types of jobs except those that are forbidden to minors. Of course in Star Trek, especially in the Next Generation era, employment for pay might not exist - that is another controversy. So minors of various ages might take part in various cultural and scientific and technological and humanitarian activities of various branches of Starfleet according to their abilities while being members of starfleet to a greater or lesser degree while not being employed by Starfleet. Such hypothetical "junior starfleet auxillary" members of Starfleet might be in some type of educational program stressing learning by doing and with rewards of space travel and pride of accomplishment instead of pay.
But some proportion of Starfleet members take part in military and naval activities.
Many discussions of American Civil War soldiers say that the army had a minimum age for enlistment. Actually the 19th Century regular army and volunteers had three separate minimum ages at the same time.
Along with maximum enlisted ages, the usual minimum age for enlistment was 21, then the legal age of majority. Minors aged 18 and over could enlist with the permission of parents or guardians. And it was regulation to enlist as a drummer, fifer, bugler, or trumpeter - a musician - at younger ages. If memory serves, at one point the wording was something to the effect that recruiters need not follow the age and height requirements for musicians or reenlisting soldiers. And sometimes a few boys were enlisted as musicians so young that if I told you you might think it was science fiction instead of history.
Since 2002 conscripting or recruiting children under the age of 15 into armed serves or using them in combat is defined as a war crime. Forcing children under the age of 18 to participate in combat is illegal. Children aged 15 to 17 can voluntarily serve in combat. Governments are required to take all feasible steps to avoid using soldiers under 18 in direct hostilities.
I believe that education in a service academy does not count toward an officer's years of service, which begin when he/she graduates and is commissioned. So perhaps military and naval cadets are not exactly or totally in the military and in the future their status could be changed to be totally outside the military if desired.
So Starfleet can abide by the current international laws and still enroll kids of any age - if qualified - in Starfleet Academy, and can graduate them at any age - if they pass the tests - and give them commissions or other positions in Starfleet, so long as they are in the non military branches of Starfleet.
And starfleet can abide by current international laws and still enlist and/or commission kids age fifteen and older in the military branches of starfleet so long as they take all feasible steps to keep them out of direct hostilities.
So possibly in the era of Star Trek most enlisted and officer personnel join starfleet the way they do in the modern navy and at the same age range as in the modern navy. But possibly there are special programs for gifted kids to enter Starfleet Academy early and perhaps graduate and be commissioned early.
Wesley Crusher may have been tested for one of those special programs with a small number of admissions in "Coming of Age".
And it is possible that some characters did enter Starfleet Academy younger than normal through those programs for gifted kids. There are chronological reasons o suspect that Kirk, Spock, both Chekovs, Peter Preston, Garth of Izar, etc. may have done so.
Thus the test that Wesley took in "Coming of age that seems illogical as a admissions test for countless thousands of persons entering Starfleet Academy in the normal way each year does not seem so weird if used to select a few precocious kid for a special admission program.