Programming interview questions

A recruiter sent this simple set of interview questions for a programming position.

  1. How can you defined OOP?
  2. How can you use OOP in your projects/products/applications?
  3. What is copy constructor?
  4. How many types of copy constructor are there?
  5. What shallow copy constructor does/behaves?
  6. Does C++ support copy constructor?
  7. Does Java support copy constructor?
  8. (If the answer to the previous question was correct) Why doesn’t Java support copy constructor?
  9. What is software life cycle?
This entry was posted in C++, General, Java. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

17 Comments on Programming interview questions

  1. Vishal Sinha
    Posted 3/17/2005 at 7:00 am | Permalink

    OOP stands for Object Oriented Programming. It is an object based approach for developing a software solution for a given problem/domain. In OOP everyting is modeled in the form of objects which model a real life entity present in a problem. OOP has three major characteristics:

    1. Inheritance - This is the property by which an entity attains all attributes of its parent.
    2. Encapsulation - This is the property by which an entity hides all details about itself from the outside world.
    3. Polymorphism - This is the property by which an entity can exists in more than one form.

    In OOP we use interfaces to define an abstraction of the functionalities needed, and we use hte concept of class to define a solid implementation of the functionalities defined by an interface the class implements. A class can choose not to implement certain methods defined in an interface or on its own, in such case such a class needs subclassing and is called an abstract class. The difference between an interface and an abstract class is that an interface just define the scope of functionalities needed and an abstract class define as well as optionally implement the scope of functionalities needed.

  2. saurav sen
    Posted 4/4/2005 at 10:37 am | Permalink

    Answer to q#9: WEll the answer is that there are many phases, namely 5. The first is the Planning phase, in which the feaseablity testing and other plannings are done. The second is the designing part, in which each and every componnet is being designed. The third is the Coding part, where the desing is now converted to woking model by the coders. The fourth is the Testing part, the coding and he testing part may go hand in hand, this is to check the software for feasability, robustness, effeciency and quality. The final phase is the implementation and the maintainnance.

  3. saurav sen
    Posted 4/4/2005 at 10:41 am | Permalink

    search all the answers in http://www.microsoft.com/msdn

  4. gefiltefishka
    Posted 4/12/2005 at 5:09 pm | Permalink

    All objects in Java are passed by reference, eliminating the need for the copy constructor used in C++.(In reality, all parameters are passed by value in Java. However, passing a copy of a reference variable makes it possible for code in the receiving method to access the object referred to by the variable, and possibly to modify the contents of that object. However, code in the receiving method cannot cause the original reference variable to refer to a different object.)

  5. mohammad
    Posted 4/14/2005 at 12:33 pm | Permalink

    Is there anybody who knows how I can open a TIFF file with C++?

  6. Affan Rauf
    Posted 4/18/2005 at 1:55 am | Permalink

    Suppose we want to use copy constructor to make a copy of an object that contains a pointer (not null). In case of shallow copy the newly created object’s pointer will also point to the same memory to which the parameter object’ pointer was pointing. This is because the constructor just copied the contents of the pointer variable which is logically wrong. The correct way i.e. deep copy is to allocate memory to the pointer of the newly created object and copy the memory contents(not the contents of the pointer variable) to the memory allocated to the new pointer.

  7. Michael
    Posted 6/8/2005 at 7:06 am | Permalink

    The question I was asked once at the interview to Qualcomm, is what’s the difference between copy constructor and assignment operator?
    So, the answer should be, that the copy costructor is called at initializing the object, while the assignment operator used to assign one object by another.

  8. ilias
    Posted 8/1/2005 at 5:50 am | Permalink

    does java supports the concept of pointers and if not then what is the concept of copying the object reference from one object to another

  9. jacob
    Posted 8/3/2005 at 11:49 pm | Permalink

    can someone tell me how to declare a pointer to a single character?

  10. Devi Dutta
    Posted 8/19/2005 at 3:50 am | Permalink

    Difference between global,static and local variable at class and file levels?????????

  11. Posted 9/11/2005 at 2:48 am | Permalink

    For the question #3 , the copy constructor is used in C++ for creating the copy of the class member when there is a string present in it. When a constructor is allocated the class object while created allocates only a pointer, but when the copy constructor is used the size for the data object is created and the object is created.

  12. Posted 9/11/2005 at 2:50 am | Permalink

    How will you identify a loop in a linked list?? How will be the traversal made with out a temporary pointer being used??
    How will you remove the loop in the linked list??

  13. Posted 9/11/2005 at 2:52 am | Permalink

    I need to know about a 32 bit variable to produce only the following output 2,4,8,16,32. What is the masking element should we need to use.

  14. Posted 9/11/2005 at 2:54 am | Permalink

    For the question 9 , the answer is char *p;

  15. amitava chowdhury
    Posted 10/17/2006 at 4:19 am | Permalink

    core object oriented programming questions are required which includes classes, methods. different codes to implement inheritence and polymophism into your code in any language you work. need to know the basic OOP transactions.

  16. Mehul Thakkar
    Posted 4/13/2007 at 6:12 pm | Permalink

    Here is the answer of question 3

    copy constructor is used ot initialize & declare object from onethor object

    e.g
    data I2(I1);

    this statement would define object I2 & at a same time its value will be initialized with value of I1.

  17. kapil
    Posted 8/7/2008 at 7:03 pm | Permalink

    for the question 9 the answer is char *p.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*