C++ Interview Questions

Windows Programming Interview Questions III

  1. What is DuplicateHandle (API)? - Takes an entry in one process’s handle table and makes a copy of the entry into another process’s handle table
  2. What is a thread? - A thread describes a path of execution within a process. Every time a process is initialized, the system creates a primary thread. This thread begins executing with the C/C++ run-time library’s startup code, which in turn calls your entry-point function ( main , Wmain , WinMain , or WWinMain ) and continues executing until the entry-point function returns and the C/C++ run-time library’s startup code calls ExitProcess

Interview questions on C/C++

Q1: Tell how to check whether a linked list is circular.

A: Create two pointers, each set to the start of the list. Update each as follows:

while (pointer1) {
 pointer1 = pointer1->next;
 pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
 if (pointer1 == pointer2) {
   print ("circularn");
 }
}

Q2: OK, why does this work?

If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, it’s either 1 or 2 jumps until they meet.

C++ Object Interviews Questions

  1. What is a modifier? A modifier, also called a modifying function is a member function that
    changes the value of at least one data member. In other words, an
    operation that modifies the state of an object. Modifiers are also
    known as ‘mutators’. Example: The function mod is a modifier in the
    following code snippet:

    class test
    {
        int x,y;
        public:
          test()
          {
               x=0; y=0;
          }
      void mod()
          {
             x=10;
             y=15;
          }
    };
  2. What is an accessor? An accessor is a class operation that
    does not modify the state of an object. The accessor functions need to
    be declared as const operations

C++ Object Interviews Questions II

  1. What is an adaptor class or Wrapper class?
    A class that has no functionality of its own. Its member functions hide
    the use of a third party software component or an object with the
    non-compatible interface or a non-object-oriented implementation.
  2. What is a Null object? It is an object of some
    class whose purpose is to indicate that a real object of that class
    does not exist. One common use for a null object is a return value from
    a member function that is supposed to return an object with some
    specified properties but cannot find such an object.

C++ Game Developers Interview Question

  1. Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at:
    • const char *
    • char const *
    • char * const

Pages (8): « First ... « 1 2 3 [4] 5 6 7 » ... Last »