Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
The four subjects of 408 do not talk about the most important data structure and algorithm, the other subjects such as OS process management and memory management, the TCP/IP model in the computer network, the representation of data in the computer group and so on, each of which is the content that a qualified programmer should focus on mastering.
So: although you may not go to graduate school, but follow the topic to deepen understanding of the always right
I will be updating 2 or 3 posts a day until I catch up (last time I was up to 10 posts a day). Please follow me and my column.
The exercises come from @Wangdao Weibo
The analysis is written by myself, if there are any questions or mistakes, please comment.
🌴 Data structure
If each node of the binary tree is numbered from 0 in hierarchical order, the minimum number of the middle node of the complete binary tree containing N nodes is ___ (University of Chinese Academy of Sciences 2012)
A. N / 2 B. [n + 1] C. N / 2 + 1 D. [n/2]-1Copy the code
Answer and analysis
Answer: A,
🔊 adopt the special value method, set n=3 to draw the tree structure, the smallest leaf node number is 1, exclude BCD, choose A.
🌾 Computer network
Which of the following devices does not need to forward data based on address _____ (Beijing University of Posts and Telecommunications 2011)
A. Repeater B. Router C. Bridge D. GatewayCopy the code
Answer and analysis
Answer: A,
🔊 repeater is a type of network device that reconstructs incoming electronic, wireless, or optical signals. With physical media such as Ethernet or Wi-Fi, data transmission can only span a limited range before the signal degrades.
[A] it connects the physical layer and amplifies or regenerates the attenuated signal.
🌿 Operating system
The process of converting a logical address into a physical address of memory is called ______ (University of Chinese Academy of Sciences 2012)
A. compile B. connect C. run D. relocateCopy the code
Answer and analysis
Answer: D
🔊 relocation is the process of converting the logical address space of a program into the actual physical address space in memory. It is the basis of realizing the simultaneous running of multiple programs in memory.
There are two types of relocation, namely dynamic relocation and static relocation:
- Dynamic relocation: this is not done when the program is loaded into memory, but the dynamic address shuffling mechanism (hardware) automatically converts relative addresses to absolute addresses each time the CPU accesses memory. Dynamic relocation requires software and hardware cooperation.
- Static relocation: completed in the process of loading the program into memory. It means that before the program starts to run, all the items related to the address in the program have been relocated. Address transformation is usually completed once during loading and will not change later, so it is called static relocation.
🍀 Computer composition principle
Among various I/O modes, the interrupt mode is characterized by _____ (University of Science and Technology Beijing, 2014
A. CPU works in serial with peripherals and transmission works in serial with main program B. CPU works in parallel with peripherals and transmission works in serial with main program C. CPU works in serial with peripherals and transmission works in parallel with main program d. CPU works in serial with peripherals and transmission works in parallel with main programCopy the code
Answer and analysis
Answer: B
🔊 In I/O device interruption mode, the procedure for data transmission between the CPU and I/O device is as follows:
- When a process needs data, an instruction is issued to start the I/O device to prepare the data.
- After a process issues instructions to start the device, the process abandons the processor and waits for the related I/O operation to complete. At this point, the process scheduler schedules other ready processes to use the processor.
- When the I/O operation is completed, the I/O device controller sends an interrupt signal to the processor through the interrupt request line. After receiving the interrupt signal, the processor turns to the pre-designed interrupt processing program to process the data transmission work accordingly.
- The process with the data goes to the ready state. At a later point, the process scheduler selects the process to continue working. The I/O device interrupt mode improves the utilization of the processor and supports the parallel operation of multiple programs and I/O devices.