Difference between revisions of "Interview questions"
From Wiki at Neela Nurseries
m (adding to firmware interview questions pool.) |
|||
Line 18: | Line 18: | ||
[ ] Q: What uses and benefits of C enumerations can you describe? | [ ] Q: What uses and benefits of C enumerations can you describe? | ||
− | A: (1) enumerations provide a helpful labeling mechanism for states, tasks, or cases which require conditional handling. | + | A: (1) C enumerations provide a helpful labeling mechanism for states, tasks, or cases which require conditional handling. |
− | (2) enums are checked at compile time for duplicates in the given enum. | + | (2) C enums are checked at compile time for duplicates in the given enum. |
− | (3) | + | (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. |
Line 32: | Line 32: | ||
− | [ ] | + | [ ] 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. | ||
Revision as of 19:51, 2 June 2022
Some resources to review for firmware technical interview 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 type of file typically are dot S files?
A: assembly source files
[ ] Q: What are the four compilation stages a typical gcc like toolchain carries out?
A: pre-processing, compilation, assembly, linking
[ ] 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 duplicates in the given enum. (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: 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: 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.
[ ] 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.
References
- https://www.calleluks.com/the-four-stages-of-compiling-a-c-program/ . . . Four stages of C compilation