473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

i need some C/C++ test intervie questions

hello everyone,
Iam vasant from India..
I have a test+interview on C /C++ in the coming month so plz help me
by giving some resources of FAQS, interview questions, tracky
questions, multiple choice questions.etc..
I'll be indebted to everyone..
Thanks in advance..
regards
vasant shetty
Bangalore
India
Nov 13 '05
162 14663
"Jack Klein" <ja*******@spamcop.net> wrote:
"Name the ISO International Standard number for the C/C++
language."


9899 / 14882 = 0.66516597231554898535143125923935

--
Simon.
Nov 13 '05 #151
On Sun, 7 Sep 2003 12:22:38 +0100
sp**@hubris2.demon.co.uk (Duncan Harvey) wrote:
Mark Gordon <sp******@flash-gordon.me.uk> wrote:
<snip>
Do you fancy having the altimeter on an aircraft reporting an out of
memory error?


Yes, if the alternative is an incorrect reading.


The alternative is you design a solution that does not require *alloc.
For all of the embedded work I did this was easy since where data was
being read in to buffers you had exact specifications at to the maximum
data rates and what to do if you could not process data fast enough (in
my cases selectively throwing data away) so you could calculate buffer
sizes at design time.
Naturally, I'd hope that the device would operate uninterrupted and
correctly unless damaged or destroyed (or suffering power-loss, I
assume?).


For safety critical work you have all sorts of things done to ensure
continued operation such as an independent backup. The details depend on
how safety critical the system is (there are different levels) and what
is practical. Almost all of my work was *not* safety critical so I'm not
an expert.
So it is entirely possible depending on what area the person was
working in.


I cannot recall I'm afraid, but believe that the person had no
embedded experience whatsoever.


I've written (or been involved in writing) large programs in Pascal that
did not use dynamic memory allocation and would not have used *alloc
functions if written in C. However they did you string manipulation.

I find it hard to believe that someone could work for along time in C
outside the embedded market without having to use C strings and str*
functions and *alloc functions. Although as another poster said the
*alloc functions could be used through wrapper functions.
--
Mark Gordon
Nov 13 '05 #152
sp**@hubris2.demon.co.uk (Duncan Harvey) writes:
Some people have no fear of, nor dislike of, reading technical documents
but are instead mindful of how such documents are structured and are
well aware of the perils of receiving information out of context. With
special regard to standards documents, the context /is the entire
document/. One cannot just look at a single paragraph in isolation and
declaim "this proves what I say is true".
I disagree. While it is in fact often necessary to consider serveral
paragraphs scattered throughout the standard, theorems about the language
can be proven or disproven without considering the entire document.
For (a silly) example, person A might be optimising an inner loop that
invoked ispunct() a lot. They start to do bizarre things to 'optimise'
away this call to "avoid function call overhead". Person B says that it
might be the case that the implementation has already done this for
them. Person A snorts and replies, '7.3.1.11 states "The ispunct()
*function* tests [...]"'[1] and slumps back into his chair satisfied. (I
admit, as hypothetical examples go, that is not entirely convincing but
I trust that you'll see what I'm driving at.)


Maybe I misunderstand your example completely, but I don't see how it
supports your position. Person A simply misunderstands the scope of
the standard, which describes the behavior of an abstract machine.
A conforming implementation need only match the /observable/ behavior
of the abstract machine. But it is not necessary to read the entire
standard to understand its scope.

Martin
Nov 13 '05 #153
Simon Biber wrote:
"Jack Klein" <ja*******@spamcop.net> wrote:
"Name the ISO International Standard number for the C/C++
language."


9899 / 14882 = 0.66516597231554898535143125923935


Excellent. A fairly close approximation is 2/3.

--
Replies should be to the newsgroup
Chuck Falconer, on vacation.
Nov 13 '05 #154
Mark Gordon wrote:

<snip>
I find it hard to believe that someone could work for along time in C
outside the embedded market without having to use C strings and str*
functions and *alloc functions.
So do I. Nevertheless, either it's true, or people lie on their CVs about
how much experience they have of programming in the C language.

Which would you bet on? ;-)
Although as another poster said the
*alloc functions could be used through wrapper functions.


True; but, even so, you'd expect a guy with 20 years under his belt to have
worked out how to call malloc by now.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #155
On Fri, 5 Sep 2003 20:16:38 +0000 (UTC), Richard Heathfield
<do******@address.co.uk.invalid> wrote:

Tom Zych wrote:
I'm not a standard C guru (yet).
Anybody who claims they are, aren't. With, perhaps, two or three
exceptions.

My answer is, it doesn't matter,
because even if one can dig into the standard and show that this
works reliably, it's bad code.
You can't tell if it works without
being a language lawyer, and it offers no advantage over clear and
reliable code. It should be rewritten and the original coder
should be shot[1].


This is a very important aspect of the answer, which no self-respecting
interviewee should ignore as a possible lifeline if they are floundering on
the actual sequence point issue.


Indeed. I would accept an "I'm not sure, but..." with the above as a
reasonably correct answer. It seems pretty obvious to me, but then, I'm
Mr. Wonderful. 8o/
--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Nov 13 '05 #156
On Fri, 05 Sep 2003 07:19:05 -0400, LibraryUser
<de**********@made.invalid> wrote:
You mean you are hiring? I can be bought. :-)


You live in SoCal?
--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Nov 13 '05 #157
On Sun, 7 Sep 2003 14:11:33 +1000, "Peter Nilsson" <ai***@acay.com.au>
wrote:

"Kevin D. Quitt" <KQ****@IEEInc.com> wrote in message
where 1 is "What's C?" and 10 is "I'm Dennis Ritchie".
I certainly don't wish to be disrespectful, but Dennis Ritchie's role with
the Standards was consultative, and even the Committee members focused on
separate aspects of the standards. So, is Dennis necessarily at the top end
of the scale?


My intent was to be whimsical, implying that the scale is not a
hard-and-fast thing with objective values. How about "I'm Henry Spencer"?
There doesn't seem to me to be any serious way to represent the top end of
the scale, or a more meaningful one no matter how it's expressed. I am
open to ideas, of course.

Another question is: does designing a language necessarily make you the top
expert at programming in that language?
For a while, at least. 8o)

I guess I think such ratings are rather nebulous


Intentionally, but not meaningless.

--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Nov 13 '05 #158
On 5 Sep 2003 07:36:36 -0700, ru**@webmail.co.za (goose) wrote:

Kevin D. Quitt <KQ****@IEEInc.com> wrote in message news:<5c********************************@4ax.com>. ..
Well, I am - but I'm not perfect.
glad you realise it :-) no one is. but ttry telling a prima donna
that they write faulty code.


Been there, done that, got the scars. It's my experience that prima
donnas don't last long. Too long, sometimes.

Anybody who correctly points out an error (other than a deliberate one)
wins.


<sigh> not really. you get labelled as a "lone programmer" (as opposed
to a "team player") if you hurt the prima donnas feelings.


I meant with my exam (or code, for that matter). I am an ego-less
programmer. If there's a bug in my code, I'm delighted when somebody can
tell me what it is or what it does, so that they or I can fix it; I only
care that the code be properly functional. My expertise is ultra-reliable
code; you can't have that if you aren't willing for it to be beaten to
death by everyone involved.

<grin> not even my partially complete rtos written mostly in std C
(with all the platform-specific stuff in seperate files) ???
but i'm *proud* (or rather, was) of it...
Actually, *hearing* about it would be of interest - how it was organized,
etc., and it doesn't matter what language it was written in. That
information is *useful*: it helps me see how you think. I am also
interested in seeing clever code snippets, whether they're "good" code or
not. Because I'm such a swell guy, see the program below.

or you can ask them to name the ergs on clc ;-)
ergs?
Notes: There are no tab characters.
Each line starts with a greater-than which must be removed.
Each line must end with <CR><LF> for x86 machine language
-----------------------8<--------------------------

(*O/*_/
Cu #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*+Ex=
CuG #%* POLYGLOT - a program in seven languages 15 February 1991 *+Ex=
CuG #%* *+Ex=
CuG #%* Written by Kevin Bungard, Peter Lisle, and Chris Tham *+Ex=
CuG #%* *+Ex=
CuG #%* We have successfully run this program using the following: *+Ex=
CuG #%* ANSI COBOL: MicroFocus COBOL85 (not COBOL74) *+Ex=
CuG #%* ISO Pascal: Turbo Pascal (DOS & Mac), Unix PC, *+Ex=
CuG #%* AIX VS Pascal *+Ex=
CuG #%* ANSI Fortran: Unix f77, AIX VS Fortran *+Ex=
CuG #%* ANSI C (lint free): Microsoft C, Unix CC, GCC, Turbo C++, *+Ex=
CuG #%* Think C (Mac) *+Ex=
CuG #%* PostScript: GoScript, HP/Adobe cartridge, *+Ex=
CuG #%* Apple LaserWriter *+Ex=
CuG #%* Shell script: gnu bash, sh (SysV, BSD, MKS), ksh *+Ex=
CuG #%* 8086 machine language: MS-DOS 2.00, 3.03, 4.01, 5.00 beta *+Ex=
CuG #%* VPix & DOS Merge (under unix) *+Ex=
CuG #%* SoftPC (on a Mac), MKS shell *+Ex=
CuG #%* *+Ex=
CuG #%* Usage: *+Ex=
CuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com] *+Ex=
CuG #%* 2. Compile and/or run with appropriate compiler and *+Ex=
CuG #%* operating system *+Ex=
CuG #%* *+Ex=
CuG #%* Notes: *+Ex=
CuG #%* 1. We have attempted to use only standard language features. *+Ex=
CuG #%* Without the -traditional flag gcc will issue a warning. *+Ex=
CuG #%* *+Ex=
CuG #%* 2. This text is a comment block in all seven languages. *+Ex=
CuG #%* *+Ex=
CuG #%* 3. When run as a .COM file with MS-DOS it makes certain *+Ex=
CuG #%* (not unreasonable) assumptions about the contents of *+Ex=
CuG #%* the registers. *+Ex=
CuG #%* *+Ex=
CuG #%* 4. When transfering from Unix to DOS make sure that a LF *+Ex=
CuG #%* is correctly translated into a CR/LF. *+Ex=
CuG #%* *+Ex=
CuG #%* Please mail any comments, corrections or additions to *+Ex=
CuG #%* pe***@extro.ucc.su.oz.au *+Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*QuZ=
CuG #%* *+Ex=
CuG #%*!Mx)ExQX4ZPZ4SP5n#5X!)Ex+ExPQXH,B+ExP[-9Z-9Z)GA(W@'UTTER_XYZZY'CPK*+
CuG #(* *(
C # */); /*(
C # *) program polyglot (output); (*+
C # identification division.
C # program-id. polyglot.
C #
C # data division.
C # procedure division.
C #
C # * ))cleartomark /Bookman-Demi findfont 36 scalefont setfont (
C # * (
C #
C # * hello polyglots$
C # main.
C # perform
C * ) 2>_$$; echo "hello polyglots"; rm _$$; exit
print
C stop run.
-*, 'hello polyglots'
C
C print.
C display "hello polyglots". (
C */ int i; /*
C */ main () { /*
C */ i=printf ("hello polyglots\n"); O= &i; return *O; /*
C *) (*
C *) begin (*
C *) writeln ('hello polyglots'); (*
C *) (* )
C * ) pop 60 360 (
C * ) pop moveto (hello polyglots) show (
C * ) pop showpage ((
C *)
end .(* )
C)pop% program polyglot. *){*/}

-----------------------8<--------------------------

--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Nov 13 '05 #159
On Sat, 6 Sep 2003 22:36:51 +0100, sp**@hubris2.demon.co.uk (Duncan
Harvey) wrote:
a trivial aptitude test


THat's what mine is supposed to be, except a little more, as well. I'll
show you mine if you'll show me yours. 8o)
--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Nov 13 '05 #160
In article <20******************************@flash-gordon.me.uk>,
sp******@flash-gordon.me.uk says...
Do you fancy having the altimeter on an aircraft reporting an out of
memory error?


Conventional aircraft have traditional altimeters which function off
barometric pressure, no firmware required. The error is likely to be
due to changes in atmospheric pressure, which is normally corrected
by locale specific data given by air traffic control, or an automated
weather reporting system (radio) such as AWOS.

Even modern "glass cockpit" planes that have altitude information fed
to an electronic display from a source such as a 3D-nav GPS feed still
typically have a backup altimeter that will function even in the event
of an electrical failure which will render altitude data from a GPS
useless. It's also typically less accurate to use the "modern" GPS-
based solution (provided the manual altimeter is calibrated for local
pressure).

The only "out of memory error" likely on an actual altimeter is the
one where the senile pilot forgets to adjust for current pressure
conditions on a regular basis.

--
Randy Howard _o
2reply remove FOOBAR \<,
______________________()/ ()______________________________________________
SCO Spam-magnet: po********@sco.com
Nov 13 '05 #161
On Mon, 8 Sep 2003 21:06:01 -0500
Randy Howard <ra**********@FOOmegapathdslBAR.net> wrote:
In article <20******************************@flash-gordon.me.uk>,
sp******@flash-gordon.me.uk says...
Do you fancy having the altimeter on an aircraft reporting an out of
memory error?
Conventional aircraft have traditional altimeters which function off
barometric pressure, no firmware required. The error is likely to be


Add in a most. I personally know of one instance where the altimeter
used by the autopilot is *not* barometric and *does* have firmware. I
know of it because I worked on some of the firmware.

<snip>
The only "out of memory error" likely on an actual altimeter is the
one where the senile pilot forgets to adjust for current pressure
conditions on a regular basis.


You would not get an out of memory error on the one I worked on the
software for since it does not use dynamic memory allocation an it was
analysed to ensure that there was sufficient space for the stack.
--
Mark Gordon
Nov 13 '05 #162
Kevin D. Quitt <KQ****@IEEInc.com> wrote in message news:<5m********************************@4ax.com>. ..
On 5 Sep 2003 07:36:36 -0700, ru**@webmail.co.za (goose) wrote:
<snipped>
<sigh> not really. you get labelled as a "lone programmer" (as opposed
to a "team player") if you hurt the prima donnas feelings.


I meant with my exam (or code, for that matter). I am an ego-less
programmer. If there's a bug in my code, I'm delighted when somebody can
tell me what it is or what it does, so that they or I can fix it; I only
care that the code be properly functional. My expertise is ultra-reliable
code; you can't have that if you aren't willing for it to be beaten to
death by everyone involved.


well, theres only one question left now "are you hiring?" :-)
(or more specifically "are you hiring in South Africa?":)

<grin> not even my partially complete rtos written mostly in std C
(with all the platform-specific stuff in seperate files) ???
but i'm *proud* (or rather, was) of it...
Actually, *hearing* about it would be of interest - how it was organized,
etc., and it doesn't matter what language it was written in. That
information is *useful*: it helps me see how you think. I am also
interested in seeing clever code snippets, whether they're "good" code or
not. Because I'm such a swell guy, see the program below.


me too, however I was only *once* on the hiring end (where I do the
interview), and the candidates all *knew* about ansi-c, but got
confused when i said c89 (or c90).
or you can ask them to name the ergs on clc ;-)


ergs?

err, misspelled -> regs

<snipped and saved>

goose,
a mere C programmer, see ?
Nov 13 '05 #163

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.