🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Good C Interview questions?

#2024
From: Roland Giersig
Date: Fri, 16 Feb 1996 15:24
54 lines
3228 bytes
Steven Huang (sthuang@hns.com) wrote:
: In article <4fsqkj$1uo@solutions.solon.com> kochmar@psc.edu (John Kochmar) writes:
: >In article <4fp1ks$h6r@solutions.solon.com>, sthuang@hns.com (Steven Huang) writes:
: >|> ...

: >|> The students were supposed to match each character in a plaintext string
: >|> with each character in a key string to produce the ciphertext, as an
: >|> exercise to string handling.  Of 21 students, none realized that the
: >|> table can be computed.  Many actually typed in the lookup table, one
: >|> even read it from a file.  I tend to blame this phenomenon on TV and
: >|> debuggers ;)

: >Give the person who read it from a file an A+.  That person realized
: >that they could change the workings of the cypher engine by simply
: >changing a config file, something that's lost on most programmers.
: >Changing the internal workings of an algorithm without recompiling
: >is something to be encouraged, not discouraged.

: Fascinating angle.  I would've if he finished it and argued like you
: did.  =)

: >Right, you *could* calculate the table, but that doesn't necessarily 
: >mean you *should*.  After all, if you hard-wire the table in, be it
: >via math or via static lookup table, it's still hard-wired, and now
: >you're just discussing space vs cycles  ;^)

: I was lamenting that none of them realized that the table can be
: computed, which indicates to me that they do not spend enough time in
: the analysis phase when approaching a problem.  It suggests to me that
: they attacked the problem by coding immediately and presumably relying
: on tools to crank a brute force approach through.  Thoughts?

The perfect answer would probably been to read the table from a file,
but to produce that file by writing a small program (or
shell/perl/whatever script) that generates it. OTOH if you're using a
decent editor, creating that file by hand using cut&paste techniques
is much faster. But I agree that analysis should always come first, so
students who asked back for more specifications should receive bonus
points.

I actually do that quite often, writing throw-away programs (sometimes
in C, sometimes in Tcl) to create some sort of table or other. The
perfect method for this is of course by compiling the following C
file:

#include </dev/tty>

;^)

--
Roland.Giersig@aut.alcatel.at        (speaking only to, err, for myself)
ALCATEL Austria, Scheydgasse 41, A-1210 WIEN.    Phone: +43-1-27722-3755
GS/CS/IT d-(+) s++:++ a>? C++$ US*++$ P+>+++ L>++ E+>++ W+>$ N+ w--- V>? 
PS+ PE Y+ PGP?>++ t++>+++ 5? tv+ b>++++ D++(---) G+ e+++>* h----(*) r+++
Technical Details
Message-ID: <4g27jh$q80@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4fjnch$oqq@solutions.solon.com> <4fp1ks$h6r@solutions.solon.com> <4fsqkj$1uo@solutions.solon.com> <4fsv8r$31a@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: giersig%atusel04@atusks01.aut.alcatel.at (Roland Giersig)
Newsgroups: comp.lang.c.moderated
Subject: Re: Good C Interview questions?
Date: 16 Feb 1996 09:24:33 -0600
Organization: Alcatel Austria AG
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4g27jh$q80@solutions.solon.com>
References: <4fjnch$oqq@solutions.solon.com> <4fp1ks$h6r@solutions.solon.com> <4fsqkj$1uo@solutions.solon.com> <4fsv8r$31a@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: TIN [version 1.2 PL2]