UK Markets close in 4 hrs 49 mins

A high schooler interviewed Apple CEO Tim Cook — and he told her his secret to success

Catherine Clifford

As the CEO of Apple , Tim Cook manages one of the largest tech companies in the world (it currently has a market cap of over $920 billion), but he still wasn't too busy to speak to a high school senior who cold-emailed him asking for a few minutes of his time.

Cook responded to Porter-Gaud high school senior Rebecca Kahn's questions and imparted an invaluable life lesson.

Find "your North Star" and focus your energy on working towards that, says Cook to Kahn, according to Kahn's blog post about the conversation, which took place in November.

Cook retweeted the post Tuesday.

Cook's "objective in life is to work for some higher purpose," he tells Kahn.

It's more important to be excellent at a limited number of tasks than it is to be mediocre at a slew of them, according to Cook.

Apple is "all about doing just a few things, but the few things that we do, we want to make the very best in the world. Because we believe those make a much larger difference in the world than if we were to focus on just making the most," Cook says.

Once you have identified and decided upon your North Star, or your personal guiding principal, "Keep your eye on your North Star, and keep moving," he advises.

The "worst thing to do would be to fail and quit. Failure is just temporary, but quitting lasts forever."

Kahn says she has loved technology since she was young and fondly remembers going with her father to the Apple store in Charleston, South Carolina, where she still lives, to learn about new products. She started coding in lower school and reached out to Cook because her computer class homework was to interview a "person of interest" in technology.

"As soon as the assignment was announced, one name immediately came to mind: Apple CEO Tim Cook," writes Kahn. "He is not just in charge of the world's largest tech company, but he personally advocates and stands up for things he believes are right. He travels the world and meets with political and innovative leaders.

"What was the likelihood of him even responding to me?"

Kahn was surprised when Cook emailed her back and was nervous to talk to the Apple executive. He was charming though, she says. "Call me Tim — Mr. Cook is my father's name," Cook told to Kahn.

Now, the conversation between Kahn and Cook inspired Apple and the National Center for Women & Information Technology (NCWIT), of which Kahn is a member, to help others have the same opportunity. The "Innovator to Innovator" program, announced Tuesday and to be run by NCWIT, will pair young women with an interest in STEM with Apple executives for a conversation about "personal philosophies, past experiences, and pivotal influencers."

Apple is a sustaining partner of the NCWIT and donated $10 million to the organization in 2015.

Cook has talked about the importance of a meaningful mission before.

"My advice to all of you is, don't work for money — it will wear out fast, or you'll never make enough and you will never be happy, one or the other," Cook said after receiving an honorary degree from The University of Glasgow in February.

"You have to find the intersection of doing something you're passionate about and, at the same time, ... is in the service of other people," he says. "I would argue that, if you don't find that intersection, you're not going to be very happy in life."

See also:

Apple CEO Tim Cook explains why he'd rather be the best than the first

Apple CEO Tim Cook: 'The world is full of cynics and you have to tune them out'

Apple CEO Tim Cook: 'Don't work for money ... you will never be happy'

Like this story? Like CNBC Make It on Facebook