CV claims — “used py for sys automation”
Q: optimize – how did you optimize perf?
A: I didn’t need to for my scripts.
Q: try/catch + ….?
Q: immutable – what data types are mutable/immutable?
Q: threading – global interpreter lock?
A: never really needed threading
Q: xml – what xml parser did you use? ess477
Q: debugger? A: I didn’t need it
Q: read a config file?
Q: DB access?
Q: command line arguments stored where? A: sys.argv?
Q78: exit normally? A: sys.exit()
Q78b: normally, “raise Exception” would print to stderr stream, but how do you direct that to a log file instead?
A: set sys.stderr stream. dive205 i.e. [[dive into python]]
Q: how do you handle newline diff between OS? ess114
Q: truth table? e68 (i.e. [[essentialRef]])
Q: how do you edit on windows and deply to linux?
A: samba, ftp. See also the post in pearl
— sys admin
Q: how do you pass input files to your py script? cook539
A: fileinput module is convenient.
Q: how is PYTHONPATH used with sys.path?
Q: another py — how do you execute another py script? Ess89 (i.e. [[essentialRef]])
Q: what command line options do you use often?
Q5: how do you launch an external program?
Q5b: how do you capture its output? c546 [[cookbook]] has a slightly advanced solution
Q5c: how do you call a unix shell command?
A: shutil module meets some of your needs
Q: exit with an error msg? cook540
A: raise SystemExit (‘msg’)
— data structures
Q: diff between listcomp and genexp? How would you choose?
Q: convert between list and tuple? cvc
Q: convert a list of objects to string and concat? see post in recrec
Q: split a string on multiple delimiters? cook37 explains re.split()
Q: iterating in reverse? cook119
Q: how do you print to a file rather than stdout?
A: e115 — print >> anOpenFile, ‘whatever’ # using the print KEYWORD
A: c144 — print (‘whatever’, file=anOpenFile) # using the print() function
Q: concat 2 lists?
Q: initialize a dict
Q: initialize a 2D array? m52 (i.e. [[perl to python migration]])
Q: walk a directory
Q: use a dict as a “seen”
Q: iterate a dict? mig87
Q: iterate a file
Q: interpolate into a string? ess115. c61 i.e. [[cookbook]]
Q: date/time usage (datetime module is OO; time module is procedural?)
Q: trim both ends of a string? strip()
- generate a range from 1 to 9 — xrange() for py
- vector (more useful than array), std::string (more useful than cStr). Many string operations are still unfamiliar
- Array-based data structures are required in 80% of my coding tests.
- More than 50% of all my coding tests
require nothing but arrays.
- Most of my toughest coding tests are presented in arrays but may need maps as helpers
- basics of map lookup
- sorting, operator<(), upper_bound, binary search … on containers
- sorted data structure (like std::multimap)
- [w] stringstream — ECT to improve
Very few NY interviewers would test you on
graph or DP. Here are other less important constructs:
- [w] binary tree is common and simple, but they can ask very tough questions on it!
- [w] double pointer is trickier and my advantage
- [w] Node class in a linked data structure.
- [w] stack, queue.
- [w] grid or matrix
- file I/O? only for IDE tests, not pure algo or take-home tests
- [w] basic syntax for pointer arithmetic.
- [w] dtor, copier, op=? only for design questions, not algo questions.
- [w] shared_ptr? Only for design questions, never needed in algo questions!
- [w] ref variable only as function I/O.
- stl algo? Only Citadel array-shrink
- never exception
- never template
- no (very, very seldom) threading in coding Q
- adv: pointer to function
- adv: circular buffer
- [w = no weakness]
Common, non-trivial, perhaps hidden issues in a candidate, ranked:
- twist and turn and not /candid/ about his past
- not listening
- jumping to conclusions
- assuming too much
- not waiting for a long-winded interviewer to finish, perhaps interrupting
- jumping to the defensive, when deliberately provoked
- desperate for the job and losing his perspective
- choosy on projects
- conceited beyond “cool confidence”
- impulsive answers ^ elusive, guarded answers
- bad-mouth past managers
- lack of humor? common
- tensed up and not cool and calm, perhaps prone to workplace stress
- exaggeration about his past? common
- not articulate enough? common
- poor eye contact? common
confirmed — a std::string is not sortable. A STL author (DRM) suggested using a vector of char
sort(vec.begin(), vec.end()); //normal sort
sort(vec.rbegin(), vec.rend()); //To reverse-sort any vector
As I get older, the soft interview is becoming more important more tricky. Part of the soft interview is my list of questions to interviewer.
Tip: If possible, ask “salesy” a question so you can highlight your memorable strengths. More importantly, ask smart, serious questions.
How about “truthful” question that show your real concern? I feel there’s very limited value in truthfulness here.
Some people (like me) don’t like [e]asy questions, but interviewer may find it too sensitive and blunt, though they can always dodge it.
- [e] Q: between quality and speed, what’s more important?
- Q: bottlenecks and what was/is done about each
- [e] Q: what are your challenges?
- people not communicating enough?
- requirement changing too fast?
- [e] Q: what design trade-offs have you made?
- [e] Q: what user groups, and what challenges do each present?
- [e] Q: what types of team player are needed here?
- [e] Q: how is performance *measured*?
- [e] Q: your management style?
- [e] Q: median age among the developers?
- Q: Are expectations any different on an older developer (say, my age)
- Q: who is the most important (not necessarily biggest) competitor?
- Q (only for the hiring manager): Based on what you have learned about me in this interview, do you have any questions or concerns about my ability (not suitability) to do this job?
- Note This is a pretty aggressive question, but if there is a good rapport built during the interview, it can be useful. More assertive hiring managers like this as it shows the candidate is not shy about seeking feedback. This can also clear the air of any lingering concerns or possible miscommunications/misconceptions that are a subtext to the interview.
Action: spend enough (30?) hours revisiting my 1000+ cpp (including socket, stream..) blog posts and explore just a little beyond them.
(I blogged about exactly the same observation before …) Here’s a paradox — i spent 2 years in a full time c# job, arguably longer than my full time c++ experience. However, sometimes I feel I understand dotnet less than C++.
Reason? Many aspects of the languages are never used in-depth on work projects, so length of experience != depth of experience. We need spare time self-exploration to learn those aspects like:
– template meta programming
– custom operator new/delete
– memory tuning
– memory leak detection
– async communications
– pure virtual
– ++i vs i++
(… not a complete list by any measure.) Interviewers are notorious for testing these obscure or advanced, theoretical topics.
…, based on P45 [[py ref]]. Each one is non-trivial, and worth studying.
__init__(self). The static method __new__(self) is obscure
__cmp__(self) and __hash__(self)
__str__(self) and __repr__(self)
Output typically uses “print”.
print >> myFileObject , arguments
print >> sys.stderr , arguments…
Quiz: so, in that case, how do you print to stdout?
Input from file is very common, so that's another quiz
Input from std input —
aLine = sys.stdin.readline()
all_the_Lines = myFileObject.readlines()
Some prefer the object-oriented way to output
Bracket [[[[ ]]]] is used for
– fast list initialization
– access a dict/tuple/str/list including ..
– slicing — for any sequence structure
Parenthesis (((( ))) is used for
* tuple initialization
* Not needed for pair assignment