Kobayashi Maru scenario
It was primarily used to assess a cadet's discipline, character, command and decision-making capabilities when facing an impossible situation, as there is no one answer to the problem.
In the scenario, a cadet is placed in command of a starship on patrol near the Federation-Klingon border. The starship would receive a distress signal from the "USS Kobayashi Maru", a civilian freighter that had been disabled after having struck a "gravitic mine." If the cadet chose to enter the neutral zone between the border, which would be in violation of treaties, the starship would be confronted by three Klingon battle cruisers. The test was considered a no-win scenario because it was impossible for the cadet to simultaneously save the Kobayashi Maru, avoid a fight with the Klingons, and escape from the neutral zone with the starship intact. A cadet's choice of how to handle the rescue operation gave great insight into his or her command decision-making.
In the 2250s, James T. Kirk became the first (and only known) cadet to ever beat the no-win scenario. After taking the test and failing twice, Kirk took the test a third time after secretly reprogramming the computer to make it possible to win the scenario. Kirk was subsequently awarded a commendation for "original thinking" and later commented, wistfully, that his stunt "had the virtue of never having been tried." Kirk would later defend his "cheating" by arguing that he didn't believe in the no-win scenario. Ironically, Kirk also defended the test itself by suggesting, "How we face death is at least as important as how we face life."
The term "Kobayashi Maru" may be sometimes be used as a slang term for any hopeless situation in the 23rd century, at least in Starfleet culture.
Spock once stated that he had never taken the Kobayashi Maru test, suggesting the test may have been introduced in the period between Spock's Academy training and Kirk's.
However, it is also possible that, as a science officer for much of his Starfleet career, Spock was not required to take the test.
It is also possible that Spock had a role in designing the Kobayashi Maru test; he may have never taken it himself precisely because he was the program's designer.