C++_part2_

Document Sample
C++_part2_ Powered By Docstoc
					C++ interview Question- Part 2

 1) Can main be overridden()?
               Main() cannot be overridden. It is not a member of any class and hence
 cannot be overridden.

 2) What is stack memory?
          Stack memory is a temporary memory, after the execution of the program, no
 longer the variables will be stored in the memory.

 3) What is heap memory?
           Heap memory are permanent memory, the memory allocated for object is
 maintained even after coming out the program.

 4) What is abstractor in C++?
         Abstract class is designed specially to develop base class. An abstract class
 contains atleast on virtual member function.

 5) How to define and use friend function in C++?
          It is defined like any other function. Except it should use the keyword friend.
     Declaration:-
 friend int system(exercise e1)

 6) Does C++ have default constructor?
          C++ provides default constructor that initialize all the members of the class to
 NULL value. These act as a default value.

 7) What is a container class?
          A class which could hold the objects in memory is called container class. It act
 as a generic holder.

 8) What are the types of container classes?
    Container class is of two types
      Heterogeneous container: - Group of mixed object
      Homogeneous container:- holding a group of same objects.

 9) Access level in C++?
         C++ consist of three important access level. They are as follows:-
 Public
 Private
 Protected.



 10) What is a class?
        A class is definition of an object.
Defining the class
Class {
//member
}

11) What is auto keyword?
       Variable declared with auto will be visible only with the block in which it is
declared. Auto variables don’t initialize automatically, you require to initialize explicitly.

12)What is Public, private and protected specifiers?

Public:- data and function inside the public accessible outside the class
Private:- Private data members and function accessible only within the class cannot
be accessed outside.
Protected:- data member and function accessed only my derived classes.

13) What is the output of printf(“%d”)?

     It would print the garbage value.

14) What is the difference between declaration and definition?
     Declaration highlights the compiler, at later point will the declaration will be defined.
Definition is the actual implementation.

15) What are the advantages of inheritance?
     Reusability
     It increase the readability of the program
     Reusability reduces the problem after the system is into function.

16) Difference between array and list?

       An array is a collection of homogenous element whereas a list is a collection of
        heterogeneous element.
       Memory allocated is static and continuous whereas list are random and dynamic

17) What is copy constructor?
            Copy constructor is a method which can accept the object of the same class
and copies data member to the object in the left part of assignment

18) What are 2 ways of exporting a function from a DLL?
      ·    DLL’s library
      ·    With reference to the function from the DLL instance.

19) What is type conversion?
   In a computing program the data required to converted from one type to another and it
is called as type conversion.

20) What is the difference between char a[] = “string”; and char *p = “string”; ?
    a[] will have 7 bytes and char *p= “string” is only 4 bytes since it is pointing to the
address.

21) What are the advantages of OOPL?
It represent directly real life objects.
It enables polymorphism.
Encapsulation.

22) What is downcasting?
     Casting down the hierarchy requires moving from general to a specific type.

23) What do you mean by analysis and design?
  The process of determining the requirement before performing the task, the developer
require to refer the existing documents and systems is analysis.
 Design phase require to choose a particular item and adopt it.

24) What do you meant by active and passive objects?
Active objects are one which an interaction which owns a thread and they are
responsible for handle control to other objects. In simple words it can be referred as
client.
Passive objects are one, which passively waits for the message to be processed. It waits
for another object that requires its services. In simple words it can be referred as server.

25) What is a modifier?
  A modifier is a function that modifies the data in the class.
Modifiers in java are as follows:-
     Abstract
     Final
     Native
     Public
     Protected
     Private
     Static.

				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:0
posted:10/20/2012
language:
pages:3