A beaver navigates a binary decision tree where 0 means Left and 1 means Right. If the 3-bit code 100 maps to leaf number $\text{(binary value)} + 1$, which leaf number does it reach?
Xem đáp án và lời giải
Đáp án: $5$
Chuỗi nhị phân 100 có giá trị thập phân là $4$, cộng thêm $1$ được lá số $5$.
Question 2
Dễ · +10 điểm
A robot processes input $7$ by first adding $9$ and then multiplying by $3$. What is the output?
Xem đáp án và lời giải
Đáp án: $48$
Thực hiện tuần tự: $(7 + 9) \times 3 = 48$.
Question 3
Dễ · +10 điểm
In tunnel #4, logs labeled A, B, C, D are pushed one by one into a narrow dead-end tunnel (LIFO stack), then pulled out one by one. In what order do they come out?
Xem đáp án và lời giải
Đáp án: $D-C-B-A$
Cấu trúc ngăn xếp LIFO (vào sau ra trước) đảo ngược thứ tự thành D-C-B-A.
Question 4
Dễ · +10 điểm
An image row is compressed with Run-Length Encoding as 2W 4B 4W (meaning 2 White, 4 Black, 4 White). How many pixels are in this row?
Xem đáp án và lời giải
Đáp án: $10$
Tổng số ô ảnh bằng $2 + 4 + 4 = 10$.
Question 5
Dễ · +10 điểm
A beaver robot starts at $(0, 0)$ and must reach $(3, 3)$ moving $1$ unit North, South, East, or West per step. What is the minimum number of steps?
Xem đáp án và lời giải
Đáp án: $6$
Khoảng cách Manhattan tối thiểu là $3 + 3 = 6$ bước.
Question 6
Trung bình · +20 điểm
In network #4, a data packet travels from S to T along the weighted links shown (weights $6, 7, 4, 8$). What is the minimum total delay?
Xem đáp án và lời giải
Đáp án: $10$
So sánh $S \to P \to T$ ($10$) và $S \to Q \to T$ ($15$), nhỏ nhất là $10$.
Question 7
Trung bình · +20 điểm
In packet #4, to transmit 111111 with EVEN parity (so the total number of 1s including the parity bit is even), what must the parity bit be?
Xem đáp án và lời giải
Đáp án: $0$
Chuỗi có $6$ bit 1, nên bit chẵn lẻ cần thêm là $0$ để tổng số bit 1 là chẵn.
Question 8
Trung bình · +20 điểm
In sorting task #4, a list of $4$ distinct numbers is in completely reverse order. What is the minimum number of adjacent swaps needed to sort it into increasing order?
Xem đáp án và lời giải
Đáp án: $6$
Số cặp nghịch thế tối đa của dãy $4$ phần tử là $\dfrac{4(3)}{2} = 6$.
Question 9
Trung bình · +20 điểm
In search task #4, using binary search on a sorted list of $32$ names, what is the maximum number of comparisons needed to be sure whether a name is in the list?
Xem đáp án và lời giải
Đáp án: $6$
Mỗi lần kiểm tra chia đôi danh sách, cần tối đa $\lfloor \log_2 32 \rfloor + 1 = 6$ lần.
Question 10
Trung bình · +20 điểm
On display #4, how many LED segments light up to display the digit 2 on a standard 7-segment display?
Xem đáp án và lời giải
Đáp án: $5$
Chữ số 2 cần đúng $5$ thanh LED sáng.
Question 11
Khó · +30 điểm
In a database, $11$ files have only Tag A, $11$ have only Tag B, and $8$ have both. How many files match the search query Tag A OR Tag B?
Xem đáp án và lời giải
Đáp án: $30$
Phép OR lấy hợp của hai tập: $11 + 8 + 11 = 30$.
Question 12
Khó · +30 điểm
In schedule #4, four independent jobs take 4, 5, 6, 3 minutes. With $2$ identical workers working in parallel (each job runs on $1$ worker without interruption), what is the minimum total time to finish all $4$ jobs?
Xem đáp án và lời giải
Đáp án: $9$
Chia tối ưu thành 2 nhóm có thời gian gần nhau nhất, thời gian hoàn thành ngắn nhất là $9$ phút.
Question 13
Khó · +30 điểm
Cipher #4 shifts every letter forward by $3$ positions in the alphabet (A→D, B→E, ...). How is DOG encrypted?
Xem đáp án và lời giải
Đáp án: GRJ
Dịch mỗi chữ cái tiến $3$ bước thu được GRJ.
Question 14
Dễ · +10 điểm
A hash table has $6$ buckets numbered $0$ to $5$. Key $k$ is placed in bucket $k \bmod 6$. Which bucket stores key $51$?
Xem đáp án và lời giải
Đáp án: $3$
Lấy $51$ chia cho $6$ được số dư là $3$.
Question 15
Khó · +30 điểm
A robot starts facing North and executes Turn Right 90° exactly $19$ times. Which direction is it facing at the end?
Xem đáp án và lời giải
Đáp án: West
Sau mỗi $4$ lần quay $90^\circ$ robot lại hướng North. Vì $19 : 4$ dư $3$, robot hướng West.