Interview befuddlement

L

lbonafide

I've had four technical interviews with the same company (and one
Brainbench exam), and every one of the interviewers asked me what the
vtable looked like. Is this common? One of them also asked me about
how the code and data segments were laid out in memory for N number of
instantiated objects.

There were plenty of other questions about inheritance, polymorphism,
composition, RAII, as well as Unix specific questions about IPC,
threads, etc, as this is for a C++/Unix architect/developer
position. I just found the repetitive vtable questions puzzling.
 
V

Victor Bazarov

I've had four technical interviews with the same company (and one
Brainbench exam), and every one of the interviewers asked me what the
vtable looked like. Is this common? One of them also asked me about
how the code and data segments were laid out in memory for N number of
instantiated objects.

Those do have something to do with C++. They touch on implementation
detail. They must have been important to the team and that's why they
decided to ask them. Did you ask why they were asking?
There were plenty of other questions about inheritance, polymorphism,
composition, RAII, as well as Unix specific questions about IPC,
threads, etc, as this is for a C++/Unix architect/developer
position. I just found the repetitive vtable questions puzzling.

You ought to ask them why they thought those were important. Could it
be that they develop their own compiler/linker?

V
 
L

lbonafide

(e-mail address removed) wrote:

You ought to ask them why they thought those were important. Could it
be that they develop their own compiler/linker?

No, they use g++ and write multithreaded server software.
 
E

Erik Wikström

No, they use g++ and write multithreaded server software.

Then you should tell them that how the vtable looks like or how the code
and data segments looks like is irrelevant since they can change with
the next version of the compiler/linker. Or you can read upon the
subject :)
 
H

hurcan solter

Then you should tell them that how the vtable looks like or how the code
and data segments looks like is irrelevant since they can change with
the next version of the compiler/linker. Or you can read upon the
subject :)

can you point at the good sources about the subject? I think i can
recite Lippman's
inside the C++ object model from memory but it's dated and I am rather
weak at the subject having an engineering background...
 
V

Victor Bazarov

hurcan said:
[..]
can you point at the good sources about the subject? I think i can
recite Lippman's
inside the C++ object model from memory but it's dated and I am rather
weak at the subject having an engineering background...

I doubt that anything has significantly changed since the "Inside..."
was published. If anything has [significantly changed], it would be
yet another proof of the rule that you shouldn't rely on the object
layout. There is no reason to, not in programming a multithreaded
server anyway.

V
 
G

Greg Herlihy

I've had four technical interviews with the same company (and one
Brainbench exam), and every  one of the interviewers asked me what the
vtable looked like.  Is this common?   One of them also asked me about
how the code and data segments were laid out in memory for N number of
instantiated objects.

I do not know whether questions about vtables are common or not during
job interviews - but I would imagine that correct answers are not very
common at all. The fact that very few C++ programmers need to know
what a vtable looks like - is probably the motivation for asking the
question during a job interview in the first place.

After all, a candidate who does know the implementation details of a
vtable, is likely someone who has an innate intellectual curiosity -
someone who has a a desire to look "under the hood" (in the case, of a
C++ compiler) - in short, a person with the drive to understand how
things work - independent of whether such knowledge has a direct
practical application or not.

On the flip side, the vtable question could also help weed out those
candidates who - when unable to answer a particular question - resort
to fabricating a response out of thin air (a strategy that is
predicated on the usually valid - but in the case, ridiculous -
assumption that the person asking the question genuinely does not know
the correct answer).

Greg
 
L

lbonafide

After all, a candidate who does know the implementation details of a
vtable, is likely someone who has an innate intellectual curiosity -
someone who has a a desire to look "under the hood" (in the case, of a
C++ compiler) - in short, a person with the drive to understand how
things work - independent of whether such knowledge has a direct
practical application or not.

Maybe, but the position was for a C++ architect, and yet not a single
design pattern question in four interviews, nothing on OO theory other
than "inheritance vs. composition", no design questions. I think they
must have just pulled some programmers together and told them to ask
me C++ questions. I just Googled "C++ interview questions" and the
first three hits (at least) have vtable questions.
 
G

Greg Herlihy

Maybe, but the position was for a C++ architect, and yet not a single
design pattern question in four interviews, nothing on OO theory other
than "inheritance vs. composition", no design questions.  I think they
must have just pulled some programmers together and told them to ask
me C++ questions.   I just Googled "C++ interview questions" and the
first three hits (at least) have vtable questions.

I reached the opposite conclusion - because none of the first three
hits when I googled "C++ interview questions":

http://www.freejavaguide.com/cppint.htm
http://www.shettysoft.com/interview.htm
http://techpreparation.com/cpp-interview-question-answer1.htm

include any questions about vtables (and only one of the three hits
even has "vtable" appear in any of the answers).

So, although interview questions about C++ virtual functions are, of
course, pretty standard - questions about vtables would seem to be
uncommon (probably because the C++ Standard makes no mention of
them.)

Greg
 
L

lbonafide

I reached the opposite conclusion - because none of the first three
hits when I googled "C++ interview questions":

http://www.freejavaguide.com/cppint.htm

5. How Virtual functions call up is maintained?
Through Look up tables added by the compile to every class image. This
also leads to performance penalty.

How virtual functions are implemented C++?

Virtual functions are implemented using a table of function pointers,
called the vtable.

http://techpreparation.com/cpp-interview-question-answer1.htm

include any questions about vtables (and only one of the three hits
even has "vtable" appear in any of the answers).

My third hit pulled up a page with the same questions as the 2nd.
 
J

James Kanze

Those do have something to do with C++. They touch on
implementation detail. They must have been important to the
team and that's why they decided to ask them. Did you ask why
they were asking?
You ought to ask them why they thought those were important.
Could it be that they develop their own compiler/linker?

In which case, the question would be: how would you lay them
out? I too would wonder about such a question in an interview,
since after all, the only correct response is "I don't know"
(given that you don't know what compiler they're using), perhaps
elaborating that it depends on the implementation, and that an
implementation isn't even required to use a vtable.
 
J

James Kanze

On Mar 31, 9:42 am, (e-mail address removed) wrote:
I do not know whether questions about vtables are common or
not during job interviews - but I would imagine that correct
answers are not very common at all. The fact that very few C++
programmers need to know what a vtable looks like - is
probably the motivation for asking the question during a job
interview in the first place.
After all, a candidate who does know the implementation
details of a vtable, is likely someone who has an innate
intellectual curiosity - someone who has a a desire to look
"under the hood" (in the case, of a C++ compiler) - in short,
a person with the drive to understand how things work -
independent of whether such knowledge has a direct practical
application or not.

Or... A candidate who does know the implementation details of a
vtable, for a particular compiler, is probably someone who gets
too taken up with irrelevant details. The sort of person who
will spend a week gaining a microsecond in the code which
handles the time change going from summmer time to winter time
and vice versa. Or who will spend the entire time alloted to
code review discussing some irrelevant detail, so you don't have
time to discuss the important points. Or simply someone who
doesn't know how to handle abstraction in general.
On the flip side, the vtable question could also help weed out
those candidates who - when unable to answer a particular
question - resort to fabricating a response out of thin air (a
strategy that is predicated on the usually valid - but in the
case, ridiculous - assumption that the person asking the
question genuinely does not know the correct answer).

That's a genuine possibility, but I would expect that any decent
interview process could weed out the bluffers with discussions
about the usual questions.
 
M

Matthias Buelow

The one who provided the answers in this list doesn't really have a clue
about what he (she) is talking about either, does he (she)?
 
J

James Kanze

The one who provided the answers in this list doesn't really
have a clue about what he (she) is talking about either, does
he (she)?

I found an error fairly quickly in all three of them, but this
one does seem particularly clueless.

Of coures, clueless people do give interviews, and I've been
rejected more than once because my answers to various questions
didn't coincide with those of the interviewer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top