Re: C Interview Questions



"J. J. Farrell" <jjf@xxxxxxxxxx> writes:
Richard Heathfield wrote:
dhruvaraj@xxxxxxxxx said:
Interview Questions :
http://www.dhruvaraj.com/interview/cncpp/index.html

"C and C++ Basic Questians" didn't inspire a lot of confidence. Still, let's
see:

2. When do you say that a digraph is acyclic

What has this to do with C?

C99 has digraphs, and I'd say they're always acyclic.

The digraphs are:

<: :> <% %> %: %:%:

Four of them include percent signs which include little circles. So
only "<:" and ":>" are acyclic.

5. Which of the Following [functions] is not defined in string.h?

All of them, obviously.

Implementation specific, perhaps? Does anything prevent an
implementation defining them in the header if it chooses to?
[...]

If a header contains a function definition, and that header is
included in two or more translation units in the same program, Bad
Things Could Happen. (I'm too lazy to figure out whether it's
undefined behavior, a constraint violation, or whatever.)

Then again, the predefined functions can also be defined as macros.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.