Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

If I'm undergoing a technical interview that's based on my C++ skills, would most companies allow or expect me to use STL containers to solve problems?

I think it's clear that if a question is pertaining specifically to a linked-list and my knowledge of linked-lists that I probably won't be able to or shouldn't use the STL list containers. On the other hand, I could get a question where using std::vector might be really useful and the question itself doesn't concern std::vector directly. In this latter case I would think using the vector STL container would be acceptable.

Of course, the answer to this question is at least somewhat company dependent. I'm curious as to how bigger tech companies approach this situation.

share|improve this question
4  
Ask at the interview –  James Jan 25 '13 at 3:05
    
@James Of course. But I'm asking this question in terms of preparation. –  Adam27X Jan 25 '13 at 5:08
    
I'd say be prepared for the worst i.e. learn pointers and how to implement a minimal linked list, etc. after all if the interviewers says you mustn't use STL strictly, it's ok, you can still do it! –  legends2k Jan 25 '13 at 5:09
1  
When you are being interviewed for a position, you are interviewing the company for your employer at the same time. If the interviewer does not like STL solutions, it is likely they don't use or know it. In which case I'd think twice whether I am still interested in the job. –  Jan Hudec Jan 25 '13 at 9:18
1  
Using the STL is about as reasonable as using the letter 'e'. Run if they don't allow it. –  MSalters Jan 25 '13 at 10:57
add comment

closed as not a real question by gnat, Yusubov, BЈовић, thorsten müller, Martijn Pieters Jan 25 '13 at 11:50

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 8 down vote accepted

I am often called to interview candidates and one of the main languages we use at my company is C++. As a result many of my interviews are focused on C++. Here are some of the things I always love to see when interviewing a candidate.

  1. They mention that it would be trivial to implement the coding test using STL but then proceed to code out the answer using base C++
  2. They code a version using base C++ then mention that it would be more efficient to use STL and then code a version that actually is more efficient using STL correctly
  3. Ask if it is OK to use STL when coding the problem then pending on my answer to the question, code the answer correctly either way.

All of these methods show that the interviewee knows what STL is and shows us proof of basic knowledge and more advanced knowledge in some form (albeit interview is such a short time to know someone.) Sometimes I will ask them to answer in only STL when someone mentions that it is better in STL and it turns out that they didn't really know it at all and that to is telling.

Best advice is to always be prepared to show off your basic C++ skills to the interviewers, but also be ready to bring to the table the more advanced knowledge you have and always offer it if you are comfortable doing so. In my opinion, if I don't want someone using STL I will typically lay it out in the question when I give it to them.

share|improve this answer
1  
Well, you seem to be a good interviewer :) –  legends2k Jan 25 '13 at 5:11
2  
I agree with legends2k, but cannot make sense of your phrase base C++. The standard library is an integral part of fundamental C++, while for you base C++ seems to be some subset of C with references and templates. –  Benjamin Bannier Jan 25 '13 at 9:49
1  
@honk the standard library may be an integral part of C++ but it still makes sense to make a distinction between the language and the language+library. Particularly if you're trying to probe the extent of someone's knowledge of both. –  Carson63000 Jan 25 '13 at 10:20
    
@Carson63000: I see how this is a very useful distinction when interviewing, but I think the specific phrase is misleading. –  Benjamin Bannier Jan 25 '13 at 10:25
    
@honk I am sorry it was not quite as clear and certainly not trying to be misleading. I was trying to come up with phrasing that made more sense than STL and non-STL so I went with base. I see Klaim added edits I wanted to do but my late night addled brain couldn't get me there. Thank you! –  Akira71 Jan 25 '13 at 12:39
add comment

Not a long time ago I was interviewed, for a Junior development position, and I was interviewed specifically about the stl containers, i.e what are the differences between vector and list, when would you use one over the other, etc.

As long as the question isn't one that becomes trivial with a standard container, I would say it is OK to use them. I would even recommend it, since a large part of programming is about choosing the best tool based on the problem at hand, and choosing the right container would reflect positively.

Ultimately, It is best to ask your interviewer if you are on the fence.

share|improve this answer
1  
even a trivial answer can be a good one - it shows understanding of library. The issue is more "What is being asked?" - Are they asking "How to implement a linked list?" or "How to store data when doing this and that?" –  johannes Jan 25 '13 at 3:21
    
@johannes by trivial answer I meant questions that have you reinvent the wheel to test your concepts and understanding - implement linked lists, dynamic arrays, sort, etc –  Karthik T Jan 25 '13 at 3:37
    
@KarthikT: Why would they test for that knowledge? That's about as useful as knowing how to write assembly - most people don't need either. Both are basic functionality of your tools. –  MSalters Jan 25 '13 at 11:26
    
@MSalters I havent been on enough to judge, but a common recommendation for prospective google interviewees is to know how to implement a hashtable, with an array. Sorting also I am sure is common. I have seen several reverse string questions. –  Karthik T Jan 25 '13 at 11:29
    
@KarthikT: I've probably even asked that last one as a question, and "use reverse iterators" would be a very good answer. –  MSalters Jan 25 '13 at 11:31
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.