Difference between revisions of "Interview questions"

From Wiki at Neela Nurseries
Jump to: navigation, search
m (^ Hardware Questions: - minor formatting.)
m (^ Hardware Questions: - minor formatting.)
 
Line 205: Line 205:
  
 
<ul>
 
<ul>
  *  What is the difference between a flip flop and a latch?<br />
+
*  What is the difference between a flip flop and a latch?<br />
  <ul><i>A:  latch is level triggered, flipflop is edge triggered</i></ul> <ul><i></i></ul>
+
<ul><i>A:  latch is level triggered, flipflop is edge triggered</i></ul> <ul><i></i></ul>
<br />
+
 
  *  Describe some cache coherency problems with DMA.
+
*  Describe some cache coherency problems with DMA. <br />
<br />
+
*  What is a register, and how would you design one? <br />
  *  What is a register, and how would you design one?
+
*  Describe some cache write policies. <br />
<br />
+
*  What does the 'volatile' keyword in C mean?
  *  Describe some cache write policies.
 
<br />
 
  *  What does the 'volatile' keyword in C mean?
 
 
</ul>
 
</ul>
  

Latest revision as of 17:34, 12 April 2024

2022-06-02 Some resources to review for firmware technical interview questions:


^ Section 1 Firmware Questions

Starting pool of technical firmware oriented questions:

[ ] Q: What is the difference between a compiler and a cross-compiler?

    A:  A compiler produces executable code for the same processor family on which it runs, a cross-compiler produces executable code for a distinct processor family from the processor type on which it runs.


[ ] Q: What are some key benefits of incorporating an RTOS in a firmware project?

    A:  Memory and CPU resource management, task scheduling, guaranteed max latency as specified by the RTOS


[ ] Q: What are the four compilation stages a typical gcc like toolchain carries out?

    A:  pre-processing, compilation, assembly, linking


[ ] Q: What type of file typically are dot S files?

    A:  assembly source files


^ Section 2 Firmware Questions

[ ] Q: What uses and benefits of C enumerations can you describe?

    A: (1) C enumerations provide a helpful labeling mechanism for states, tasks, or cases which require conditional handling.
    (2) C enums are checked at compile time for duplicate integer values in the given enumeration.
    (3) C enums free programmers from having to adjust numeric values when adding and removing from the start or middle of the list, that is the enumeration.

[ ] Q: When may aggregate assignment be used in a C program, e.g. assigning all or some of the values to elements of an array?

    A: Aggregate assignments in C can happen at the point of array declaration, generally not later.

[ ] Q: What common benefit may be enjoyed from C enumerations and aggregate assignments?

    A: C enums and aggregate assignments both support automatic counting. "Automatic counting" is not a formal C term or language feature.
      In the case of enums, the last element of the enumeration can potentially provide a count of the number of elements in the enum. This assuming that the enum begins at 0 and has no gaps. In this use case the last enumeration element doesn't count itself. Trivial to add one if it's needed in the count.
      Aggregate assignments in C don't automatically count the number of elements assigned to a given array. The size of the array, however, the storage space that is, divided by the size of the type of data stored in each array element gives the count of elements. Hence aggregate assignments support automatic counting in that they don't require an array size to be predefined.


^ Section 3 C Code Questions

[ ] Given this code fragment:

    typedef uint32_t (*command_function_t)(const char* arguments); Q1: What type of data element does the following line of C code declare?
      A: This line of code declares a function pointer.

    Q2: What does each set of parentheses express, and bring to the overall declaration this line achieves?

      A: The first parentheses assure and clarify that the C pointer operator `*` applies to the declared newly defined type, the function pointer.
        The second parentheses express the C data type of "function", the data type to which the type-defined pointer points.

    Q3: What does the syntax look like to assign a function to a function pointer?

      A: Syntax looks like 'function_ptr = &function_name;'


[ ] Multi-part question:

    Q1: In an RTOS based project, what high level code pieces are typically present?
      A: (1) the RTOS or scheduler, (2) third party libraries and drivers, (3) application code

    Q2: Of these code modules, who's the boss? (Which code takes a controlling or leading role at run time?)

      A: ( RTOS in many ways, but open ended answer . . . )

    Q3: In a threaded firmware project, in the application part of the code who is the boss?

      A: One answer: there may not be a boss, but rather threads which work cooperatively toward a common task, with no one thread controlling a majority or any of the others.

[ ] Q: In a memory constrained system what is a compact way to store multiple Boolean type values?

    A: Two or more Boolean values may be bit-wise encoded into a C char type or C integer type variable.

[ ] Q: Where might C language's union construct play a role in a firmware project?

    A: A couple of examples: a C union could provide two ways for application code and driver code to "see" data packets sent via a certain protocol, or similarly two ways for different modules to treat bit-encoded configuration flags.


^ Section 4 - see RMB Consulting reference

[ ] What are a couple of uses of the C pre-processor directive #error?

    A: C's #error directive can be used to stop compilation at a point where code is in progress, but not complete enough to perform meaningful tasks. The #error directive may also be used to stop compilation and warn of undefined symbols which end users or developers must provide and set.


[ ] Using the variable name 'z', write out C declarations for the following variable types:

(1) a pointer to an integer

(2) an array of five integers

(3) an array of five pointers to integers

(4) a pointer to a pointer to an integer

(5) a pointer to a function which accepts an unsigned integer as its only parameter and returns nothing

    Answer:
    (1) int *z;
    (2) int z[5];
    (3) int *z[5];
    (4) int **z;
    (5) void (*z)(unsigned int y);


[ ] What are two or three examples in which you would use the C language volatile qualifier?

    Answer:
    (1) to qualify a variable that points to a status register which may change due to external-to-firmware causes
    (2) to qualify variables which are accessed by two or more threads, that is variables which exist in shared memory
    (3) to qualify variables which are not located on the or a stack and are referenced in an interrupt service routine


[ ] What does C's const qualifier mean?

    Answer short: C's const qualifier means "read only".


^ Hardware Questions

Some hardware questions from a Reddit post, found 2024-04-12 Friday:

    • What is the difference between a flip flop and a latch?
      A: latch is level triggered, flipflop is edge triggered
      • Describe some cache coherency problems with DMA.
      • What is a register, and how would you design one?
      • Describe some cache write policies.
      • What does the 'volatile' keyword in C mean?

    Reddit post URL is https://www.reddit.com/r/ECE/comments/qrm1s/hardware_interview_preparation_help/?rdt=54932.


    ^ References


    2022-06-06

    The #error pre-processor directive:

    Lvalues and rvalues:

    C unions: