Thread: Frequent Job Interviewing Questions

  1. #31
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    Thanks axon and mystic_skies..

    but they don't expect me to memorize everything i've been into , do they?
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  2. #32
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    Here's one from an interview I had:

    Given a node in a singly linked list, with no other knowledge of the list (i.e. not knowing the head), how would you remove that node?
    do they want you to actually delete that node, or just write a code that would give the effect that the mentioned node has been removed?? the latter is simple enough, i am not too sure if actual deletion of the node can be done with the limited info. is it possible to delete it ??
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  3. #33
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    For all those who applied for a programming job :

    Which would help you most to get the job : your personal portfolio , your experience (like worked with few APIs\systems ..etc) or the job interview?
    When you apply for a job, chances are that about hundred other people applied as well. The most important part is the job interview. However, no one will interview a hundred people. First, people will sort out the 10 most likely candidates. This will be done by looking at your resume & cv. Priority here is knowledge of the stuff they work with. Obviously, 2 years Oracle is better than 3 years MS-SQL if the employer is using Oracle. Then there are things in the cv that don't fit the image people have of their future employee. If you have to sort out 90% to keep it managable, you take every reason you can get. I have sorted out resumes for the sole fact that those people had a german D equivalent in Maths 8 years ago in school.

    So all parts are important, each in another step of the screening.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #34
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    @Ping: The code just has to appear to remove the node from the list. As long as the list is without that node afterwards, and there aren't any memory leaks, it's all good.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #35
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Damnit XSquared!!! Now you gave me something to try

  6. #36
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    - Can we generate a C++ source code from the binary file?
    Yes and no. You can disassemble a binary file and then try to convert it to C++. However with optimization it most likely will not look anything like your orginal code. Also variable names will be lost.
    I'd have to say the answer is no. You cannot put a class back together again, no matter how good a reverse engineer you are.

  7. #37
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Quote Originally Posted by PING
    do they want you to actually delete that node, or just write a code that would give the effect that the mentioned node has been removed?? the latter is simple enough, i am not too sure if actual deletion of the node can be done with the limited info. is it possible to delete it ??
    I want to know the answer, too. And it'd better be some smart solution, not just a joke.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  8. #38
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    The way I did it; copy the data from next node to the current (first loop this will be the node that should be "deleted") node, set current node to be next. Repeat unitil you reach the end node, then pop that endnode.
    Last edited by Shakti; 02-26-2005 at 01:48 AM.

  9. #39
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Along the same idea as Shakti:
    Node C = current Node
    Node N = next Node
    Node X = N->next

    Copy the data part from N to C. Get address of X. Delete N, set C->next = X

  10. #40
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Ah yah, that was a little better and little faster than mine

  11. #41
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well in all fairness I didn't have an answer until I saw your post and then just saw a faster way

    Now the real question becomes: If you are at the tail can you delete the Node?

  12. #42
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Now the real question becomes: If you are at the tail can you delete the Node?
    Damn, beaten to the obvious question now
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  13. #43
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Yes , if you design it for it to be possible
    Last edited by Shakti; 02-26-2005 at 11:13 AM.

  14. #44
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well we know the design is poor because
    1) its a single link
    2) You can get to the head


  15. #45
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Sorry, left something out in my initial problem statement. It's a circular singly linked list.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 04:49 PM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Object oriented job questions
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-28-2004, 05:06 AM
  4. Looking for sample MC test questions for a job
    By garp in forum C Programming
    Replies: 2
    Last Post: 09-29-2003, 05:30 AM
  5. I can't find a job.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 06-29-2003, 08:35 PM