Professional Interview Question



  • what is static member function  
             http://www.learncpp.com/cpp-tutorial/812-static-member-functions/
  • Static function
          1.   can-we-have-a-static-virtual-functions-if-not-then-why

          2.  cannot-move-virtual-function-outside-header

          3. c-virtual-table-layout-of-mimultiple-inheritance

          4. multiple-inheritance-considered-useful/184402074

  • Partial Template specialization
           1. partial-template-specialization
  • Difference between template and macro
           1.  difference-between-macros-and-templates-compilation-build-time
  • What is virtual. 
      Virtual function help us to determine appropriate function at the run time.
  • Where is virtual  table reside 
    • Vtable is created at the compile time. it reside into the compiler.
  • where is virtual pointer reside 
    • Virtual Pointer reside into the Object.
  • are virtual pointer inheritable 
    • Yes
  • How virtual table determine the function 
    • Look into virtual Section
  • template is polymorphic 
    • template is compile time Polymorphism
  • what is static variable 
    • a variable whose scope is limited to the file
  • can static function initialize static variable 
    • No
    • Error: error: invalid use of qualified-name ‘sample::i’
  • should we check with null pointer if we allocate memory with new
    • No Need
  • if we give definition virtual function in derived class that will work 
    • No
  • can c++ check Index out of bound array at compile time 
    • Ans : No
  •  If we have same variable in the base class than into derived class how will you resolve this issue 
    • Scope resolution oeprator
  • What is runtime binding 
    • Virtual function
  • what is ps -elf 
    • We can print the all process along with the full format.
  • find two string in one pattern 
    • how will you delete 5 times older file
    • find /path/to/files* -mtime +5 -exec rm {} \; 
  •  Virtual destructor and purpose
  • Difference between macro and inline
  •     Name hiding
  • Difference between find , grep and cut
    • find determine file information
    • grep determine about string into file
    • cut used to print some information  
  • what is linux file structure 
    • http://www.ahinc.com/linux101/structure.htm
  •  what is purpose of locking thread
    • Synchronization
  • what is this pointer 
    • implict pointer
  • can we delete this pointer from destructor
    • No   
47. we do not pass the size when we delete array how can compiler
      identify that it needs to delete some amount of memory

48. What is use of double pointer

49. What is use of function pointer. Where are we using it. how will it define it

50.  What is purpose of function pointer

51. What is return  optimization

52.  why we need virtual base class. what will be the memory layout

53. How do we define virtual base class

54. In linux how will you identify 32 bit or 16 bit machine

55.where does vpointer reside into compiler?

56. what will be the size of following program
      class sample                        class sample
      {                                           {

           public:                               public:                         
           int a;                                  char b;
           char b;                               int a;
           void fun1();                        void fun2();
       }                                           }

 57.  what is structure padding




56. where does vpointer points?


58. where is the variable reside in compiler

59. why do we need stack for storing variable

60. what is type casting and where will you use.

61. what is upcasting and downcasting and where will you use

62. what is constructor initialization list and how does it work

63. how will you handle memory leak without using new/delete

64. what is scoped_ptr and how does it work.

65. can you perform min operation in O(1) time in stack
         http://stackoverflow.com/questions/3492302/easy-interview-question-got-harder-given-numbers-1-100-find-the-missing-numbe


66. can you implement stack using linklist and why do you need it
http://thecodecracker.com/c-programming/implementation-of-stack-using-linked-list/



67. what is the time complexity of push/pop operation in stack

68. can you insert element in stack using O(1) time complexity

69. why do we handle exception through null

68. can we delete this pointer

69. should we check new operation if it fails to allocate memory

70.how will you identify multiple occurence of number in O(n) time complexity and O(1) space complexity
    http://www.geeksforgeeks.org/archives/9755

71. how will you find missing number in O(1) time complexity
      sum the number and subtract the missing number.

72. Can you print the address of stack element

73. can we virtual keyword in the derived class
      http://www.cplusplus.com/forum/general/43554/

74. how can we access base class variable
      http://www.cplusplus.com/forum/beginner/43497/

75. how can we prevent inheritance

      http://www.cplusplus.com/forum/general/40079/

76. how can we prevent function overloading
      http://www.cplusplus.com/forum/general/34203/




 #include<iostream>  
 using namespace std;  
 class sample  
 {  
      public:  
      sample();  
      void fun(int a,int b)const;  
      void fun(int a,int b);  
      /*can not overload */  
      void fun2(int a,int b);  
     void fun2(const int a,const int b);  
      /* can not overloaded */  
      void fun3(int a,int b);  
      static void fun3(int a,int b);  
      /*can not overload */  
      void fun4(int *a,int *b);  
      void fun4(int a[],int b[]);  
 };  
 int main()   
 {  
      return 0;  
 }  
77. why do we need dynamic_cast
      http://www.cplusplus.com/forum/general/33990/

78. what is diffrence between const char char*
       http://www.cplusplus.com/forum/general/33123/

79.  how can we print vtable address
       http://www.cplusplus.com/forum/general/33019/

80.


"Abhishek

Binary Tree key Point.

1.What is binary tree.

2. what is maximum height of binary tree

3. how much does binary tree contain maximum node

4. how will you traverse binary tree and explain type of traverse

5. what is binary search tree

6. how will you insert element/delete element in binary tree

7. can binary tree represent by linked list.

 struct node  
 {  
  int data;  
  node *left;  
  node *right;  
 }  
8. do you know any well known application of binary tree
http://stackoverflow.com/questions/2130416/what-are-the-applications-of-binary-trees


9. Any live scenario which  may you across in your programming for implementing binary tree

10.What is virtual base class

12. how is the memory layout of virtual base class

13. What is difference between static vs Global variable

http://c.ittoolbox.com/documents/difference-between-static-global-variable-12174

14. Reverse the linked list through recursion

15. http://programmerinterview.com/index.php/c-cplusplus/introduction

16. What is Heap Sort
http://www.exforsys.com/tutorials/c-algorithms/heap-sort.html

17. What is singleton design pattern

18. what is disadvantage of singleton design patter
http://blogs.msdn.com/b/scottdensmore/archive/2004/05/25/140827.aspx

19. In which Category,Will it be considered Design pattern

20. What is Factory Design Pattern.

21. What is abstract Design Pattern

22. What is diffirence between thread and process

23. What is diffirence between semaphore and mutex


24. http://kundansingh.com/interview/

25. http://www.geeksforgeeks.org/

26. http://technical-interview.com/C_Questions_1.aspx

27. http://www.thecareerplus.com/?page=home


Preparation Question
=================================

1. What is mutex.

2. what is semaphore

3. what is difference between mutex and semaphore
http://www.geeksforgeeks.org/archives/9102

4. Can you write simple mutex in c++

5. what is this pointer

6.Can we use delete operator in c++ for this pointer
http://geeksforgeeks.org/forum/topic/can-we-use-delete-operator-in-c-for-this-pointer

7. static member function can access this pointer

8. what is purpose of static vs shared vs dynamic library

9. Can we return multiple value from c function
http://www.cplusplus.com/forum/beginner/14581/
http://www.learncpp.com/cpp-tutorial/74a-returning-values-by-value-reference-and-address/

11.what is use of double pointer
http://www.daniweb.com/software-development/c/threads/69966

12.  what is return value optimization
http://en.wikipedia.org/wiki/Return_value_optimization

13. What is structure padding
http://www.geeksforgeeks.org/archives/9705
http://clinuxpro.com/structure-padding
http://cboard.cprogramming.com/c-programming/137627-structure-padding.html
http://forums.techarena.in/software-development/1241260.htm
http://clinuxpro.com/how-to-avoid-structure-padding-using-pragma


14. what is type casting and where will you use
http://cppcoffe.blogspot.com/p/c-faq.html
http://www.cplusplus.com/doc/tutorial/typecasting/

15. can we handle memory leak without new
Yes with the boost library

16. can you find minimum element in stack in O(1) time.
      http://www.geeksforgeeks.org/archives/14149

17. can you implement stack using linked list
        Yes
18. should we check for  NULL after new operation
       No
19. how will you find the minimum element in O(1) time
 n(n+1)/2 -(sum of n number)
http://www.indiabix.com/technical/interview-questions-and-answers/

20. What is rule of makefile
http://www.tutorialspoint.com/makefile/index.htm

21. http://www.cplusplus.com/doc/tutorial/dynamic/

22. http://javarevisited.blogspot.com/2011/03/10-find-command-in-unix-examples-basic.html

23. http://www.cplusplus.com/doc/tutorial/templates/

24. What is stack unwinding

25.This Pointer  FAQ. 
     a) This can  be used for member function
     b)This can not be used into main function. 
    c)If we allocate memory through new destructor will not call automatic. We need to explicit call delete operator. 

26)Pointer To array.
 #include<iostream>  
 #include<malloc.h>  
 using namespace std;  
 #define MAXROW 4  
 #define MAXCOL 4  
 int main()  
 {  
  int (*p)[MAXROW]; /* Pointer to array */  
  cout<<sizeof(*p)<<endl; /* size of pointer */  
  cout<<sizeof(int)<<endl; /* size of int */  
  cout<<(sizeof(*p)/sizeof(int)); /* Resultant of this output */    
  p= new int [MAXROW][4]; /* Allocate memory with pointer to array */  
  /* Intialize the Pointer */  
  for(int i=0;i<MAXROW;i++)  
  {  
   for(int j=0;j<MAXCOL;j++)  
   {  
    p[i][j]= i;  
    cout<<p[i][j];  
   }  
   cout<<endl;  
  }      
  int **s;int **s1; /* Double Pointer */  
  s=(int**)malloc(MAXROW *sizeof(int*)); /* Allocate memory */  
  s1 = new int *[MAXROW];  
  for(int i=0;i<MAXROW ;i++)  
  {         
   s[i] = (int *)malloc(MAXROW * sizeof(int));      
   s1[i] = new int [MAXCOL];  
  }  
  int count=0;  
  for(int i=0;i<MAXROW;i++)  
  {  
   for(int j=0;j<MAXROW;j++)  
   {  
     s[i][j]=count++;        
     cout<<s[i][j];  
   }  
   cout<<endl;  
  }  
  Int *a1 = new int[5];  
  Int (*a2)[2] =new int [2][2];  

 27)What is  static object and why we need them.
      28) Should we do self assignment  with copy constructor.

4.   29)Why we need static function.
    The differences between a static member function and non-static member     functions are as follows.
        A static member function can access only static member data, static member functions  and     data and functions outsidethe class. A non-static member function can access all of the   above including the static data member. 
A static member function cannot be declared virtual, whereas a non-static member functions can be declared as virtual

In c, static function can be local to particular file.

     30)What is static class.
     A class which contain only the constructor  and method
         We can write throw and return statement into constructor..
7       Malloc and calloc and realloc http://www.cs.cf.ac.uk/Dave/C/node11.html

     31)What is segmentation fault.

     32)What is difference between sizeof and strlen

Inheritance Concept





 #include<iostream>  
 using namespace std;  
 class base  
 {  
         public:  
         int i;  
         public:  
         base()  
         {  
                 i=20;  
                 cout<<" the value of i :"<<i<<endl;  
         }  
         void get_base()  
         {  
                 cout<<" the value of i :"<<i<<endl;  
         }  
 };  
 class derived : public base  
 {  
         private:  
         int i;  
         public:  
         derived()  
         {  
                 i=30;  
                 base::i=40;  
                 cout<<" the value of i"<<i<<endl;  
         }  
         void get_show()  
         {  
                 cout<<" the value of i "<<i<<endl;  
         }  
 };  
 int main()  
 {  
         derived d;  
     d.get_show();  
         d.get_base();  
         return 0;  
 }  
 Concept:Data member can be change using scope operator  

Virtual Point.

 1).If we have pure virtual function than we will have vpointer into the

 2). http://www.dreamincode.net/forums/topic/45816-detail-about-how-vptr-and-virtual-table-works

 3).How many vtable create per class. is Vpointer  part of the object

 4).If we add virtual function and we need to provide the definition also. Otherwise we will get error.

 5) Why we need virtual base class
      http://www.learncpp.com/cpp-tutorial/118-virtual-base-classes/ 

6).http://www.phpcompiler.org/articles/virtualinheritance.html 

7)http://drdobbs.com/cpp/184402074

8)Why we need multiple inheritances.

 General Question 

 1) What is time complexity?  


 2)What is conversion constructo
     

6) http://stackoverflow.com/questions/28002/regular-cast-vs-static-cast-vs-dynamic-cast 

7)We can create the abstract class object and also assign the derived class object.By default every constructor is inline function In the inheritance, we  get constructor, destructor  and assignment operator We have simple, multilevel  and multiple inheritanc
So we write the following line I t does not call base class constructor and goes through
Derived class constructor.
Base *s= &der; (In compare base *s = new der)

8)What is Call  back mechanism


9)Switch case better if else
http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx

10)Where the vtable stored into memory
      It is depend compiler to compiler. Sometime it may store into ROM

11)Can you stop the name mangling
       We can stop the name mangling using the extern keyword
        This pointer can not be modified
12)What is difference   between DLL and exe.

13)What is client server Programing
      http://zone.ni.com/devzone/cda/tut/p/id/4431
        
14)How Tcp/ip work


16)hour and angle problem
       http://en.wikipedia.org/wiki/Clock_angle_problem
       http://www.f1gmat.com/problem-solving/clock-angles-math-problems

17) makefile
       http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
       http://www.cs.umd.edu/class/fall2002/cmsc214/Tutorial/makefile.html
       http://www.eng.hawaii.edu/Tutor/Make/
       http://www.codeproject.com/Articles/31488/Makefiles-in-Linux-An-Overview

18) Some Good interview Question about HR
        http://www.interviewquestionsanswers.net/in-what-areas-would-you-like-to-improve/

19)This Pointer with Inheritance:
        http://frogchunk.com/documentation/lang/cpp/Multiple_inheritance_and_the_this_pointer.pdf

20) splay tree:
        http://en.wikipedia.org/wiki/Splay_tree

21)

22)Design Pattern Question:
         http://www.interqiew.com/tests?type=dp

23)Factorials and Trailing zeros
        http://www.purplemath.com/modules/factzero.htm

24)http://www.cplusplus.com/forum/general/43943/

25)quick sort vs merge sort.
  http://stackoverflow.com/questions/680541/quick-sort-vs-merge-sort

 26)quick sort vs heap sort
   http://stackoverflow.com/questions/2467751/quicksort-vs-heapsort

 27)Input and CPU bound Process
  http://stackoverflow.com/questions/868568/cpu-bound-and-i-o-bound

 28)Sorting for duplicate number
 http://en.algoritmy.net/article/40549/Counting-sort

 29)Longest Common substring wiki
      http://en.wikipedia.org/wiki/Longest_common_substring_problem

 30)Prevent object in heap.
   http://stackoverflow.com/questions/10985/how-to-prevent-an-object-being-created-on-the-heap

 31)Smart Pointer
http://www.codeproject.com/Articles/15351/Implementing-a-simple-smart-pointer-in-c

 32)Bit Manupilation:
  http://stackoverflow.com/questions/1023901/a-quick-cheatsheet-on-using-a-bit-map-to-store-multiple-values

 33)Makefile:
http://www.codeproject.com/Articles/31488/Makefiles-in-Linux-An-Overview

34)Some Data Structure Video
http://www.youtube.com/playlist?list=PL01A89F4E9E5F3ADE&feature=plcp

35)Why we need fucntion overloading

36)What is difference between where and having clause.
http://gouravverma.blogspot.com/2008/04/where-vs-having-difference-between.html

37)What is signal
http://www.alexonlinux.com/signal-handling-in-linux#sigaction%28%29_in_action

38)What is difference between  cluster and non cluster index
http://sql-plsql.blogspot.com/2010/06/non-clustered-indexes.html
http://www.java2s.com/Tutorial/Oracle/0180__Index/0020__Create-Index.htm

39)What is difference between union and union all.

40)What is trigger

41)What is fork,vfork and how does create process inside system.
http://en.wikipedia.org/wiki/Fork_%28operating_system%29

42)What is kernal level thread and application level thred

43)What is kill and how did the remove the process

44)What is process lifecycle

45)What is difference between softlink and hardlink
  http://www.techcuriosity.com/articles/linux/difference_between_Hard_Link_and_Soft_Link_in_Linux.php
  http://www.maxi-pedia.com/difference+between+symbolic+link+and+hard+link

46)What is main difference between find and grep except file searching

47)What is difference between more and page.

48)When the this pointer create and what do you know about this pointer.
  http://stackoverflow.com/questions/2483679/when-is-this-pointer-initialized-in-c

49) What is object chaining and how does the compiler interpret the object chaining.

50)  http://stackoverflow.com/questions/2483679/when-is-this-pointer-initialized-in-c

51)Pointer
 http://tufangorel.blogspot.com/2011/10/double-pointer-operations-in-c.html

52)

53)
http://www.codeproject.com/Articles/11155/Abstract-Class-versus-Interface

54)is static member inherited

55)is operator overloading inherited

56)do we have alternative of void pointer

57)what is difference between vector and set

58)Main info.
http://www.thegeekstuff.com/2011/10/c-program-to-an-executable/

59)Friend function limitation.
http://stackoverflow.com/questions/3933637/why-friend-function-cant-be-used-for-overloading-assignment-operator

60)Create binary tree using array

61)Which data structure you will use for storing large data base

62)Reverse a link list without affecting another one.

63)Some Technical Question
http://technical-interview.com/C_Questions_1.aspx

Aircom Internation

C++

1) what are the basic concept of OOPS
2) What is Polymorphism
3) What is compile time Polymorphism
4)  is template compile time Polymorphism
5)  What is difference  between shallow copy and deep copy
6)  What is singleton pattern.Can you write code for that
7)  What is facade pattern.
8)  What is observer pattern
9)  What is virtual inheritance
9)  What is diamond shape problem
10) if base class one virtual function and derived class also contain virtual function.How many vtable create
11) When is vtable create ?
12) When is vpointer create ?
13) Can you explain vtable
14) Can you explain the compilation process
15) How the executable execute into system
16) What is the reason behind to decide default argument as trailer argument
17) Why do we need function overloading?
18) Why do we need function overriding?
19) Why do you need static object?.
20) What is static function?.
21) if Class B is Friend of A.Class C is Friend of B.What is the relation between A to C


Linux
1) what is sed command
2) what is awk command
3) what is tee command
4) what is difference between grep and find command
5) what is make file rule
6) Find the list of all file which does not contain particular string
7) what is touch command
8) what is main purpose of touch command
9) How will you copy from one machine to another machine
10)how will you delete a line in vi editor
11)How will you delete a word in vi editor
12)How will you delete a single character in vi editor
13)How will you execute a shell command within vi editor.(i.e) you have already
 open file than after you want to execute shell command. How will you execute
 shell command
14)How will you find a string into only particular directory and not recursive directory
15) what is max depth into Linux command
16)How will you search a particular word into vi editor
17)How will you do substitution into vi editor


Template specialization
2. Exception list
3. polymorphism in Python
5. Multithreading vs Multiprocessing
1. In diamond shape problem, How will you set base class variable
2.The constructor should throw exception or not

3. In non virtual class, it should have virtual destrctor
4.How will I read into middle  node of linked list

5. #deefine or const which is better in coding guideline

6. Can pure virtual function have function body?

7.how will you write final class

8.


9.serialization, generator and decorator in Python

10.template specilization

11. what is demon process
 http://www.enderunix.org/docs/eng/daemon.php