What is the difference between logical right shift and arithmetic right shift?

What is the difference between logical right shift and arithmetic right shift?


Logical shift right is to shift one bit to the right and zero to the left
Arithmetic shift to the right needs to consider the sign bit, shift one bit to the right, if the sign bit is 1, fill 1 on the left; otherwise, fill 0
So arithmetic shift right can also carry out signed bit division, shift right, n bit is equal to the nth power of division 2
For example, 8-bit binary numbers 11001101 are shifted one bit to the right
Logical right shift is [0] 1100110
The arithmetic shift to the right is [1] 1100110



What is the difference between > > (logical right shift) and > > (arithmetic right shift) in displacement operation in Java?


Logical right shift is to move each bit to the right in turn, and then fill 0 on the left,
Arithmetic shift right is to move each digit to the right in turn, and then make up with the original sign bit on the left



Shift left and shift right operations
Shift right is equivalent to division, shift left is equivalent to multiplication, shift left one bit multiplied by 2, shift left two bits multiplied by 4, and so on. No matter positive or negative numbers, their shift right, shift left, and shift right without sign 32 bits are themselves, such as - 532 = - 5, - 5 > > 32 = - 5
For example: - 5 > > 3 = - 1
-53=0
5>3=536870911
Here - 5 > > 3 is equivalent to - 5 / 8 = - 0.625, and then about - 1?
5> 3 is equivalent to 5 / 8 = 0.625, and then approximately equal to 0? That is to say, the negative decimal and positive decimal obtained by division are close to 0?
In addition, how did you get - 5 > > > 3 = 536870911? Thank you!


>>When you move to the right, it is decided by the computer system whether to use 1 or 0 to fill in the empty high position. However, from the question you gave, it is decided by the high position of the number to be moved. If the high position is 1, use 1 to fill in, and if the high position is 0, use 0 to fill in,
-5 is expressed in hexadecimal, that is, 0xfffffb, shift 3 bits to the right, and the 3 bits left empty by the high bit are supplemented by 1, that is, 0xFFFFFF, that is - 1
5 is expressed in hexadecimal, that is, 0x00000005, 3 bits are shifted to the right, and the 3 out of the high bit space is supplemented by 0, that is, 0x00000000, that is, 0
>>>Is an unsigned shift right operator, that is, the empty bits are filled with 0
-5> The hexadecimal number is 0x1ffffff, that is 536870911



Balance shift left and right
Does the balance shift to the right move in the direction of positive reaction or reverse reaction?


Move to positive reaction



Principle of Computer Organization
X = + 100, y = - 60, calculate x + y, X-Y respectively, and explain the content of CF AF PF of,


1: Convert to binary
X=01100100,Y=11000100
2: X + y = 00101000, where CF = 1, AF = 0, PF = 1, of = 0
3: [- y] complement = 00111100
X-Y = x + [- y] complement = 10100000, where CF = 0, AF = 1, PF = 1, of = 1



How to solve the problem of computer composition principle
A computer has address changing, indirect addressing and relative addressing. Set the address code part of the current instruction as 001ah, the address of the instruction being executed as 1f05h, and the content of the address changing register as 23a0h. The partial address and corresponding content of the known memory are shown in the figure. Please fill in:
(1) When the fetch instruction is executed, if it is in the index addressing mode, the fetched number is (1700h)
(2) If it is in indirect addressing mode, the number taken out is (2600h)
(3) When the transfer instruction is executed, the transfer address (1f21h)
Address content
001AH 23A0H
1F05H 2400H
1F1FH 2500H
23A0H 2600H
23BAH 1700H


23a0 + 001a = 23bah, the corresponding content is 1700h
In indirect addressing mode, the operation code part of the instruction gives the address of the effective address of the operands, that is, the content of 001ah is the effective address of the operands, and the content of 001a is 23a0h. The content of 23a0h is the operands, that is, 2600h
The current instruction address is 1f05h, that is, the value of PC. according to the answer, after taking out the current instruction, the value of PC will be increased by 2. It becomes 1f07h, plus 001a, It is 1f21h. This is the transfer address. But I feel that the title is incomplete. How to change the value of PC should be specified. This is the instruction to take out 1 byte, PC + 1



The following statements about elements are correct ()
A. Metal elements and nonmetal elements can form covalent compounds B. only in atoms, the number of protons is equal to the number of electrons outside the nucleus C. in the current periodic table of elements, the longest period contains 36 elements D. in the covalent compounds formed by nonmetal elements, the number of electrons in the outermost layer of atoms can only be 2 or 8


A. Metal elements and non-metal elements can form covalent compounds, such as AlCl3, so a is correct; B. in molecules, the number of protons is equal to the number of electrons outside the nucleus, so B is wrong; C. in the current periodic table of elements, the longest period contains 32 elements, so C is wrong; D. in the covalent compounds formed by non-metal elements, the number of electrons in the outermost layer of atoms is different from 2 or 8 It has a value, so D is wrong



As for wave speed, wavelength and frequency, the correct one in the following statement is ()
A. When different wave sources propagate in the same medium, the wavelength does not change
B. When different wave sources propagate in the same medium, the wave velocity does not change
C. When the same wave source propagates in different media, the wavelength does not change
D. When the same wave source propagates in different media, its frequency does not change


For example, bass and soprano have the same speed in the air, but different frequencies and different visible wavelengths
B correct. For example, the speed of sound in the air is the same, about 340m / s
C error, the same wave source in different media propagation speed is different, and the same frequency, visible wavelength is different
D is correct and the frequency is determined by the wave source



Sound can transmit information. In daily life, people often identify the quality of objects according to the sound of knocking objects. The following behaviors are used to achieve this goal ()
A. The blacksmith beat the red rough with a small hammer. B. the farmer beat the watermelon with his hand. C. the customer beat the porcelain with his hand. D. the bricklayer beat the red brick with a tile knife


A. The blacksmith uses a small hammer to knock the red rough to make it into shape, so it is not in line with the title; B. the grower uses his hand to tap the watermelon to judge whether the watermelon is ripe by distinguishing the tone and timbre of the watermelon vibration, so B is in line with the title; C. the customer uses his hand to tap the porcelain to distinguish the quality of the porcelain, so it is in line with the title The purpose of the Bricklayer's striking the red brick with a tile knife is to open the brick without making use of the sound



Final physics quality test questions of Grade 8 (I)
1. In the story of "carving a boat for a sword", Chu Ru didn't make clear the relativity between movement and stillness, which made later generations laugh. In fact, the movement of the sword falling into the bottom of the river was different from that of the boat and the river bank
A. Motion and stillness B. motion and stillness C. stillness D. stillness
2. Xiaohua designed the following experimental schemes to explore the generation of sound. Do you think the experiment that can explain the problem is a. use the mobile phone to dial another mobile phone placed in the vacuum hood, and the other mobile phone displays the mobile phone number, but can't hear the call
B. Put the tuning fork that is making sound into the water, and water splashes all over the water
C. After the trumpet blows, when the fingers press different keys, it can make different sounds
D. Tap one end of the steel pipe full of water, and you can hear three taps at the other end of the steel pipe
3. at the new year's Eve, Xiao Wang adjusted the tightness of Erhu chord before the performance. When he came out, he used different force to move the string.
A. The former is to tone the timbre of the sound, while the latter is to make different loudness
B. The former is to adjust the loudness of the sound, while the latter is to make different tones
C. The former is to adjust the tone of the sound, while the latter is to produce different loudness
D. The former is to adjust the timbre of the sound, while the latter is to make different tones
4. Which of the following phenomena has the same optical principle
A. Sunlight is decomposed into various monochromatic light after passing through a prism
B. Dentists use a small flat mirror to observe the patient's diseased teeth
C. The bottom of the pool looks shallower than it is
D. During the day, there are many round spots under the dense shade
5. The pond is 2.5m deep, and there is a kite 50m above the water
A. Kite in water belongs to the phenomenon of light reflection. B. kite in water belongs to the phenomenon of light refraction
C. The distance between the virtual image of the kite under the water surface and the water surface is 52.5md. When the kite gradually flies high in the air, its image under the water surface will become smaller
6. Noise control can start from three aspects. The following statement about measures to control noise is correct
A. The muffler of motorcycle is to prevent noise from entering the ears. B. the sound insulation board beside the city road is to prevent noise
C. Planting trees beside the road is to block the transmission of noise. D. the noise proof earmuffs used in factories are to prevent the generation of noise
Of
7. Xiaoyong holds a lens in his hand and places it 10cm above the ruler. If the observation result is as shown in the figure, the lens is
A. the focal length is more than 10cm
B. convex lens with focal length less than 10 cm
C. concave lens with focal length greater than 10 cm
D. concave lens with focal length less than 10 cm
8. What's true about force
A. when object a applies force to object B, object a must also be affected by the force
B. Xiao Wang didn't push the box on the ground because the relay was less than the friction on the box
C. when a grain is under the action of force, its movement state will change
D. two forces in balance, the three elements of the two forces may be the same
9. Among the following methods, the one to reduce friction is
A. Some cement pavement is made into small grooves
B. When the bicycle brakes, the brake shoe is tightly pressed on the steel ring
C. Hovercraft uses gas to separate the ship from the water
D. People threw sand on the icy road
10. As shown in the figure on the right, place the wooden block on the horizontal table with the same roughness
On the other hand, Xiaohua pulls the block horizontally and uniformly in a straight line
A. The pressure on the table is greater than the gravity on the block
B. The sliding friction force on the block remains unchanged
C. The pull of the rope on the block is greater than the friction of the table top on the block
D. The pull of the rope to the block and the pull of the block to the rope are - to the balance force
11. Among the following phenomena, it does not belong to the phenomenon of using inertia and it is
A. When riding a bicycle, in order to slow down, pinch brake B and hammer head orange, and hit the handle on the ground several times
C. Athletes use run-up long jump D, hand slap dust on clothes
There is a physics textbook on the desk with an English Chinese dictionary on it
A. The gravity that physics textbooks are subjected to and the supporting force of the desktop on the textbooks are - the balance force
B. The pressure of textbook on desktop and the support of desktop on textbook are a pair of balance forces
C. The gravity that the dictionary is subjected to and the textbook's support for the dictionary is - the balance force
D. The pressure of dictionaries on textbooks and the support of textbooks on dictionaries are a pair of balancing forces


In the story of "carving a boat to seek a sword", Chu Ru didn't make clear the relativity between motion and stillness, which made later generations laugh. In fact, the motion of the sword falling into the bottom of the river relative to the boat and the Bank of the river is (a) A. motionless B. motional C. motionless