Pergunta de entrevista da empresa AMD

C Programming: - Extern keyword: Used to declare a global variable or function that can be accessed from other files. - Storage classes: auto, register, static, extern, and typedef. - Pointers: Variables that store memory addresses. - Structs and unions: Structs are used to store different data types in a single unit, while unions store different data types in the same memory location. - Memory leak: Occurs when dynamically allocated memory is not released, causing memory waste. - Debugging: Using print statements, debuggers like gdb, or built-in debugging tools in VS Code. Bit manipulation: - Set/reset a bit in a 32-bit integer: Using bitwise operators like OR, AND, and XOR. Operating Systems: - Process synchronization: Mechanisms like semaphores, monitors, and locks ensure that multiple processes access shared resources safely. - Semaphores: A variable that controls access to a shared resource. - Processes and threads: Processes are independent units of execution, while threads are lightweight processes that share the same memory space. - Critical section: A section of code that accesses shared resources and must be executed atomically. - OS functions: Process management, memory management, file system management, I/O management, and security. Object-Oriented Programming (OOP): - Polymorphism: The ability of an object to take on multiple forms, achieved through method overloading or method overriding. Data Structures and Algorithms: - Merging two sorted arrays: Using a two-pointer technique or a merge sort algorithm. - Finding a cycle in a linked list: Using Floyd's cycle-finding algorithm or a hash set. - Finding the middle node of a linked list: Using a slow and fast pointer technique. Linux and System Calls: - System calls: Interface between user space and kernel space, providing services like process creation, file management, and network communication. - Linux system calls: Examples include fork, exec, wait, open, read, write, and close. Kernel: - Kernel types: Monolithic, microkernel, and hybrid kernel. - Linux kernel: A monolithic kernel with some microkernel features. Programming question: - Stateful function: A function that maintains its state between calls without using external variables or extra parameters.