# info2022-homework3 ###### tags: `interview` [NVIDIA General Questions Solutions](https://hackmd.io/@cantfindagoodname/HJbLKXBSs) [MTK General Question Solutions](https://hackmd.io/@cantfindagoodname/HyN-R304s) ## Job Descriptions > [(MTK) IP Development System Engineer](https://careers.mediatek.com/eREC/JobSearch/JobDetail/MTK120161108002?langKey=en-US) > Requirement > 1. Familiar with DDR or USB3.1, or HDMI, or MHL, or DisplayPort, or PCI Express system and validation. > 2. Has Embedded system device driver coding and porting experience is plus > 3. Ability to develop IP verification plan and SOP independently. > 4. Ability to co-work with different teams in IP verification. - Statisfy none of the requirments stated above > [(MTK) Device Driver Engineer](https://careers.mediatek.com/eREC/JobSearch/JobDetail/MTB120220309000?langKey=en-US) > Requirement > 1. Familiar with C programming language > 2. Embedded system development experience > 3. Driver development experience, such as USB, PCIe, Power Management... > 4. System integration experience, such as system bring-up, security, power, - Good grasp of C fundamental standards, not proficient enough in related tools (debugger, profiler, memory profiler, etc) - Little to none system development experience > [(MTK) Embedded System Software Development Engineer](https://careers.mediatek.com/eREC/JobSearch/JobDetail/MWH120210908000?langKey=en-US) > Requirements > 1. 计算机、电子、通信等相关专业,本科以上学历. > 2. 精通C/C++语言,至少熟悉一种操作系统,比如Android, Linux, OpenWRT,Windows. > 3. 熟悉802.11相关WIFI协议或有WIFI Driver相关开发和调试经验者优先,有Windows Driver开发经验优先,有路由器或者Linux/OpenWRT相关内部开发经验者优先. > 4. 英文CET4以上, 需要一定的科技英文阅读能力,能够查阅和学习英文文献和spec. > 5. 要求具有良好的沟通能力,团队合作精神,具有较强的工作责任心和敬业精神. - Familiar with Linux to some degree, far from calling myself an expert in any subject covered by Linux - No 802.11 WIFI Driver development experience > [(NVIDIA) Android System Software Engineer](https://nvidia.wd5.myworkdayjobs.com/en-US/NVIDIAExternalCareerSite/job/Taiwan-Taipei/Android-System-Software-Engineer_JR1961663?q=system) > **What we need to see** > - 4+ years of experience in software development on Android platforms > - Hands-on experience on Android bring up and booting > - Strong knowledge of C/C++ and Java > - Strong written and verbal communications in both English and Mandarin > - Ability to work well in a diverse team environment as well as with cross site peers > - Powerfully motivated to provide highly responsive support as needed > - Ability to work in a dynamic fast paced environment > > **Ways to stand out from the crowd** > - Hands on experience on Android system performance tuning > - Good understanding in kernel internals > - Rich experience on Android OS upgrade especially on build / booting / BSP relative work > - Large scale Android system feature development - Limited experience with Android - Good understanding in kernel internals - Few experience in doing project as a team > [(GOOGLE) Systems Engineer III, Site Reliability Engineering, Google Cloud](https://careers.google.com/jobs/results/141897442200036038-systems-engineer-iii-site-reliability-engineering-google-cloud/?distance=50&q=system) > **Minimum qualifications** > - Bachelor’s degree in Computer Science, a related field, or equivalent practical experience > - 2 years of experience with programming in one or more programming languages > - 2 years of experience working with administration (e.g. filesystems, inodes, system calls) and/or networking (e.g. TCP/IP, routing, network topologies and hardware, SDN). > **Preferred qualifications** > - Master's degree in Computer Science or Engineering > - 2 years of experience designing, analyzing, and troubleshooting large-scale distributed systems - Barely satisfy 2 years of experience in coding - Zero experience in networking (not even experience from lecture in school) - Little experience working with administration systems ## Self assessment BS Degree as highest academic degree Lack of notable projects Zero open source contribution Nowhere close enough to call myself proficient in Linux Lack of deep knowledge in any field of Computer Science ## Interview ( Questions ) 1. What is an interrupt 1. What is the difference between heap and stack memory 1. What is the difference of thread and process 1. What is futex 1. What is the difference of mutex and semaphore 1. Write a code that check the input is a multiple of 3 without using division or mod operator --- ## Careers / Interview Questions [NXP Semiconductors](https://nxp.wd3.myworkdayjobs.com/en-US/careers/job/Kaohsiung/XMLNAME-2023-Internship-Program-_R-10042968) > Question : [Source](https://www.glassdoor.co.in/Interview/NXP-Semiconductors-Interview-Questions-E13528.htm) Explain the main process and DFT Question unclear (main process) Explain DFT (Discrete Fourier Transform) --- [Nvidia](https://nvidia.wd5.myworkdayjobs.com/en-US/NVIDIAExternalCareerSite/job/Taiwan-Taipei/Embedded-Software-Engineer_JR1962146) > General Question : [Source](https://www.simplilearn.com/nvidia-interview-questions-article) 1. What is the difference between union and structure in C 2. What is an interrupt 3. What is the order of calling constructors and destructors in C++ (OOP) 4. Explain passing by pointer and passing by reference 5. What is composition and aggregation (OOP) 6. What is the difference between HTTP request methods GET and POST 7. Explain pre-order, post-order, and in-order binary tree traversal 8. What is the difference between heap and stack memory 9. What is RTTI in C++ (skip) 10. What operators cannot be overloaded in C++ 11. What are pure virtual functions? 12. What is Nvidia TXAA 13. What is data hiding 14. What is the difference between the `==` operator and `=` operator 15. What is the containership in C++ > System Design Question : [Source](https://www.simplilearn.com/nvidia-interview-questions-article) 1. Explain design process of a proximity server 2. How would you go about designing a chatbot for a website 3. Design a platform like Uber 4. What aspects of User Graphics are important for designing a mobile game application? 5. Design a platform like Twitter 6. What considerations will you take account while designing a shared file system in a cloud? > Embedded Software Engineer [Source](https://www.glassdoor.com/Interview/NVIDIA-Embedded-Software-Engineer-Interview-Questions-EI_IE7633.0,6_KO7,33.htm) 1. Parse a graph 2. Computer architecture, Linux, matrices, time / space complexity 3. Delete a node from an XOR-linked list 4. Will cache affect memory I/O register? 5. Assembly implementation of spinlock --- [MTK](https://careers.mediatek.com/eREC/JobSearch/JobDetail/MRTW20211118000?langKey=en-US) [MTK](https://careers.mediatek.com/eREC/JobSearch/JobDetail/MTK120210412018?langKey=en-US) > General Questions [Source](https://hackmd.io/@Rance/SkSJL_5gX?type=view) 1. Explain `#error` 2. Explain `struct` and `union` (duplicate w/ Nvidia general question -1-) 3. Explain `volatile`. Can we use `const` and `volatile` in the same variable? Can we use `volatile` in a pointer? 4. Value of v ```c unsigned long v1 = 0x00001111; unsigned long v2 = 0x00001202; unsigned long v; v = v1 & (~v2); v = v | v2; ``` 5. Value of `*(a+1), (*p-1)` ```c int a[5] = {1,2,3,4,5}; int *p = (int *)(&a+1) ``` 6. Write a code of: Set a specific bit Clear the specific bit Invert the specific bit 7. Re-write `void (*(*papf)[3])(char *)` ```c typedef /* Fill Code */; pf(*papf[3]); ``` 8. Write a code that check the input is a multiple of 3 without using division or mod operator 9. Explain lvalue and rvalue 10. Value of all element in `a` ```c int a[5]={1,2,3,4,5}; int *p=a; *(p++)+=123; *(++p)+=123; ``` 11. `n` is guaranteed to be one of the numbers, without using `if` and `switch case`, give the most efficient `main` implementation ```c extern void func1(void); extern void func2(void); extern void func3(void); extern void func4(void); extern void func5(void); void main(int n) { if n==1 execute func1; if n==2 execute func2; if n==3 execute func3; if n==4 execute func4; if n==5 execute func5; } ``` 12. `n` is guaranteed to be one of the numbers, using `if` ```c extern void func1(void); extern void func2(void); extern void func3(void); extern void func4(void); extern void func5(void); void main(int n) { if n==33 execute func1; if n==67 execute func2; if n==324 execute func3; if n==231 execute func4; if n==687 execute func5; } ``` 13. Write a function to get summation from `1` to `N` 14. Reverse a string 15. Write a "standard" macro of `MIN` 16. Write a function to determine if a number is power of 2 17. Write a macro to calculate square of integer `a` 18. Write a function to find the middle field of singly-linked list without traversing the whole list. 19. Write code to reverse the linked list 20. Find the possible errors ``` INT ival; INT **p; Ival = *p; ``` 21. What is the possible error for below function ``` int SQR(volatile int *a) { return (*a)*(*a); } ``` 22. Using preprocessor keyword `#define` to find seconds in a year (neglecting leap year) 23. Declare 1. An integer 2. A pointer to an integer 3. A pointer to pointer to an integer 4. An array of 10 integer 5. An array of 10 pointers to integer 6. A pointer to an array of 10 integers 7. A pointer to a function that takes an integer 8. An array of 10 pointers to functions that take an integer argument and return an integer 24. Implement swap using bitwise operation --- [Novatek](https://www.104.com.tw/job/7osgf?jobsource=cs_2018indexpoc) [Novatek](https://www.104.com.tw/job/2sawv?jobsource=cs_2018indexpoc) [Novatek](https://www.104.com.tw/job/32pr0?jobsource=cs_2018indexpoc) --- ## Misc Questions > Questions @[Linux Kernel Internals 2022](http://wiki.csie.ncku.edu.tw/linux/schedule) 1. What is the difference of thread and process 2. What is the difference of mutex and semaphore 3. `epoll` vs `poll` 4. Design of CMWQ 5. Sort a list, state design behind sorting a list Number of compares in `list_sort` Tricks to abuse cache in `list_sort` 6. Why use pointer of pointer in Linux `hlist` implementation 7. Why `list_for_each_safe` even with `list_for_each` 8. What would happen after waking up a phone from sleep (skip) 9. When would context switching occur 10. Mode switching vs context switching 11. Overflow checking before addition 12. Why `READ_ONCE` ,`WRITE_ONCE` and `ACCESS_ONCE` 13. What is futex 14. Why is memory alignment important 15. How to receive message (in server-client model) larger than buffer size Final Review > * 對 GNU Toolchain 的掌握度: 是否知曉 gcc 編譯和連結的流程?是否使用過 gdb 來追蹤程式? > * 使用 perf 工具: 是否已透過 perf 來分析程式執行時期的行為?知曉透過 perf 來分析 cache miss 及執行的指令數量? > * 計算機編碼: 為何現代的電腦架構採用 two's complement 呢?能否舉出 two's complement 和 bitwise 操作搭配的案例?Linux 核心原始程式碼中有哪些 bitwise 操作令你印象深刻? > * Linked list: 如何對 circular doubly-linked list 進行快速排序?如何評估 linked list 的 cache locality 呢?如何改善 linked list 的 locality 表現?(如 unrolled linked list) Linux 核心原始程式碼的 linked list 有何特別之處? > * C 語言: 是否翻閱過 C99/C11 規格書?現實中有不少案例是因開發者對於 C 語言規格的掌握不足,致使資訊安全議題,能否舉例說明?Alignment 對於程式正確性和效率的影響為何?在 Linux 核心可見到的 __attribute__((packed)) 作用為何?bit field 的作用和應用為何?指標的指標 (a pointer to a pointer) 的使用場景為何?函式呼叫對應的 ABI (application binary interface) 有何考量?能否舉例說明 Linux 核心的原始程式碼裡頭用到遞迴函式呼叫的案例?舉例說明 Linux 核心對於 preprocessor 的使用案例?能否舉例說明善用 goto 達到更簡潔且正確釋放資源的程式案例?C 語言為何存在 undefined behavior?undefined behavior 的存在對於編譯器最佳化的效益為何?C 編譯器和連結器的互動為何? > * 浮點數運算: 能否舉出因為不正確進行浮點數運算,釀造的軟體缺失案例?Linux 核心內部是否可使用浮點數運算?如果不能,替代方案為何? > * Process: Linux 核心程式碼的 task_struct 結構有哪些欄位令你印象深刻?Linux 核心中 process 和 thread 透過哪些系統呼叫建立?process 和 thread 對應到 task_struct 結構的關聯為何?fork 系統呼叫所建立的 child process,會在什麼時間點進行排程? > * Scheduler: Linux 核心的 O(1) scheduler 是指哪些操作的時間複雜度為 O(1) 呢?排程器和 scalability 的關聯為何?從單核到多核處理器,scheduler 有哪些考慮議題?從 O(1) 到 CFS,到底要解決什麼議題呢? > * Linux Kernel Module (LKM): 能否解釋 insmod 的運作流程?lsmod 輸出結果中的 "Used by" 代表什麼意思?lsmod 的 reference count 如何實作?你開發過哪些 LKM 呢?請說明令你印象最深刻的 LKM 開發經驗 > * Concurrency: Linux: 核心內部有哪些同步機制?semaphore 和 mutex 的差異為何?RCU 的使用時機為何? > * Thread: User-level threads 的實作考量有哪些?Linux 的 NPTL 屬於何種 threading model 呢?clone 系統呼叫能建立 process 和 thread 嗎?若是,兩者有何區隔?thread 和 SMP 之間有何關聯?thread 和 process 排程的考量點為何? > * 系統呼叫: 能否解釋 sendfile, splice, epoll 等系統呼叫對於高效 web 伺服器的作用?在 Linux 核心中,"Everything is a file descriptor." 如何解讀?epoll 的工作原理為何? > * 記憶體管理: Linux 核心中 kmalloc 和 slab 配置的記憶體有何特性?從 slab 到 slub 有何考量點?mmap 的運作原理為何?為何 packet_mmap 能達到 zero-copy 呢?