go:interview:live_coding_test
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| go:interview:live_coding_test [2026/01/31 01:20] – phong2018 | go:interview:live_coding_test [2026/01/31 01:22] (current) – phong2018 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Golang Live Coding Exam (Junior → Middle) ====== | ||
| + | |||
| + | This exam evaluates fundamental Go skills, basic concurrency, | ||
| + | |||
| + | Time suggestion: 45–60 minutes | ||
| + | |||
| + | ===== Test 1: Sum of Integers ===== | ||
| + | |||
| + | ==== Question ==== | ||
| + | Write a function that receives a list of integers and returns their sum. | ||
| + | |||
| + | ==== Input ==== | ||
| + | < | ||
| + | [1, 2, 3, 4, 5] | ||
| + | </ | ||
| + | |||
| + | ==== Output ==== | ||
| + | < | ||
| + | 15 | ||
| + | </ | ||
| + | |||
| + | ==== Constraints ==== | ||
| + | |||
| + | Do not use external libraries | ||
| + | |||
| + | Must handle empty slices | ||
| + | |||
| + | ==== Evaluation Criteria ==== | ||
| + | |||
| + | Correct result | ||
| + | |||
| + | Clean and readable code | ||
| + | |||
| + | Proper function signature | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | Slice /slaɪs/: dynamic array in Go | ||
| + | |||
| + | ===== Test 2: Word Frequency Counter ===== | ||
| + | |||
| + | ==== Question ==== | ||
| + | Given a string, count how many times each word appears. | ||
| + | |||
| + | Words are separated by spaces. | ||
| + | |||
| + | ==== Input ==== | ||
| + | < | ||
| + | "go is fun and go is fast" | ||
| + | </ | ||
| + | |||
| + | ==== Output ==== | ||
| + | < | ||
| + | go: 2 | ||
| + | is: 2 | ||
| + | fun: 1 | ||
| + | and: 1 | ||
| + | fast: 1 | ||
| + | </ | ||
| + | |||
| + | ==== Constraints ==== | ||
| + | |||
| + | Case-sensitive | ||
| + | |||
| + | Use built-in data structures only | ||
| + | |||
| + | ==== Evaluation Criteria ==== | ||
| + | |||
| + | Correct map usage | ||
| + | |||
| + | Proper string manipulation | ||
| + | |||
| + | Clean iteration logic | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | Map /mæp/: key-value data structure | ||
| + | |||
| + | Iteration / | ||
| + | |||
| + | ===== Test 3: Filter Even Numbers ===== | ||
| + | |||
| + | ==== Question ==== | ||
| + | Write a function that returns only even numbers from a list. | ||
| + | |||
| + | ==== Input ==== | ||
| + | < | ||
| + | [1, 2, 3, 4, 5, 6] | ||
| + | </ | ||
| + | |||
| + | ==== Output ==== | ||
| + | < | ||
| + | [2, 4, 6] | ||
| + | </ | ||
| + | |||
| + | ==== Constraints ==== | ||
| + | |||
| + | Maintain input order | ||
| + | |||
| + | No global variables | ||
| + | |||
| + | ==== Evaluation Criteria ==== | ||
| + | |||
| + | Correct condition logic | ||
| + | |||
| + | Proper slice handling | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | Even number /ˈiːvən ˈnʌmbər/: | ||
| + | |||
| + | ===== Test 4: Goroutine with Channel ===== | ||
| + | |||
| + | ==== Question ==== | ||
| + | Create a goroutine that sends numbers from 1 to 3 into a channel. | ||
| + | The main function must receive and print them. | ||
| + | |||
| + | ==== Input ==== | ||
| + | < | ||
| + | 1, 2, 3 | ||
| + | </ | ||
| + | |||
| + | ==== Output ==== | ||
| + | < | ||
| + | 1 | ||
| + | 2 | ||
| + | 3 | ||
| + | </ | ||
| + | |||
| + | ==== Constraints ==== | ||
| + | |||
| + | Must use one goroutine | ||
| + | |||
| + | Channel must be closed properly | ||
| + | |||
| + | ==== Evaluation Criteria ==== | ||
| + | |||
| + | Correct goroutine usage | ||
| + | |||
| + | Proper channel closing | ||
| + | |||
| + | No deadlocks | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | Goroutine / | ||
| + | |||
| + | Deadlock / | ||
| + | |||
| + | ===== Test 5: Simple HTTP Handler ===== | ||
| + | |||
| + | ==== Question ==== | ||
| + | Create an HTTP server that: | ||
| + | |||
| + | Listens on port 8080 | ||
| + | |||
| + | Responds "Hello Go" to /hello | ||
| + | |||
| + | ==== Input ==== | ||
| + | < | ||
| + | GET /hello | ||
| + | </ | ||
| + | |||
| + | ==== Output ==== | ||
| + | < | ||
| + | Hello Go | ||
| + | </ | ||
| + | |||
| + | ==== Constraints ==== | ||
| + | |||
| + | Use net/http | ||
| + | |||
| + | No third-party libraries | ||
| + | |||
| + | ==== Evaluation Criteria ==== | ||
| + | |||
| + | Correct handler implementation | ||
| + | |||
| + | Proper server startup | ||
| + | |||
| + | Clean code structure | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | HTTP handler /ˌeɪtʃ tiː tiː piː ˈhændlər/: | ||
| + | |||
| ====== Senior Golang Live Coding Exam ====== | ====== Senior Golang Live Coding Exam ====== | ||
go/interview/live_coding_test.1769822450.txt.gz · Last modified: by phong2018
