Taking a test for a job

A

Allan M. Bruce

I am applying for my first jobs after completing my PhD. I have been asked
by a company to go and take a C programming test to see how my C skills are.
Apparantly this test is mostly finding errors in small snippets of code but
I was wondering if anyone could give me tips on what kind of things I should
be looking out for. The one area I dont feel confident in is how to declare
arrays of pointers and initialising multi-dimensional arrays.

Any advice would be very welcome.

Thanks
Allan
 
K

Keith Thompson

Allan M. Bruce said:
I am applying for my first jobs after completing my PhD. I have been asked
by a company to go and take a C programming test to see how my C skills are.
Apparantly this test is mostly finding errors in small snippets of code but
I was wondering if anyone could give me tips on what kind of things I should
be looking out for. The one area I dont feel confident in is how to declare
arrays of pointers and initialising multi-dimensional arrays.

<http://www.c-faq.com/>, particularly section 6.
 
J

Joe Wright

Allan said:
I am applying for my first jobs after completing my PhD. I have been asked
by a company to go and take a C programming test to see how my C skills are.
Apparantly this test is mostly finding errors in small snippets of code but
I was wondering if anyone could give me tips on what kind of things I should
be looking out for. The one area I dont feel confident in is how to declare
arrays of pointers and initialising multi-dimensional arrays.

Any advice would be very welcome.

Thanks
Allan
Hi Allan.

A PhD in what? CS?

My advice would be to read more C books. Declaring arrays of pointers
and initializing multi-dimensional arrays is straightforward.

You can ask specific questions about C here in this newsgroup.
 
A

Allan M. Bruce

Joe Wright said:
Hi Allan.

A PhD in what? CS?

My advice would be to read more C books. Declaring arrays of pointers and
initializing multi-dimensional arrays is straightforward.

You can ask specific questions about C here in this newsgroup.

My PhD is in Computing Science - more specifically Artificial Intelligence.
Its been a while since I did any C programming, but I am fairly knowledgable
as far as I know. I will dig out the old C books and have a look through
them and then post back any problems I may encounter.

Thanks
Allan
 
I

Ian Collins

Allan said:
I am applying for my first jobs after completing my PhD. I have been asked
by a company to go and take a C programming test to see how my C skills are.
Apparantly this test is mostly finding errors in small snippets of code but
I was wondering if anyone could give me tips on what kind of things I should
be looking out for. The one area I dont feel confident in is how to declare
arrays of pointers and initialising multi-dimensional arrays.

Any advice would be very welcome.
An old favourite is questions about he arguments to printf and scanf.
Have a look through this group's archives and see if you can answer most
of the posted FAQs.
 
F

Frank Silvermann

Allan said:
My PhD is in Computing Science - more specifically Artificial Intelligence.
Its been a while since I did any C programming, but I am fairly knowledgable
as far as I know. I will dig out the old C books and have a look through
them and then post back any problems I may encounter.
I'd be curious to know what types of C books you hit along the way to
your dissertation. frank
 
A

Allan M. Bruce

I'd be curious to know what types of C books you hit along the way to your
dissertation. frank

None! The development was done completely in Java, although coding isnt very
important in a PhD, its more about the ideas...
Allan
 
I

Ian Collins

Allan said:
None! The development was done completely in Java, although coding isnt very
important in a PhD, its more about the ideas...

A decent employer should appreciate that and be more interested in your
ability to contribute to their organisation, rather than your intimate
knowledge of C.
 
C

Christopher Benson-Manica

Ian Collins said:
A decent employer should appreciate that and be more interested in your
ability to contribute to their organisation, rather than your intimate
knowledge of C.

Yes. I think there are plenty of people who have enough familiarity with
language X to pass a test, but nevertheless are bad programmers.
Hiring a C programmer who happens to have memorized every detail about
printf() and scanf() is a bad idea, IMO. My advice to OP: Learn
enough to get an interview, and if they can't figure out that you are
a great programmer who merely is not a C guru, they probably aren't
worth working for.
 
M

Malcolm

Ian Collins said:
A decent employer should appreciate that and be more interested in your
ability to contribute to their organisation, rather than your intimate
knowledge of C.
Exactly my thoughts.
If you can program an artifical intellignece routine in Java then you can
learn C.
Unless you are desperate for any job, or unless it is a very small company
with naive management, you probably want to be looking elsewhere.
 
R

Rod Pemberton

Allan M. Bruce said:
My PhD is in Computing Science - more specifically Artificial Intelligence.

AI was a really popular topic in the early 90's. Despite learning some
interesting stuff then, I haven't seen or heard of much since. Most of it
was really primitive: attempting to model neurons, training weighted sum
neural networks, etc. Since you have a PHD in AI, what are the things that
you find most interesting?


Rod Pemberton
 
A

Allan M. Bruce

Rod Pemberton said:
AI was a really popular topic in the early 90's. Despite learning some
interesting stuff then, I haven't seen or heard of much since. Most of it
was really primitive: attempting to model neurons, training weighted sum
neural networks, etc. Since you have a PHD in AI, what are the things
that
you find most interesting?


Rod Pemberton

Alas you are talking about Neural Networks which is a small area of AI
which, as you said, was very popular about a decade ago. Our institution
researches all fields fo AI, with topics including Model Learning, Natural
Language Generation, Constraint Satisfaction, Planning, and my particular
field Qualitative Reasoning.

My PhD involved looking at Qualitative Reasoning (or 'thinking without
numbers') and attempting to bridge the gap between it and standard numerical
simulation. I also researched distributing all of the algorithms so that it
can be used on parallel machines or in web services (the latest buzz word in
academia).

My interests for a job would include either Neural Networks or Qualitative
Reasoning but I am also interested in many other fields, not necessarily
what I studied.

Allan
 
P

pemo

Rod said:
AI was a really popular topic in the early 90's. Despite learning
some interesting stuff then, I haven't seen or heard of much since.
Most of it was really primitive: attempting to model neurons,
training weighted sum neural networks, etc. Since you have a PHD in
AI, what are the things that you find most interesting?


Rod Pemberton


As an ex-D.Phil [what Oxford calls a Ph.D. - we like to be different!]
student in Computational Linguistics, I /suspect/ that Allan has used A.I.
as a blanket term - as I used to do [it's the thing people have usually
heard about]?

What did surprise me is the Java - I would have bet a shed load of money on
him citing Prolog!
 
A

Allan M. Bruce

AI was a really popular topic in the early 90's. Despite learning
some interesting stuff then, I haven't seen or heard of much since.
Most of it was really primitive: attempting to model neurons,
training weighted sum neural networks, etc. Since you have a PHD in
AI, what are the things that you find most interesting?


Rod Pemberton


As an ex-D.Phil [what Oxford calls a Ph.D. - we like to be different!]
student in Computational Linguistics, I /suspect/ that Allan has used A.I.
as a blanket term - as I used to do [it's the thing people have usually
heard about]?

What did surprise me is the Java - I would have bet a shed load of money
on him citing Prolog!

Indeed, Prolog is heavily used or certainly was, and Lisp. But as with
everything, the trend at the moment is Java. I am glad though as my little
prolog experience was not good!
Allan
 
K

Keith Thompson

Rod Pemberton said:
AI was a really popular topic in the early 90's. Despite learning some
interesting stuff then, I haven't seen or heard of much since. Most of it
was really primitive: attempting to model neurons, training weighted sum
neural networks, etc. Since you have a PHD in AI, what are the things that
you find most interesting?

There's an entire hierarchy of comp.ai.* newsgroups where this kind of
thing is topical.
 
R

Rod Pemberton

Keith Thompson said:
There's an entire hierarchy of comp.ai.* newsgroups where this kind of
thing is topical.

As always, Keith stating the obvious and known in an ignorant and useless
manner. If I wanted a response to my question from the generic AI populace,
I would've asked there. But, I didn't. I wanted a response from someone
who was extremely interested in AI (i.e., PHD) and upto date (i.e., new
PHD). In other words, the individual who posted here.


Rod Pemberton
 
T

Tomás

Allan M. Bruce posted:
I am applying for my first jobs after completing my PhD. I have been
asked by a company to go and take a C programming test to see how my C
skills are. Apparantly this test is mostly finding errors in small
snippets of code but I was wondering if anyone could give me tips on
what kind of things I should be looking out for. The one area I dont
feel confident in is how to declare arrays of pointers and
initialising multi-dimensional arrays.

Any advice would be very welcome.


I would approach it with this attitude: The person who wrote the exam is
an absolute idiot, and it's my duty to show just how much of an idiot he
is.

Why?

Because most programming language exams are erroneous. You might even see
a question which has code that attemps to set all of an array's elements
to zero:

int *array[50];

memset( &array, 0, sizeof( int[50] ) );


You should give a very arrogant answer such as:


The programmer errorneously overlooked the fact that not all zero values
need be represented by all bits zero in memory; in particular: a null
pointer value, 0 for a float or double. Therefore, the above code
exhibits Undefined Behaviour.


-Tomás
 
R

Richard Heathfield

Tomás said:
I would approach it with this attitude: The person who wrote the exam is
an absolute idiot, and it's my duty to show just how much of an idiot he
is.

Why?

Because most programming language exams are erroneous. You might even see
a question which has code that attemps to set all of an array's elements
to zero:

int *array[50];

memset( &array, 0, sizeof( int[50] ) );


You should give a very arrogant answer such as:


The programmer errorneously overlooked the fact that not all zero values
need be represented by all bits zero in memory; in particular: a null
pointer value, 0 for a float or double. Therefore, the above code
exhibits Undefined Behaviour.

Not to mention the fact that array has type int *[50], so &array has type
(int *[50])*. The appropriate sizeof would be sizeof(int *[50]) or sizeof
array, not sizeof(int[50]). In my opinion this is a far graver error.
 
G

Guest

Tomás said:
Allan M. Bruce posted:
I am applying for my first jobs after completing my PhD. I have been
asked by a company to go and take a C programming test to see how my C
skills are. Apparantly this test is mostly finding errors in small
snippets of code but I was wondering if anyone could give me tips on
what kind of things I should be looking out for. The one area I dont
feel confident in is how to declare arrays of pointers and
initialising multi-dimensional arrays.

Any advice would be very welcome.


I would approach it with this attitude: The person who wrote the exam is
an absolute idiot, and it's my duty to show just how much of an idiot he
is.

Why?

Because most programming language exams are erroneous. You might even see
a question which has code that attemps to set all of an array's elements
to zero:

int *array[50];

memset( &array, 0, sizeof( int[50] ) );


You should give a very arrogant answer such as:


The programmer errorneously overlooked the fact that not all zero values
need be represented by all bits zero in memory; in particular: a null
pointer value, 0 for a float or double. Therefore, the above code
exhibits Undefined Behaviour.

After adding the missing *, I don't think there is undefined behaviour
on any system just yet. The code sets all elements to all bits zero. If
it's an invalid pointer value, there's not a problem until the pointers
are actually read. (Sure, the code you've shown is then a very bad
idea, but don't claim UB when there isn't.) If it's a valid null
pointer, the code is unnecessarily nonportable, but correct for that
implementation. And if all bits zero is a valid pointer value, but not
a null pointer, and that special pointer value is needed, this may even
be a good way of getting it.
 
T

Tomás

The appropriate sizeof would be sizeof(int *[50])
or sizeof array, not sizeof(int[50]). In my opinion this is a far
graver error.


One of the pitfalls of not checking over one's code.

Thankfully though, there's a distinction between the sample code I post to
newsgroups, and the real code I actually compile.


-Tomás
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top