# 2022 c++面試紀錄 ## BIGO - SG 職位: 網頁的業務邏輯??? 面試官都是大陸人,中文面試 ### 一面 - 刪除`std::map`的iterator會怎樣 - 為什麼comparator在相等時要`return false`? - 使用gdb的經驗 - 有遇過dead lock嗎?怎麼解決? - 問以下程式碼的行為 (提示: 與`this`指標有關) ```cpp class Dummy{ public: void print(){ std::cout << "Hello!" << std::endl; } }; int main(){ Dummy* a = nullptr; a->print(); return 0; } ``` - [2. Add Two Numbers](https://leetcode.com/problems/add-two-numbers/) 但是輸入是`std::string` ### 二面 - tcp基本概念 - call by value vs call by reference - 基本SQL - 基本web server知識 - OS memory layout - virtual memory vs physical memory - [905. Sort Array By Parity](https://leetcode.com/problems/sort-array-by-parity/) 但是奇數偶數都必須維持原有順序 ### 結果 從二面看起來要找比較偏web後端的人,我對sql和web不熟,拒絕 ## Squarepoint - SG 職位: general software engineer 這間公司coding部份都必須要可以編譯+運行,但可以跟面試官問語法 ### 一面 (30 min) - c++ 98 vs modern c++ - `shared_ptr`的使用時機與原理? - 問以下程式的行為 (`shared_ptr`的`deleter`如何運作) ```cpp int main() { { shared_ptr<void> p = shared_ptr(new A); } } ``` - 寫出一個支援兩個thread寫入,四個thread讀取的程式(針對一個變數) - 延續上題討論,為什麼用`std::atomic`以及`std::atomic`的原理 - 假如有16個thread同時要寫入會怎樣? - CPU cache line的運作方式? ### 二面 (90 min) - 討論履歷約30min - 用template實現`std::tuple` iteration (template meta programming) - 有寫過socket相關的程式嗎? - 有用過perf嗎? - 如何保證一個file handle(在linux系統是一個`int*`)會被正確的釋放,用RAII的形式 - 問程式碼的行為 - double free - unsinged int overflow - padding ### 三面 (90 min) - 討論履歷約30min - 如何refactor (聊天) - 如何release project (聊天) - modern c++有哪些新功能 - `unique_ptr` vs `shared_ptr` - 寫一個可以限制log輸出次數的`class` - 如果改成多執行序,需要做什麼改動 - 為什麼用`std::mutex`,跟spin lock的差別在哪 - 在另一種使用情況下要做什麼改動 - `std::deque`的內部實現原理 ### 四面 (60 min) - 討論履歷與公司歷史約30min - 針對履歷問問題 ### 結果 拒絕 ## Google - TW 職位: Software Enginee, Display, Pixel ### Phone [772. Basic Calculator III](https://leetcode.com/problems/basic-calculator-iii/) ### 結果 拒絕
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up