Traditional Culture Encyclopedia - Weather inquiry - Noip, the learning content of Olympic Games in computer junior high school
Noip, the learning content of Olympic Games in computer junior high school
Four commonly used number systems and their mutual conversion;
Application of cardinal weight law in cardinal number.
Decimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 910/0i is decimal one.
Binary 0, 1 2 2i each binary 1
Octal 0, 1, 2, 3, 4, 5, 6, 788i is octal.
Hexadecimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, F 16 16i are all hexadecimal ones.
How to convert decimal numbers into binary numbers, octal numbers and hexadecimal numbers;
Methods of converting binary numbers, octal numbers and hexadecimal numbers into decimal numbers: weighted expansion and summation
1. Conversion between binary and decimal:
(1) Binary to Decimal
Method: "Sum by weight expansion"
Example: (1011.01) 2 = (1× 23+0× 22+/kloc-0 /× 21+/kloc-.
=(8+0+2+ 1+0+0.25) 10
=( 1 1.25) 10
Law: the number of digits in one digit is 0, the number of digits in ten digits is 1, ..., increasing according to the prize, and ten.
The percentile is-1, the percentile is -2, ..., decreasing in turn.
Note: Not any decimal fraction can be converted into a binary number with a limited number of digits.
(2) Decimal to binary
Decimal integer to binary number: "Divide by 2 to get the remainder, and arrange it in reverse order" (short division and inverse remainder method)
For example: (89)10 = (1011001) 2
2 89
2 44 …… 1
2 22 ……0
2 1 1 ……0
2 5 …… 1
2 2 …… 1
2 1 ……0
0 …… 1
Decimal decimal number to binary number: "round by 2, in order" (round by 2)
For example: (0.625)10 = (0.101) 2
0.625
X 2
1.25 1
X 2
0.5 0
X 2
1.0 1
2. Conversion between octal and binary:
Binary numbers are converted into octal numbers: starting from the decimal point, the integer part is left, the decimal part is right, and every three digits are represented by an octal number. If it is less than three digits, the three digits should be supplemented with "0" to get an octal number.
Convert octal number into binary number: convert each octal number into a 3-bit binary number to get a binary number.
Example: Convert octal 37.4 16 to binary number:
3 7 .4 1 6
0 1 1 1 1 1 . 100 00 1 1 10
Namely: (37.416) 8 = (111.10001) 2.
Example: Convert binary10110.001to octal:
0 1 0 1 1 0 .0 0 1 1 0 0
2 6 . 1 4
Namely: (10110.01) 2 = (26.14) 8.
3. Conversion between hexadecimal and binary:
Binary number is converted into hexadecimal number: starting from the decimal point, the integer part is left, the decimal part is right, and every four digits are represented by a hexadecimal number. If it is less than four digits, add "0" to the four digits to get a hexadecimal number.
Convert Hexadecimal Numbers to Binary Numbers: Convert each octal number into a 4-bit binary number and you get a binary number.
Example: Convert hexadecimal number 5DF.9 to binary number:
The fifth day, the ninth day
0 10 1 1 10 1 1 1 1 1 . 100 1
Namely: (5df.9)16 = (1011111/.
Example: Convert the binary number110001.11into hexadecimal:
0 1 10 000 1 . 1 1 10
6 1 .E
Namely: (110001.11) 2 = (61. E) 16。
Note: The binary numbers mentioned above are all unsigned numbers. The range of these figures is as follows:
Hexadecimal range representation of the numerical range of unsigned binary numbers.
8-bit binary number 0~255 (255=28- 1) 00~0FFH.
16 binary number 0 ~ 65535 (65535 = 216-1) 0000h ~ 0ffffh.
32-bit binary number 0 ~ 232-100000000h ~ 0 ffffffffh
The machine code is represented by a signed number
1. Representation of signed binary numbers:
Signed binary numbers use most significant bit to represent symbols: 0 means positive and 1 means negative.
Hexadecimal range representation of signed binary numeric range.
8-bit binary number-128 ~+127 80h ~ 7fh
16 binary number -32768 ~ +32767 8000H~7FFFH
32-bit binary number-2147483648 ~+2147483647 8000000h ~ 7fffffffh
2. Representation of sign bit: The most commonly used representation methods are original code, complement and complement.
(1) The original code indicates that a machine number X consists of a sign bit and a valid numerical value. Let the sign bit be x0, and the absolute value of the true value of x | = x 1x2x3...xn, then the original code of the machine number of x can be expressed as:
[x] original =, when x >;; =0, x0=0, when x
For example, if x 1 =-101b and x2=+100 1B are known, then x1and x2 have original codes respectively.
[x 1]Original = 1 1 1B,[x2]Original = 0 100 1B。
Law: the original code of a positive number is itself, and the original code of a negative number is "1" of the highest bit (left end) after taking the absolute value.
(2) Anti-code representation: the original code symbol bit of negative number remains unchanged, and other bits are inverted bit by bit, which is the anti-code representation of machine number. The negative code of a positive number is the same as the original code.
Bitwise inversion means that the bit of 1 becomes 0, and the bit of 0 becomes 1. That is1= 0,0 =1.
For example: sum
Answer: =, =
(3) Complement symbol:
Firstly, the operation of two decimal numbers is analyzed: 78-38=4 1, 79+62= 14 1.
If you use a two-digit operator, when you do 79+62, the extra 100 will be automatically discarded because it is beyond the two-digit range of the operator, so when you subtract 78-38, you can also get the correct result by adding 79+62.
Modulus is the measurement range of a measurement system, its size is based on the cardinal number of the measurement system, and the number of digits is the power of the index. For example, the measurement range of two decimal places is 1-9, the overflow is 100, and the modulus is 102= 100. The above operation is called modular operation, and you can write it as follows:
79+(-38)=79+62 (modulus 100)
Further written as -38=62, the complement of -38 (for module 100) is 62. Computer is a digital system with limited word length, so its operation is modular operation, and the result beyond the modulus will overflow. The modulus of n-bit binary is 2n,
The complement of a number is recorded as the complement of [x], the module is m, and x is the true value, so the definition of the complement is as follows:
Example: let the word length n=8 digits and x =-101kloc-0/1b, and find the complement of [x].
Solution: because n=8, the modulus m = 28 M=28= 100000000B, x.
[x] complement = m+x =1000000b-101kloc-0/b =101065438.
Note: The highest complement bit of this X is "1", which means it is a negative number. For binary numbers, there is an easier way to find the complement from the original code:
(1) The complement of a positive number is the same as the original code;
(2) The complement of a negative number is that after the sign bit of the original code remains "1", the rest bits are negated bit by bit, and the last bit is added with 1, that is, the complement of the original code is added with "1":[x] complement =[x] inverse+1.
The 8-bit binary source code, complement and complement listed in the following table are all expressed in hexadecimal.
Truth original code (b) complement (b) complement (b) (h)
+ 127 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 165438
+39 0 0 10 0 1 1 1 0 0 10 0 1 1 1 0 0 10 0 1 1 1 27
+0 0 000 0000 0 000 0000 0 000 0000 00
-0 1 000 0000 1 1 1 1 1 1 1 1 0 000 0000 00
-39 1 0 10 0 1 1 1 1 1 1000 1 1 10 1 1 1 1 1 000 1 D9
- 127 1 1 1 1 1 1 1 1 1 000 0000 1 000 000 1 8 1
-128 cannot represent 1 000 0000 80.
As can be seen from the above, the complement representations of truth values +0 and -0 are consistent, but they have different forms in the original code and complement representations. The number of 8-bit twos complement machines can be expressed as-128, but there is no corresponding+128. Therefore, the 8-bit two's complement can represent the range of numbers as-128-+ 127. Also note that there is no-128 in the form of 8-bit original code and inverse code.
Fixed point and floating point number
(1) fixed-point number
The data processed by computer is not only symbolic, but also a large number of data with decimals, which do not occupy a binary number, but are hidden in a fixed position in the machine number. There are usually two simple conventions: one is to stipulate that the decimal point position of all machine numbers is implied after the lowest digit of the machine number, which is called fixed-point pure integer machine number, or fixed-point integer for short. Another convention that the decimal point of all phone numbers is implied after the sign bit and before most significant bit is called fixed-point pure decimal phone number, which is called fixed-point decimal for short. Whether it is a fixed-point integer or a fixed-point decimal, it can have three forms: original code, complement and complement.
(b) floating point number (floating point number)
In most cases, computers use floating-point numbers to represent numerical values, which is similar to scientific counting methods. By moving the decimal point, binary numbers are represented as rank codes and mantissas:
Where: the exponent of e-n is a signed integer.
The mantissa, the mantissa of S-n, is the significant digit part of the numerical value, and it is generally stipulated to take the form of binary fixed-point pure decimal.
For example:10110111,1..
The format of floating-point numbers is as follows:
E0
e 1e 2………En
E0
e 1e 2………En
Sequence symbol, sequence symbol and mantissa
Floating-point numbers are composed of sequential codes and mantissas, and there is no radix 2, which is implicit. The positive and negative symbol E0 of rank code, in the first position, the rank reflects the position of decimal point of number n, which is usually expressed by complement. Every time the decimal point of the binary number n moves to the left, the order increases by 1. The mantissa is the decimal point, which is often taken as the complement or the original code. The code system is not necessarily the same as the grade code. The decimal point of the number n is shifted to the right by one bit, and when the mantissa is shifted to the left by one bit, it is represented by a floating-point number. The length of the mantissa determines the accuracy of the number n, and the mantissa symbol is called mantissa symbol, which is the symbol of the number n and occupies one bit.
Example: Write the binary number-101.110/b in floating-point form. Set the sequence code to 4-bit complement, and the mantissa is 8-bit original code.
- 10 1. 1 10 1=-0. 10 1 1 10 1*2+3
The floating-point form is:
Order code 00 1 1 mantissa1111.
Supplementary note: The highest digit "0" in the grade code 00 1 1 is a plus sign, and the following "0 1 1" indicates that the index is "3"; The mantissa11011kloc-0/indicates that the whole decimal number is negative, and the rest101065558.
For example, the computer floating-point number format is as follows. Write the normalized form of x = 0.0001101b, with the sequence code as the complement and the mantissa as the original code.
x = 0.000 1 10 1 = 0. 1 10 1 * 10-3
You [-3] complement =[-00 1B] complement = [1kloc-0/1] complement =1/b.
So floating-point numbers are in the form of
1 10 1 0 1 10 1000
ASCII code (american standard code for information interchange code)
American standard information interchange code
Each character is represented by a 7-bit binary number, and * * has 128 states.
Upper and lower letters, 0…9, other symbols, control symbols
' 0 ' ―― 48
A'-65
' a '―97
Chinese character information coding
1. Chinese character input code
Chinese character input method can be roughly divided into: positioning code (digital code), phonetic code, shape code and phonetic code.
Positioning code: the advantage is that there is no duplicate code or the duplicate code rate is low, and the disadvantage is that it is difficult to remember;
Phonetic code: the advantage is that most people are easy to master, but there are many homophones with high repetition rate, which affects the input speed;
Shape code: according to the font of Chinese characters, there are many coding rules, which are difficult to remember and must be trained to master; Low duplicate code rate;
Phonetic code: input Chinese characters by combining phonetic code and shape code, which reduces the duplication rate and improves the input speed of Chinese characters.
2. Chinese character interchange code
Chinese character interchange code refers to the coding standard used by different computer systems with Chinese character processing function when exchanging Chinese character information. Since the publication of the national standard GB23 12-80-80, China has been using the national standard code as a unified Chinese character information interchange code.
The GB23 12-80-80 standard includes 6763 Chinese characters, which are divided into 3755 first-class Chinese characters and 3008 second-class Chinese characters according to the frequency of use. The first-level Chinese characters are sorted by pinyin, and the second-level Chinese characters are sorted by radicals. In addition, the standard also includes 682 symbols such as punctuation marks, some western letters, numbers and numbers.
Because GB23 12-80-80 is a standard formulated in 1980s, it is often inadequate in practical application. Therefore, it is suggested that the newly promulgated GB 18030 coded character set for information exchange should be adopted for products dealing with text information. The standard puts traditional Chinese characters and simplified Chinese characters on the same platform, which can solve the problem of inconvenient character code conversion between GB code and BIG5 code between three places across the Taiwan Strait.
3. Font storage code
Font storage code refers to the binary information for computer to output Chinese characters (display or print), also known as font. Digital dot matrix fonts are usually used. As shown in the figure below:
1 2 3 4 5 6 7 8 9 10 1 1 12 13 14 15 16
1
2
three
four
five
six
seven
eight
nine
10
1 1
12
13
14
15
16
General lattice sizes are 16× 16, 24×24, 32×32, 64×64, etc. Each point is stored in memory with a binary bit. For example, in the lattice of 16× 16, a storage space of 16× 16 bits = 32 bytes is required. In the same grid, no matter the complexity of strokes, the number of bytes occupied by each Chinese character is the same.
In order to save storage space, font data compression technology is widely used. The so-called vector Chinese character refers to the digitized information of Chinese character font obtained by compressing Chinese character dot matrix font by vector method.
example
Decimal number11128 can be expressed as (d) in binary sequence.
a) 10 1 1/ 1000000 B) 10 1 1/ 100000000 C)0.00 10 1 1 1D)0.000 165438
The result of formula (2047)10-(3ff)16+(2000) 8 is (a).
(2048) 10b)(2049) 10c)(3746)8d)( 1af 7) 16
Given x = (0.101010) 2, then [x/2] =( C) 2.
a)0. 10 1 1 10 1。 b) 1 1 1 10 1 10 C)0.0 10 1 10 1D)0. 10 1 10
Given A=35H, the result of A∧05H∨A∧3OH is: (c).
A)3OH B)05H C) 35H D) 53H
[x] complement = 100 1 1000, and its original code is (b)
a)0 1 100 1 1 1 1 B) 1 1 1000 C) 1 1 1 1000D)0 165438
Among the following unsigned numbers, the smallest number is (c)
A.( 1 10 1 100 1)2 b .(75) 10 c .(37)8d .(2A) 16
The operation speed of a computer depends on the amount of data that the processor can process in a given time. The amount of data that a processor can process at a time is called word length. As we all know, a 64-bit Pentium processor can process 64 information bits at a time, which is equivalent to (A) bytes.
A.8 B. 1 C. 16 D.2
In the font library of 24*24 dot matrix, the number of bytes occupied by the fonts of Chinese characters "one" and "edge" is (c) respectively.
32、32、72、72
There are two kinds of numbers in the computer: floating point number and fixed point number, in which the number represented by floating point number usually consists of two parts (C).
A. Exponent and radix B. mantissa and decimal C. Rank code and mantissa D. Integer and decimal
The decimal arithmetic expression: 3 * 5 12+7 * 64+4 * 8+5 is expressed in binary as (b).
A. 10 1 1 100 10 1 b . 1 1 1 1 1 1 1 10 10 10 1
c 1 1 1 100 10 1d . 1 1 1 1 1 1 1 1 1 1 1 1
The Chinese characters that make up the words' (Professor)',' (Professor) and' (Jiang Shi') are all first-class Chinese characters in the GB23 12-80-80 character set. The result of sorting these three words is (D).
Professors, Associate Professors and Lecturers
C lecturer, associate professor and professor d associate professor, lecturer and professor.
GB23 12-80 stipulates 3755 first-class Chinese characters and 3008 second-class Chinese characters, among which the Chinese characters in the second-class Chinese character library are arranged in the order of (b).
A. number of strokes B. radical c. ASCⅱⅱ code D. internal code
Decimal number 2004 is equivalent to octal number (b).
A. 3077 BC, 3724 BC, 2766 BC, 4002 BC, 3755 BC
The result of (2004) 10+(32) 16 is (d).
A.(2036) 10 b .(2054) 16 c .(4006) 10d .( 10000000 10)2 e .(2036) 16
Decimal number 100.625 is equivalent to binary number (b).
A. 100 1 100. 10 1 b . 1 100. 10 1 c . 1 10 10 100.0 100.0 165438
The value of the following binary number is closest to the value of the decimal number 23.456 (D).
A. 10 1 1 1.0 10 1 b . 1 1 1. 1 1 1 1 1 c . 1 165438
C.CPU and memory do not exchange information indirectly. CPU and memory exchange information.
- Related articles
- What direction is Typhoon Meihua?
- Beijing officially released five excellent routes of TCM health tourism.
- When is the best time to scrape putty?
- What are the scenic spots in Taiyuan, Shanxi?
- Where is Long Island in Chongming?
- Are there any good anime movies?
- Weather in Fengyang County, Anhui Province
- What is the weather like on the 16th of the first lunar month in Songzi, Hubei?
- What's the point of hot girls' clothes? What experiences can you share?
- When will Shanghai Riming resign and get paid immediately?