Expert C Programming

(Jeff_L) #1

Then I, oops, I mean "he", amended the system editor, so it turned on the LED when it started and
turned it off when it exited. Result: the boss's terminal played continuous Christmas carols whenever
he used the editor! The people in neighboring offices formed a lynch mob after half-an-hour and made
him stop all work until the cause was uncovered.


—The Second Official Handbook of Practical Jokes [1]


[1] By Peter van der Linden, © 1991 by Peter van der Linden. Used by permission of Dutton


Signet, a Division of Penguin Books USA Inc.


Silicon Valley programmer interviews...how can you detect a cycle in a linked list?... what are the different C increment statements for?... how is a library call
different from a system call?...how is a file descriptor different from a file pointer?... write some code to determine if a variable is signed or not... what is the
time complexity of printing the values in a binary tree?... give me a string at random from this file... some light relief—how to measure a building with a
barometer


Silicon Valley Programmer Interviews


This provides some hints about the interview process for C programmers looking for a position with
the top companies. One of the best things about the sharp end of the computer business is the unusual
way we choose new employees to join the team. In a lot of industries, the supervisor or manager
makes all the hiring decisions; indeed, is often the only one who even meets the job applicants. But on
the leading edge of software development, and especially in high-tech start-ups, programmers are
sometimes more qualified than managers to judge which of the candidates has the best technical skills
as an "individual contributor." The talent needed to do some systems programming is so rare and
specialized that sometimes technical ability is the single most important characteristic that you look
for in an interview.


So a distinctive style of interview has evolved. The manager follows company policies to select the
pool of candidates to interview. These prospects are then given a technical grill-ing by every person
on a development team, not just the manager. A typical job interview will last all day, involving
successive hour-long sessions with six or seven different engi-neers—and all of them need to be
convinced of how well the applicant can program before a job offer is made.


Engineers often develop some favorite questions, and this chapter contains a collection of favorites.
There's no harm in revealing these "secrets"—the kind of person who reads this book probably already
knows enough to be hired by a good software company. Many of these problems had their origins in
real algorithms we were trying to program, and have since been replaced by other, newer problems. Of
course, part of what you look for when you interview people is not just what they respond with, but
how they respond. Do they think carefully about a question and come up with several possibilities, or
do they just blurt out the first response that comes into their head? How persuasively do they argue the
case for their ideas? Are they insistent on an obviously wrong strategy, or do they have the flexibility
to adapt their answer? Some of the following interview questions have yielded the strangest answers.
Try them for yourself, and see how you fare!


How Can You Detect a Cycle in a Linked List?


This starts off as the simple question, "How can you detect a cycle in a linked list?" But the questioner
keeps adding extra constraints, and it soon gets quite fiendish.


Usual first answer:

Free download pdf