🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2239

Re: Good C Interview questions?

#2239
From: John Carr
Date: Mon, 11 Mar 1996 01:29
35 lines
1955 bytes
In article <4hv081$jdt@solutions.solon.com>,
Marc Espie <espie@clipper.ens.fr> wrote:

>>It's obvious that:
>>	A [i] == 'l'
>>But what is:
>>	i [A] == ???
>
>>Any competent C programmer should know.
>
>Any *competent* C programmer should know ??? Come on, have you *ever*
>seen this weird construct used outside of the IOCCC ?

I've used it once.  In the process I discovered that IBM's xlc compiler
doesn't like reverse array notation -- it generates bad code.

I think a C programmer should know that array indexing is commutative,
but I wouldn't ask about it in an interview.  Unless I was interviewing
somebody just out of school for a first real programming job I wouldn't
ask detailed C syntax/semantic questions at all.  There are too many
details of C.  It would take a long time to ask about them all, and it
is reasonable not to know some of them.

Q: Which has higher precedence, + or |?
A: I don't remember, so I use parentheses.

I really didn't remember and I've been using C for more than 10 years.
When I need to know I take 30 seconds to write a C program to see what the
compiler does, or read the standard, or look at gcc's parser.  (Sun's C
compiler says + is higher than |.)  Maybe that would be a good interview
question: ask what the precedence is and if the answer is "I don't know"
follow up by asking: "show me how you would find out".

-- 
    John Carr (jfc@mit.edu)
Technical Details
Message-ID: <4hvvlg$op0@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4h2s1m$l8@solutions.solon.com> <4h75c1$4nh@solutions.solon.com> <4hqebv$1k1@solutions.solon.com> <4hv081$jdt@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: jfc@mit.edu (John Carr)
Newsgroups: comp.lang.c.moderated
Subject: Re: Good C Interview questions?
Date: 10 Mar 1996 19:29:20 -0600
Organization: Massachusetts Institute Of Technology
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4hvvlg$op0@solutions.solon.com>
References: <4h2s1m$l8@solutions.solon.com> <4h75c1$4nh@solutions.solon.com> <4hqebv$1k1@solutions.solon.com> <4hv081$jdt@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com