What questions should an STL expert answer in an interview

I watched a job announcement recently, and one of the requirements was that a person would have 9/10 in their STL knowledge.

When I judge my skills, I am 10 people who writes advanced books on this subject, such as John Skeet (C #), John Resig (JavaScript) or Martin Odersky (Scala).

So 9/10 is basically 10, so I'm not sure what to expect at this level.

An example of some questions can be found at: http://discuss.joelonsoftware.com/default.asp?joel.3.414500.47

Obviously, some encoding will be required, but you should expect that everything will be remembered, since there is very little in the STL.

In some cases, Boost libraries extend the STL, so you should expect that I will use Boost as well, because sometimes I can confuse which function came from which of the two libraries.

I'm trying to figure out if I can answer the questions that are expected from an STL expert, although it is strange that being a C ++ expert was not required.

UPDATE

After thinking about the answers to my question, it seems that what they can look for is someone who can see the limits of the STL and expand the library, which I have not done yet. I'm used to thinking within what STL and Boost give me and stay within the lines. Perhaps I will need to look at whether it was too restrictive and see if I can go outside the box. Hope they don't mean 9 like google. :)

+6
c ++ stl
source share
5 answers

Funny - I don’t consider myself 9/10 in STL (I was, but now a little rusty), and I completely agree with @joshperry an important terminological difference (I was often recorded as an accusation of STL abuse, meaning "parts of the C ++ standard library that were originally inspired by SGI STL "!), but I believe its sample code is smaller than" optimally STL-ish ". I mean, for this task, "Put all the integers in the vector in the standard." Why would anyone ever code, as @joshperry suggests,

for(std::vector<int>::iterator it = intVect.begin(); it != intVect.end(); ++i) std::cout << *it; 

not the obvious:

 std::copy(intVect.begin(), intVect.end(), std::ostream_iterator<int>(std::cout)); 

or the like ?! For me, this might suggest that they do not know about std::ostream_iterator , especially if they should show their knowledge of STL, why shouldn't they flaunt it? -)

In my current employer, to help applicants independently assess technology competencies, we offer a useful guide - “10: I invented this technology, 9: I wrote a book about it,” and so on. So, for example, I would be 9/10 in Python - only my colleague and friend Guido can qualify for 10/10. STL is an interesting case: while Stepanov managed the design, my colleague Matt Ostern made the first implementation and wrote a “book” about this too ( this one ) - so I think he would have got it if it hadn’t 10, but 9.5 . By this standard, I could be somewhere between 7 and 8 if I could spend an hour updating (custom allocators and traits are always complicated, or at least as I remember them!).

So, if you are researching someone who claims to be 9, cut them into really hard parts like custom allocators and traits - apparently they won't miss a beat on all containers, algorithms and special iterators, so don't waste a lot of time for interviewing topics (which would be key if you were studying 7 or 7.5). Perhaps ask them to give an example in real life, where they used custom traits and / or dispensers, and also encode all implementation details, as well as several examples of use.

By the way, if you need a complete set on the C ++ standard library at an advanced level, I am told by knowledgeable and not rusty friends that the Josuttis book is currently even more useful than my friend Matt (unfortunately, I never read Josuttis in depth , so I can’t confirm or refute this - I see that the book has five stars on Amazon, which is impressive ;-).

+11
source share

This is just a dumb job requirement. When you hire, you need the best programmer good , and the second - the second.

It would be reasonable, on this day and at the age, to expect knowledge / dating / etc. with STL. But if the job is not intended to redefine STL, you don't need 9/10. Even if this is a task, you still need a great programmer who has a lot of experience with templates (not just using).

For example, for all the answers to “output integers of a vector”, probably the same code is generated. Only the version that has been programmed to handle any container of any item shows a hint of "excellent" and good (just a hint). those. ability to abstract.

Anyway, just go for it. Be prepared to use STL to solve other problems. Nothing more.

(In fact, for most of the interviews I was in, the requirement was NOT to use STL, i.e. write a function that changes the line. My first answer is that something is probably happening in std lib to do this, then they say it is correct, of course, but what if you had to write it yourself ...)

+2
source share

I should state this, noting that I believe that the same criteria should apply not only to the STL (no matter which definition you prefer for this), but to many other types of things.

From my point of view, just knowing the existing STL components and the possibility of their application should probably not qualify as 9/10. Rather, I would consider this level around 7/10. 8/10 is when a person can expand STL by providing new components that follow their philosophy and are compatible with existing components, naturally and easily.

By 9/10, I expect to see someone who can not only provide new components, but also improve some of the existing ones, such as Boost :: bind. Over the course of 10/10, I would expect this to go beyond the rather sharp local improvements of 9/10 and move to a more architectural level, for example, using ranges instead of separate iterators. For a specific example, consider the difference between Boost ranges and Andrei Alexandrescu’s ideas for ranges. Boost ranges are convenient, useful, and convenient, but they change what you type, not how you think. Andre's version of the ranges is much more comprehensive - an architectural solution that changes how you design and think about code, not just how you enter it.

+2
source share

9/10 is very subjective. I was asked good questions about STL. Here are some examples:

  • When you should use deque vs vector (knowing how they are internally implemented is useful)
  • Recognize STL code that uses invalid links, or may end up using invalid links.
  • Implement simple operations in different containers and know where and when to use std :: algorithm vs container member functions.
+1
source share

Well, you could go into the interview and say: "I noticed that your publication asked someone who knows in the STL, but this term is sometimes used to mean: (1) the standard C ++ library, (2) the Stepanov library developed by in HP, (3) parts [1] based on [2]; (4) specific implementations of suppliers either [1], [2] or [3]; (5) fundamental principles of work [2]., this term is very "ambiguous and should be used with extreme caution. If you mean [1] and insisted on the abbreviation," stdlib "is a much better choice." *

Honestly, although, since it is a library, it is somewhat finite and probably not capable of a sickening infinity, like the language itself. Therefore, I would say that any question related to the use of some stdlib algorithms would be effective if they knew them well.

If iterators are an integral part of stdlib, I would also ask them to "Put all integers in a vector in the standard version." I would expect something like:

 // thanks to onebyone std::copy(vec.begin(), vec.end(), std::ostream_iterator<int>(std::cout, " "); 

If they write something like the following, they are probably not very familiar with iterators:

 for(int i = 0; i < vec.size(); ++i) std::cout << vec[i]; 

Also, one interesting thing is interesting if they do using namespace std at the top of their code file. Ask them why, and if they don’t say something according to “I use it only for a short demo code” or if they put it in the header file, thank them for entering and sending them at the door.

Another aspect of stdlib is the intensive use of templates; a person should have a good understanding of basic template programming for type substitution. Perhaps ask them to "Write a function that will write all the elements of any stdlib container to the standard version." I would expect to see something like:

 template<typename InputIter> void Output(InputIter it, InputIter end) { while(it != end) std::cout << *it++; } 

This is probably not 9/10 questions, but interesting ones, which I think 2-3/10 should know.

One problem of 9/10 that I would say is to correctly write the iostream derivative without using the accelerated stream base classes. But there is probably a big difference between using stdlib and its extension ...

* (thanks to nolyc on freenode ## C ++ for a quote)

0
source share

All Articles