Interview question

N

Noah Roberts

How would you answer this question?

"Describe the structure of a class."

I was stumped, quite frankly.
 
Z

Zeppe

Noah said:
How would you answer this question?

"Describe the structure of a class."

I was stumped, quite frankly.

A class is composed by member variables that contain the data associated
to the class instances, and the member functions that describe
operations on the instances. A class can contain private memebrs and
functions, that can be accessed only by instances of the class itself,
and public member and functions that can be accessed by anyone. In a
good obect oriented code the member variables are usually private, while
the public member functions represent the class interface, which
represent the level of abstraction at which the class has to be used.

and so on... there is so much to write..

Regards,

Zeppe
 
V

Victor Bazarov

Noah said:
How would you answer this question?

"Describe the structure of a class."

I was stumped, quite frankly.

Did you ask what they mean by 'a class'? Perhaps it was the
memory layout of an instance they were interested in or perhaps
it was the syntactical form of 'a class definition'... You can
spin this in any direction showing off the knowledge of the
virtual inheritance and its implementation, virtual function
pointer table, the fact that the layout is only guaranteed
between access specifiers, the fact that member functions don't
take up space in the instance (beyond the first virtual function),
and so on.

If you didn't ask, you still have choices and so you could simply
start by saying "if you mean blah, then blahblah". If the
intervewer nods, you made the right guess. If they keep listening
without indicating whether you guessed right, you finish one
description, and begin another, "And if you mean blahblah,
then blahblahblah"...

V
 
D

dave_mikesell

How would you answer this question?

"Describe the structure of a class."

I was stumped, quite frankly.

I'm guessing they didn't really know what they were asking and
probably pulled this out of a book completely out of context.
 
D

dave_mikesell

I'm guessing they didn't really know what they were asking and
probably pulled this out of a book completely out of context.

Or maybe they were looking for the syntactical structure of a class
declaration? Hard to tell from that question.
 
V

Victor Bazarov

I'm guessing they didn't really know what they were asking and
probably pulled this out of a book completely out of context.

<shrug> Why does it matter?

It really serves no good purpose to guess what they meant or
whether they knew what they were asking about. Interviews are
not conducted to evaluate the candidate's knowledge about any
particular subject (or at least not conducted only to evaluate).

It's much more important to see how the candidate handles
situations like the one Noah described. Whether the candidate
is stumpted or not shouldn't matter either. The answer should
be given right away, and it should be to the best of the
candidate's understanding of what he was asked.

It's a very old tale, but it's quite possible that it has the
origins in real life... Once a very strict professor was talking
to a student at an oral exam. The professor was still undecided
whether to pass or fail the guy. So he said, "If you answer this
last question, I'll pass you, if you don't, you failed. How many
hairs are there in my beard?" The student replied immediately,
"ten thousand three hundred ninety-seven." "How do you know?"
"Well, that's a different question, professor".

V
 
V

Victor Bazarov

Or maybe they were looking for the syntactical structure of a class
declaration? Hard to tell from that question.

I agree, it's hard. No surprise Noah was "stumpted". Even James
Kanze admitted he'd be stumpted. It doesn't matter, though. One
would still be expected to give _an_ answer. Whatever one thinks
they wanted to hear.

V
 
D

dave_mikesell

I agree, it's hard. No surprise Noah was "stumpted". Even James
Kanze admitted he'd be stumpted. It doesn't matter, though. One
would still be expected to give _an_ answer. Whatever one thinks
they wanted to hear.

Oh, definitely. I would have asked them what they meant. If they
explained badly or got standoffish, I'd realize that I probably didn't
want to work for them. Then I'd have some real fun and describe the
molecular structure of Silicon...
 
V

Victor Bazarov

Gennaro said:
To me, they are asking to say goodbye and go looking for a true job
:)

Or begging to say at least something so they can justify hiring him
to become their saviour... :)
 
D

Drew Lawson

I agree, it's hard. No surprise Noah was "stumpted". Even James
Kanze admitted he'd be stumpted. It doesn't matter, though. One
would still be expected to give _an_ answer. Whatever one thinks
they wanted to hear.

When I was 25, I'd have gone for panic followed by bluffing followed
by depression. At 45, I've gotten better at, "I'm not sure I
understand the question." Sometimes that's what they are after.
It helps if I follow that up with a couple plausible directions --
that shows the ability to think and the ability to spot a faulty
spec.

I've given interview questions before where the main point was
seeing how the candidate approached the question, since no one can
really handle a truely interesting problem in the time of most
interviews. (And I've seen candidates fail to grasp several
consecutive clues about how to answer a question.)

I hate interviewing, both sides of the table.
 
J

James Kanze

I agree, it's hard. No surprise Noah was "stumpted". Even James
Kanze admitted he'd be stumpted. It doesn't matter, though. One
would still be expected to give _an_ answer. Whatever one thinks
they wanted to hear.

That is, of course, the key.

In a normal situation, a job interview works both ways; you also
use it to determine whether you want to work there or not. It
depends somewhat on the context, but usually, such a question
goes a long way in answering that question.

There are times, however, when you want the job, no matter what.
In those cases, you try to guess what they are looking for in an
answer, and feed that back to them.

FWIW: I once "failed" a job interview because they asked "what
does the keyword static mean in C++". The answer they were
looking for was "that what is being declared isn't on the
stack". I wrote about a half a page, explaining the different
meanings according to context. (It's effect on scope, on object
lifetime, and on the absense of a this pointer.) That wasn't
what they were looking for, so out I went. But to be frank,
when they explained what they were looking for, I don't think
I've have wanted the job anyway.
 
D

Digital Puer

Did you ask what they mean by 'a class'? Perhaps it was the
memory layout of an instance they were interested in or perhaps
it was the syntactical form of 'a class definition'... You can
spin this in any direction showing off the knowledge of the
virtual inheritance and its implementation, virtual function
pointer table, the fact that the layout is only guaranteed
between access specifiers, the fact that member functions don't
take up space in the instance (beyond the first virtual function),
and so on.



What's a good source for this kind of low-level informaton
about c++? A book or URL would be great.
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

What's a good source for this kind of low-level informaton
about c++? A book or URL would be great.

I'm not quite sure what you mean with low-level since it's not clear
what the question is really about, however The C++ Porgramming Language
and The Design and Evolution of C++ (both by Bjarne Stroustrup) will
provide you with lots of information.
 
A

Aston Martin

Oh, definitely. I would have asked them what they meant. If they
explained badly or got standoffish, I'd realize that I probably didn't
want to work for them. Then I'd have some real fun and describe the
molecular structure of Silicon...

dave, am sorry but cud not help. Silicon is an element, u cud have
said atomic structure rather than molecular structure :))
 
A

Aston Martin

What's a good source for this kind of low-level informaton
about c++? A book or URL would be great.

Inside the C++ Object Model
By Stanley B. Lippman
Publisher: Addison Wesley
Pub Date: May 03, 1996
ISBN: 0-201-83454-5
 
N

Noah Roberts

Victor said:
Did you ask what they mean by 'a class'? Perhaps it was the
memory layout of an instance they were interested in or perhaps
it was the syntactical form of 'a class definition'... You can
spin this in any direction showing off the knowledge of the
virtual inheritance and its implementation, virtual function
pointer table, the fact that the layout is only guaranteed
between access specifiers, the fact that member functions don't
take up space in the instance (beyond the first virtual function),
and so on.

Yeah, I tried that route but it was obviously not what he was looking
for. Then he said something like, "You know about private, public, ...
well?" So I tried to talk about permission and scope...and then he
moved on to some other hard to figure out question.

This was an interview with Logitech. I don't think it was a problem of
people not knowing what they are asking. He had a very heavy accent
though...maybe he didn't know how to relate what he was saying.

Obviously I didn't get the job or it wouldn't bother me as much. I
don't even know if this was why...I just wanted to see if anyone else
would have been able to figure it out :p
 

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
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top