數值方法

advertisement
第1頁共4頁
計算機概論
課堂作業七
系級:
座號:
姓名:
一、 是非題 (每題 2 分)
(
)
1. In lossy data compression, the integrity of the data is preserved.
(
)
2. Run-length encoding method is one of the lossless methods in data
compression.
(
)
3. In Huffman coding, we assign longer codes to symbols that occur more
frequently.
(
)
4. The Lempel Ziv (LZ) algorithm uses the idea of adaptive
dictionary-based encoding.
(
)
5. Joint photographic experts group (JPEG) compression technique is used
to compress video.
(
)
6. In discrete cosine transform (DTC) the DC value gives the average
value of the pixels.
(
)
7. The quantization step in data compression will lose some information
that can not be recoverable.
(
)
8. In motion picture experts group (MPEG) compression technique, a
B-frame is never related to another B-frame.
(
)
9. The RSA algorithm is the basis of a private key encryption method.
(
)
10. In secret key encryption, the same key is used in encryption and
decryption.
(
)
11. In the world, if N people want to use secret key encryption then there
need to be N(N-1) secret keys.
(
)
12. In public key encryption method, the encryption and decryption
algorithms are not the inverse of each other.
(
)
13. A Turning machine is made of three components: a tape, a controller,
and a read/write head.
(
)
14. The Turning machine’s memory is finite.
(
)
15. The halting problem is not solvable. It means there is no program that
can predict whether or not another program will terminate.
(
)
16. We use big-O notation to denote the efficiency of the program.
1
第2頁共4頁
二、 選擇題 (每題 2 分)
(
(
)
)
1. To create a digest of a document, you can use
(A) a digital signature
(B) a prime number
(C) data encryption standard (DES)
(D) a hash function
2. In the digital signature method, the receiver uses the
decrypt the message.
(A) public
(
)
.
(B) private
(C) secret
key to
(D) skeleton
3. One of the advantages of public key encryption is
.
(A) the short amount of time required for encryption/decryption
(B) a smaller number of keys is needed
(C) integrity is preserved
(D) everyone knows all the keys
Table: Code for symbols used in the Simple language
Symbol
Hex Code
Symbol
Hex Code
1
1
9
9
2
2
incr
A
3
3
decr
B
4
4
while
C
5
5
{
D
6
6
}
E
7
7
x
F
8
8
(
)
4. Using the above table, the Godel number for decr X in decimal
is
.
(A) 367
(
)
(B) 175
(C) 174
(D) 191
5. Using the above table, the Godel number for incr X in hexadecimal
is
.
(A) AF
(B) BF
(C) CB
(D) BC
三、 填充、問答、計算題
1. (10%) (1) Please compress the following sequence by LZ encoding.
BAABABBBAABBBBAA
(2) Please uncompress the following sequence by LZ decoding.
A, C, 1C, 1B, 2A, 4C
ANS:
2
第3頁共4頁
系級:
座號:
姓名:
2. (15%) Given the frequency table as follows
Character
A
B
C
D
E
F
Frequency
19
6
5
1
45
24
(1) if the Huffman code of character “C” is 00000, please show the Huffman
codes of other characters.
(2) encoding the character list “EAEBACFD”
(3) decoding the Huffman code “0000000000110000101”
ANS:
3. (10%) Given the following Transition table,
Current
State
Start
Forward
Forward
Added
Backward
Backward
Read
Write
Move
New State
#
1
&
any
not #
#
#
1
1
&
same as read
#





Forward
Forward
Added
Backward
Backward
Stop
(1) Please show its transition diagram.
(2) Which statement is implemented by the table?
ANS:
3
第4頁共4頁
4. (10%) Please finish the RSA (Rivest-Shamir-Adleman encryption) method, and
answer the following question.
The private key is a pair of numbers (N, d) = (119, 5)
The public key is a pair of numbers (N, e) = (119, 77)
Encryption: C = P e mod N
Decryption: P =
where C: ciphertext
P: plaintext
Question: If C = 6, then P =
.
5. (12%) We can define a language with only three statements:
Increment statement:
incr X
Decrement statement:
decr X
Loop statement:
while X { Action(s) }
If we have simulate the following macros:
(1) First Macro: X  0
(2) Second Macro: Y  X
(3) Third Macro: comp (X)
Please finish the following simulated macros:
(1) Macro: Z  X + Y
(2) Macro: if X then A1 else A2
TEMP  X
while TEMP
{
A1
TEMP  0
}
ZX
while TEMP
{
decr
TEMP
}
while TEMP
{
A2
TEMP  0
}
4
Download