C++ Interview Questions

Class Questions

  1. What is the syntax to inherit from a class in C#?
    Place a colon and then the name of the base class.
    Example: class MyNewClass : MyBaseClass
  2. Can you prevent your class from being inherited by another class?
    Yes.  The keyword “sealed” will prevent the class from being inherited.
  3. Can you allow a class to be inherited, but prevent the method from being over-ridden?
    Yes.  Just leave the class public and make the method sealed.
  4. What’s an abstract class?
    A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class without any implementation.

Hardware Architecture Interview Questions

  1. Are you familiar with the term MESI?
  2. Are you familiar with the term snooping?
  3. Describe a finite state machine that will detect three consecutive coin tosses (of one coin) that results in heads.
  4. In what cases do you need to double clock a signal before presenting it to a synchronous state machine?
  5. You have a driver that drives a long signal & connects to an input device. At the input device there is either overshoot, undershoot or signal threshold violations, what can be done to correct this problem?

Tricky C Questions

  1. How do you write a program which produces its own source code as its output?
  2. How can I find the day of the week given the date?
  3. Why doesn’t C have nested functions?
  4. What is the most efficient way to count the number of bits which are set in a value?
  5. How can I convert integers to binary or hexadecimal?
  6. How can I call a function, given its name as a string?
  7. How do I access command-line arguments?
  8. How can I return multiple values from a function?

C++ Developers Questions

  1. Will the following program execute?void main()
    {
    void *vptr = (void *) malloc(sizeof(void));
    vptr++;
    }
  2. How about this one?
    void main()
    {
    char *cptr = 0?2000;
    long *lptr = 0?2000;
    cptr++;
    lptr++;
    printf(” %x %x”, cptr, lptr);
    }
    Will it execute or not?
  3. When the processor wakes up after power on, it goes to a particular memory location. What is that memory location called?
  4. What is the difference between Mutex and Binary semaphore?
  5. Write a program to set 2nd bit in a 32 bit register with memory location 0×2000?

C Questions for Hardware Engineer

  1. What are the total number of lines written in C/C++? What is the most complicated/valuable program written in C/C++?
  2. What compiler was used?
  3. Have you studied buses? What types?
  4. Have you studied pipelining? List the 5 stages of a 5 stage pipeline. Assuming 1 clock per stage, what is the latency of an instruction in a 5 stage machine? What is the throughput of this machine ?
  5. How many bit combinations are there in a byte?
  6. What is the difference between = and == in C?
  7. Are you familiar with VHDL and/or Verilog?

Pages (8): [1] 2 3 4 » ... Last »