Interview questions
Starting today, I'll be posting here, puzzles for Engineers. By this, I mean, puzzles that assume knowledge of certain technical aspects. To begin with, here is a simple one:
You are writing a parser that reads a C program and translates all the variable names into new names of the form "VAR######", where ###### is an integer incremented for each unique variable name. Discuss what is needed for the case where the C program already contains a variable of the form "VAR######".
(Found on /.)
2 Comments:
even if the c program contains variable of the form var#### how does it matter, say
for example i have int i,j,k,l,var4
then variables might be
i = var1, j var2 k var3 l var4 var4 var5.
and suppose if you need to reconstruct original variables , you need to anyway store the numbers isn't it indicating which number represents which variable
@anonymous,
You got it right. Most people normally try to make too much out of this simple question. Think of the implementation too...most make silly mistakes there too.
Post a Comment
<< Home