Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C++ interview questions

Reply
Thread Tools

C++ interview questions

 
 
James Kanze
Guest
Posts: n/a
 
      03-04-2008
On Mar 4, 12:24 pm, dizzy <(E-Mail Removed)> wrote:
> James Kanze wrote:
> > Or just use the template, period. If you call a template
> > function, it's going to be instantiated. If you definie a
> > variable with a class template type, the template is going to be
> > instantiated.


> I was thinking going even further with this, what about using
> it in a context that does not call any function or declare any
> variable? Such as use as part of the expression given to the
> sizeof operator


That will force the instantiation of a class template, or the
declaration of a function template, but not the instantiation
of the definition of a function template.

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
 
LR
Guest
Posts: n/a
 
      03-04-2008
James Kanze wrote:
> On Mar 3, 7:34 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
>> (E-Mail Removed)-did-not-set--mail-host-address--so-tickle-me wrote:


>>> 21.) What is the difference a fake pointer and a smart pointer ?

>
>>> (ouch!, I did not even know that there is a thing called
>>> "fake pointer" )

>
>> I don't know what a "fake pointer" is.

>
> Me neither.


I don't either. And yet a google search turns up a fair number of
results for the phrase.

And I still don't know.

For one thing, it seems to be one of those phrases that people use to
mean different things in different contexts.

I think I have found at least a few.

1) Using an integral type index into an array to construct a data
structure such as a linked list or tree. The kind of thing you might do
if you're using a language that doesn't support pointers.

2) Passing a pointer to something that expects the pointer to be to a
particular type when in fact it's not. Some of what I've read seems to
imply this can be (ab)used as a form of polymorphism. I'm certain that
I didn't understand this.

3) An invalid pointer, perhaps NULL, or at least one that doesn't point
to the data that the user expected it to point to. Seems to get used to
prevent certain kinds of malicious behavior.

Thinking about it, smart pointer, is a pretty broad term too.

And it's not clear to me that the terms are mutually exclusive.

If anyone can clarify the term "fake pointer" I'd like to hear it.

> Anyway, if this is an example of the questions they ask in the
> interview, I don't think I'd get the job. And yet, I'd
> consider myself a pretty competent C++ programmer.


I don't understand what the intent of the interview questions in this
thread is.

LR






 
Reply With Quote
 
 
 
 
Bo Persson
Guest
Posts: n/a
 
      03-04-2008
James Kanze wrote:
> On Mar 3, 7:34 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
>> (E-Mail Removed)-did-not-set--mail-host-address--so-tickle-me wrote:

>
>>> 7.) What happens to the member functions in the class when copy
>>> constructor is invoked ?

>
>> Huh?

>
> Yes, what happens to them? Another question to which I don't
> know the answer.
>


I guess the expected answer is: "Nothing, the functions are not
copied".


Did I get the job?


Bo Persson


 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      03-04-2008
Bo Persson wrote:
> James Kanze wrote:
>> On Mar 3, 7:34 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
>>> (E-Mail Removed)-did-not-set--mail-host-address--so-tickle-me wrote:

>>
>>>> 7.) What happens to the member functions in the class when copy
>>>> constructor is invoked ?

>>
>>> Huh?

>>
>> Yes, what happens to them? Another question to which I don't
>> know the answer.
>>

>
> I guess the expected answer is: "Nothing, the functions are not
> copied".


Is it a question you might ask somebody when you interview them?

I've not interviewed an entry-level person in years. Perhaps it is
important to validate their understanding of the C++ memory model
along with some areas of the language pertinent to your specific
development practices. For example, since I deal with performance
at least part time in my job, questions about passing by value vs
passing by a const ref would come up if I were to interview smbd.

> Did I get the job?


<g> Not yet. We might have more questions. Stand by.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      03-04-2008
On 4 mar, 18:18, LR <(E-Mail Removed)> wrote:
> James Kanze wrote:


[...]
> > Anyway, if this is an example of the questions they ask in the
> > interview, I don't think I'd get the job. And yet, I'd
> > consider myself a pretty competent C++ programmer.


> I don't understand what the intent of the interview questions
> in this thread is.


To weed out people like Victor and myself?

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
LR
Guest
Posts: n/a
 
      03-05-2008
James Kanze wrote:
> On 4 mar, 18:18, LR <(E-Mail Removed)> wrote:
>> James Kanze wrote:

>
> [...]
>>> Anyway, if this is an example of the questions they ask in the
>>> interview, I don't think I'd get the job. And yet, I'd
>>> consider myself a pretty competent C++ programmer.

>
>> I don't understand what the intent of the interview questions
>> in this thread is.

>
> To weed out people like Victor and myself?


Heh heh.

In that case, what do the questions imply about the sort of person an
interviewer who uses them is trying to find?

Arnuld, here's some free, probably OT, advice. It's worth every penny
you paid for it.

Try to find someone who was recently hired for the kind of position you
are seeking and ask them what kinds of questions they were asked. If
you can find two people, or three, even better.

Try to find someone you can practice answering questions in front of.
If they're C++ programmers that would be nice. If they've interviewed
people that would be very good too, even if they're not programmers.

Read this article,
http://www.joelonsoftware.com/articl...rviewing3.html

Best of luck.

LR


 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      03-05-2008
On Mar 5, 1:46 am, LR <(E-Mail Removed)> wrote:
> James Kanze wrote:
> > On 4 mar, 18:18, LR <(E-Mail Removed)> wrote:
> >> James Kanze wrote:


> > [...]
> >>> Anyway, if this is an example of the questions they ask in the
> >>> interview, I don't think I'd get the job. And yet, I'd
> >>> consider myself a pretty competent C++ programmer.


> >> I don't understand what the intent of the interview questions
> >> in this thread is.


> > To weed out people like Victor and myself?


> Heh heh.


> In that case, what do the questions imply about the sort of
> person an interviewer who uses them is trying to find?


Well, I find them very useful for what they tell me about the
company who's interviewing me. Like, for example, that I
probably wouldn't want to work there anyway.

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
keith@bytebrothers.co.uk
Guest
Posts: n/a
 
      03-05-2008
On 3 Mar, 17:53, (E-Mail Removed)-did-not-set--mail-host-address--so-
tickle-me wrote:
> After1 month from now, I will start giving job interviews. Searchign at
> Google led me to several common questions asked in interviewers looking
> for C++ based programmers.


My advice would be to read, and thoroughly understand, this:

http://www.parashift.com/c++-faq-lit....html#faq-6.14
 
Reply With Quote
 
dave_mikesell@fastmail.fm
Guest
Posts: n/a
 
      03-05-2008
On Mar 4, 4:45 pm, James Kanze <(E-Mail Removed)> wrote:
> On 4 mar, 18:18, LR <(E-Mail Removed)> wrote:
>
> > James Kanze wrote:

>
> [...]
>
> > > Anyway, if this is an example of the questions they ask in the
> > > interview, I don't think I'd get the job. And yet, I'd
> > > consider myself a pretty competent C++ programmer.

> > I don't understand what the intent of the interview questions
> > in this thread is.

>
> To weed out people like Victor and myself?


This might be the first time in my Usenet history that I literally
LOL'd.
 
Reply With Quote
 
dizzy
Guest
Posts: n/a
 
      03-05-2008
James Kanze wrote:

> On Mar 4, 12:24 pm, dizzy <(E-Mail Removed)> wrote:
>> James Kanze wrote:
>> > Or just use the template, period. If you call a template
>> > function, it's going to be instantiated. If you definie a
>> > variable with a class template type, the template is going to be
>> > instantiated.

>
>> I was thinking going even further with this, what about using
>> it in a context that does not call any function or declare any
>> variable? Such as use as part of the expression given to the
>> sizeof operator

>
> That will force the instantiation of a class template, or the
> declaration of a function template, but not the instantiation
> of the definition of a function template.


But would answer the original question of "How can you force instantiation
of a Template?"

PS: I love to poke interviewers with such things if they ask questions like
that

--
Dizzy

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please come and add questions to C++ interview questions onListenVoice Vijay C++ 2 05-07-2010 03:02 PM
ASP Interview Questions ASP Interview Questions reema ASP General 0 08-26-2008 11:57 AM
.NET Interview Question, C#, ASP.NET Interview Questions dotnetuncle Javascript 0 10-30-2007 03:08 PM
Needed real interview questions marathikaka@yahoo.co.in Microsoft Certification 3 09-07-2005 12:11 AM
Interview Questions Vishal Pandey ASP .Net 0 11-24-2003 02:00 PM



Advertisments