Firmware/Embedded面试复习

This training course schedule can be used a reference for interview review!

http://www.ac6-training.com/cours.php/cat_FSCA/ref_RT3/print_true.xphp

 

https://docs.google.com/document/pub?id=1a9WmPuE3F_WfnJAPHceVIoihJSK1t5_wtxM0QjSomwc

 

1. write C to generate segmentation fault and Stack overflow.

Ans: http://web.mit.edu/10.001/Web/Tips/tips_on_segmentation.html, http://embeddedgurus.com/stack-overflow/2007/06/understanding-stack-overflow/,  http://www.devx.com/tips/Tip/14276

2. give example to use function pointer

Ans: K&R-qsort; or in <a modern approach>: function pointer mostly used as an argument for a method, or it can be an element in a struct, say in uCos to realize OOP in C.

or, In concurrency in OS three easy pieces: http://pages.cs.wisc.edu/~remzi/OSTEP/threads-api.pdf

3. which to use in simple embedded systems: arrays or dynamic memory using malloc and why?

Ans: http://thesynchronousblog.wordpress.com/2013/05/20/dynamic-memory-management-in-embedded-systems  , http://en.wikibooks.org/wiki/C_Programming/Memory_management, http://stackoverflow.com/questions/1725923/how-bad-is-it-to-use-dynamic-datastuctures-on-an-embedded-system 

4. when to use volatile

Ans: http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword, or CMPE 244 preet notes

5. How to use Static/Exten, where do they locate, what's problem of a static large array?

Ans: CMPE 244 note, http://stackoverflow.com/questions/13415321/difference-between-static-auto-global-and-local-variable-in-the-context-of-c-a

6. What is different of preemptive and cooperative RTOS?

Ans: http://electronics.stackexchange.com/questions/78439/what-are-the-benefits-of-a-non-preemptive-os-and-the-price-for-these-benefits

7. Why not use RTOS?

Ans: http://www.barrgroup.com/Embedded-Systems/How-To/Preemption-Perils, Get by without RTOS

As mentioned in the 2nd paper, it mentioned: for Time-critical aspect, RTOS is negatively affect due to ISR latency, context switch...

8. Compare macro and function.  

Ans: http://stackoverflow.com/questions/9104568/macro-vs-function-in-c

9. When to use inline function?

Ans: http://www.gotw.ca/gotw/033.htm, http://stackoverflow.com/questions/132738/why-should-i-ever-use-inline-code

10.  difference between malloc and calloc

Ans: http://stackoverflow.com/questions/1538420/difference-between-malloc-and-calloc

11. difference between malloc and new

Ans: http://stackoverflow.com/questions/184537/in-what-cases-do-i-use-malloc-vs-new, http://www.geeksforgeeks.org/malloc-vs-new/

12. How do you pass variable number of arguments in “C” and why this is a generally bad idea?

Ans: http://www.cprogramming.com/tutorial/lesson17.html

13. Diff between struct and union

Ans: http://stackoverflow.com/questions/346536/difference-between-a-structure-and-a-union-in-c

14. Diff between func(void) and func()

Ans: http://stackoverflow.com/questions/1163879/in-c-funcvoid-vs-func

15. Memory errors: memory leak, OutofMemory, ...

Ans: http://www.cprogramming.com/tutorial/memory_debugging_parallel_inspector.html

16. try/catch in C++

Ans: http://www.cplusplus.com/doc/tutorial/exceptions/

17. Data structures, focus on linked lists, dynamic arrays, trees and graphs. 

Ans: CC150. Hawstein.

18. Remove spaces in a string in C

Ans: http://stackoverflow.com/questions/13084236/function-to-remove-spaces-from-string-char-array-in-c

19. Why cannot use malloc in RTOS?   malloc = BAD! (ARM M3 or MSP430 or 18F4550 have NO MMU, so don't support Virtual Memory)

Ans: http://www.rockbox.org/wiki/WhyNoMalloc, http://www.freertos.org/a00111.html, http://www.embedded.com/design/programming-languages-and-tools/4416457/EMB-tm-6-15-13-Dynamic-memory-and-heap-contiguity

20. Write a C program to find big or little endian:

Ans: http://www.geeksforgeeks.org/little-and-big-endian-mystery/

21. When to use virtual deconstructor?

Ans: when use polymorphism, such as factory DP: http://www.programmerinterview.com/index.php/c-cplusplus/virtual-destructors/

 

============//////////////////////////////======================////////////////////////////=====

From Qualcomm interview:

1. How to find the size of one var type without using sizeof()?

Ans: use offsetof() which: size_t size = (size_t)(1 + ((X*)0));

2. Design Circular buffer without STL.

http://www.embedded.com/electronics-blogs/embedded-round-table/4419407/3/The-ring-buffer, http://kamyarns.wordpress.com/2013/05/02/implement-circular-queue-in-cpp/

3. Write C code for convolution. In Baidu, use cuda.

 

4. what is priority inversion and how it is solved?

http://www.drdobbs.com/jvm/what-is-priority-inversion-and-how-do-yo/230600008, or http://www.embedded.com/electronics-blogs/beginner-s-corner/4023947/Introduction-to-Priority-Inversion

5. phone interview operating systems- priority inversion, ISR & interrupt vector table, order of complexity of sorting algorithms

 

6. "Difference between const char * and char const *"

http://www.glassdoor.com/Interview/Difference-between-const-char-and-char-const-QTN_233063.htm

posted @ 2014-06-27 09:42  fxrcode  阅读(513)  评论(0编辑  收藏  举报