Monday, March 24, 2008

C questions for a hardware engineer @ Tech Interviews.com

C questions for a hardware engineer @ Tech Interviews.com

  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?

12 Responses to “C questions for a hardware engineer”

  1. bhaskar Krishna Says:

    What is the difference between = and == in C?

    = is an assignment operator

    a=b; //b’s value is stored in a

    if( a==b) // a’s value is compared with b

  2. ganesh Says:

    What are the total number of lines written in C/C++? What is the most complicated/valuable program written in C/C++?

  3. veeru Says:

    How many bit combinations are there in a byte?
    128 combinations from
    8′h00
    8′hff

  4. prasad Says:

    Have you studied buses? What types?

  5. xyz Says:

    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 ?

    Ans.
    A sample microprocessor pipeline has following five stages.
    Instr Fetch-> Decode -> Execute -> Memory-> Write Back
    Throughput =1 inst/clock
    Latency =5 clocks.

  6. bhaskar krishna Says:

    Have you studied buses? What types?

    Bus Types

    The expansion bus (where expansion cards go) is an extension of the Central Processor, so when adding cards to it, you are extending the capabilities of the CPU itself. The relevance of this regard to the BIOS is that older cards are less able to cope with modern buses running at higher speeds than the original design of 8 or so MHz. Also, when the bus is accessed, the whole computer slows down to the bus speed, so it’s often worth altering the speed of the bus or the wait states between it and the CPU to speed things up.

    The PC actually has four buses;

    -> the processor bus connects the CPU to its support chips,
    -> the memory bus connects it to its memory,
    -> the address bus is part of both of them, and
    -> the I/O (or expansion) bus is what concerns us here(carries input and output).

  7. mhz Says:

    How many bit combinations are there in a byte?

    If there are 8 bits in a byte, then the total number of combinations should be 2^8 = 256 no?

  8. Dos Says:

    dude, why would there be 256 combinations? hahahaha

    But you are right about the 8 bits in a byte, but the 8th bit is 128.

    So that means that ninth bit is 256, meaning there is a cumlative combination of the 9th bit -1 as being the combination in 8 bits.

    -Dos

  9. Dos Says:

    So 255 is the answer, if you didn’t get what I was saying.

    -Dos

  10. John Pfaff Says:

    No, there are 256 combinations, 0 through 255 (or 0×00 through 0xFF). 0 is a valid value.
    So the answer is 256.

  11. shekar_kcb Says:

    The difference btw = and == is :
    in code if you type ,
    a=5; /* means the value 5 will be assigned to 5 therfore = is an assignment */
    /* operator*/

    if(a==5) /* here == is used to compare , in otherwords == is used only to */
    /* compare the values here 5 is not assigned to a , but it checks */
    /* the value of a with 5 if true then proceeds with the loops*/

  12. naim shaikh Says:

    What is the code for reading “boot sector” in C ?

No comments:

如何发掘出更多退休的钱?

如何发掘出更多退休的钱? http://bbs.wenxuecity.com/bbs/tzlc/1328415.html 按照常规的说法,退休的收入必须得有退休前的80%,或者是4% withdrawal rule,而且每年还得要加2-3%对付通胀,这是一个很大...