This question already has an answer here:
This was in a collection I read in the 80s. Target group was Young adult and I think the theme was education, entering adulthood, etc. I can't recall the names or characters. Collection was hardback. This is one of two stories in this collection I am curious about and will post about.
It was a short story where everyone gets assessed at end of their teenage years for their roles in life. This bright but lazy kid gets assessed and finds he's been assessed for a menial job where he'll probably have brain surgery to keep him happy in it. Nothing is to happen for a few days.
Panicking and angry, he goes off, changes records, hacks into the systems and alters the aptitude machines so they changes his assignment and he becomes an executive with unlimited perks. Then he meets a stranger who reveals it was all a test to poke him out of his apathy because the city needs the brightest people to keep running, but needs them motivated. If he hadn't cheated he would indeed have been lobotomised, etc.