Thread: Interview question unsolved for long time...Plz help

  1. #1
    Registered User
    Join Date
    Jan 2008

    Interview question unsolved for long time...Plz help

    Please help me with following questions

    (Multiple choice)
    No Points if all choices are not ticked

    ****   Which of the following code fragments would trigger execution of the copy constructor of MyClass?
    1. MyClass  X; MyClass  Y(X);
    2. MyClass  X; MyClass  Y; X=Y;
    3 MyClass  X; MyClass  Y=X;
    4 MyClass  fn1() 
    {   static MyClass  X; 
        return  X; 
    const MyClass & Y=fn1();
    5 int fn1(MyClass   Y) 
    { return  1; 
    int i; MyClass Z; 
    ***  Which of the following is true about default COPY constructor?
    (Multiple CHoice )
    1 takes no arguments
    2 exists for any class
    3 performs a shallow copy
    4 will be executed when one object is assigned to another
    5 is compiler generated

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    Ah, and this is an assignment of sorts? Questions you need to know the answer to?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > Please help me with following questions
    You tell us which answers you think are correct, then we'll tell you if you're on the right track.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question time (classes and pointers)
    By swarm in forum C++ Programming
    Replies: 1
    Last Post: 02-20-2002, 11:33 AM
  2. time function question
    By heat511 in forum C++ Programming
    Replies: 5
    Last Post: 01-03-2002, 02:23 PM
  3. Newbie Source Code question. Hlp Plz?
    By BOOGIEMAN in forum Game Programming
    Replies: 4
    Last Post: 12-14-2001, 04:30 AM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM
  5. just a question this time
    By korbitz in forum C Programming
    Replies: 13
    Last Post: 11-18-2001, 06:21 AM