所屬科目:研究所、轉學考(插大)、學士後-計算機概論
1. Which of the following is true for binary search algorithm? (A) Can be used on unsorted data (B) Time complexity is O(n) (C) Data must be sorted (D) Always returns the first occurrence (E) Requires linear time
2. Which logic gate has the following truth table: output is 1 only if inputs are different? (A) AND (B) OR (C) NAND (D) XOR (E) XNOR
3.In an operating-system context, the banker's algorithm is used to: (A) Detect deadlock (B) Prevent starvation (C) Avoid deadlock by resource allocation (D) Select victim pages for replacement (E) Schedule disk I/O requests
4.The IP, TCP, and UDP headers all carry a 16-bit field named "checksum." Which ISO/OSI layer primarily uses that field? (A) Transport (B) Data-link (C) Network (D) Physical (E) None of the above
5. In IPv4, a /26 CIDR network supports how many usable host addresses? (A) 30 (B) 62 (C) 64 (D) 32 (E) 26
6. IPv6 eliminates the need for which IPv4 feature? (A) DHCP (B) ARP (C) DNS (D) ICMP (E) NAT
7. Message Authentication Codes (MACs) provide: (A) Integrity and authenticity (B) Non-repudiation and confidentiality (C) Confidentiality only (D) Key exchange (E) Forward secrecy
8.A max-heap stored in an array of length n guarantees that the parent of the node at index i is at: (A) floor(i/2) (B) floor((i -1)/2) (C) ceil(i/2) (D) i-1 (E) floor(i/3)
9.In 8-bit two's-complement arithmetic, adding 0x73 + 0x94 raises the overflow flag because: (A) Signs differ but result is negative (B) Both operands are positive but result is negative (C) Carry-in to MSB = carry-out from MSB (D) Parity bit = 0 (E) Half-carry occurred
10. A 64-MiB main memory is byte-addressable. A 4-way set-associative cache of 32 KiB uses 64-byte lines. Number of tag bits in a 32-bit address is: (A) 19 (B) 16 (C) 13 (D) 20 (E) 21
11. In standard C, whether char is signed or unsigned by default is: (A) Always signed (B) Always unsigned (C) Controlled by pragma (D) Undefined behaviour (E) Implementation-defined
12. You are designing an ALU that must support the rotate-through-carry left (RCL) operation on 32-bit registers. If the current CF = 1 and the operand is 0x80000000, what are the new value of the register and the new carry flag? (A) 0x00000000, CF=0 (B) 0x00000000, CF=1 (C) 0x00000001, CF=0 (D) 0x00000001, CF=1 (E) 0x00000003, CF=1
13. You benchmark QuickSort and Measure that its running time on random permutations doubles when n grows from 2M to 4M. Which average-case complexity class is most consistent with this observation? (A) O(n) (B) O(n log log n) (C) O(n log n) (D) O(n) (E) O(n²)
14. A university has the prefix 2001:0db8:acad::/48 and wants 400 subnets. What is the smallest subnet mask that meets the need and keeps addresses aligned on nibble boundaries? (A)/52 (B) /56 (C) /48 (D)/60 (E) /64
15. A 900 MHz microcontroller must process each PWM cycle in ≤ 90 instruction cycles. An ISR currently compiles to 112 cycles. Which optimisation meets timing with least code change? (A) Unroll loops (B) Inline all function calls (C) Move ISR to lower priority (D) Switch to Thumb-2 (E) None of the above
16. A function returns std::vector<T> foo();. At call-site you write:
Why might the extra std::move() be worse than writing v = foo();? (A) Disables copy elision (B) Prevents RVO (C) Converts to Ivalue reference (D) Increases alignment padding (E) None of the above
17. A company's e-commerce database has a "products" table with 10 million rows. A query "SELECT * FROM products WHERE price BETWEEN 100 AND 200" takes 45 seconds. What optimization would provide the most significant performance improvement? (A) Add more RAM to the database server (B) Increase the number of CPU cores (C) Partition the table by product category (D) Use a faster SSD storage (E) Create an index on the price column
18.A processor has a 32KB L1 cache with 64-byte lines. A program accesses a 2D array of 1024×1024 integers (4 bytes each) in column-major order. Assuming the cache is initially empty, approximately how many cache misses occur in the first complete column access? (A) 1024 (B) 4096 (C) 16384 (D) 65536 (E) 1048576
19. A company implements AES-256 encryption for sensitive data. Each encryption operation takes 0.1ms. If they need to encrypt 100GB of data in 1-hour batches, what is the minimum number of encryption threads needed to meet the deadline? (A) 100 (B) 200 (C) 400 (D) 1000 (E) 2778
20. A real-time system has 3 periodic tasks: T1 (period=50ms, execution=10ms), T2 (period=100ms, execution=20ms), T3 (period=200ms, execution=40ms). Using Rate Monotonic Scheduling, what is the CPU utilization? (A) 60% (B) 70% (C) 80% (D) 90% (E) 100%
21. What is the output of the following C++ code?
(A) Constructor Copy Constructor Destructor Destructor Destructor (B) Constructor Constructor Copy Destructor Destructor Destructor (C) Constructor Copy Copy Destructor Destructor (D) Constructor Copy Copy Destructor Destructor Destructor (E) Constructor Constructor Constructor Destructor Destructor Destructor
22. What is the output of the following code?
(A) int: 5 double: 5 two ints: 5,15 (B) int: 5 double: 5.0 two ints: 5,15 (C) two ints: 5,10 double: 5.0 two ints: 5,15 (D) Run time error due incompatible type (E) Compilation error due to ambiguous function call
23. What is the output of the following code?
(A) const ref: 5 const ref: 105 (B) ref: 5 ref: 10 100 (C) ref: 5 const ref: 10 100 (D) const ref: 5 ref: 10 5 (E) Compilation error
24. What is the output of the following code?
(A) 0 (B) 2 (C) 3 (D) 4 (E) 6
25. What is the output of the following code?
(A) 23 (B) 69 (C) 66 (D) 12 10 (E) 12 12