← COMP5565 全部讲次
Q06

期中模拟卷 B|单选题 1-8

现有材料范围内的非官方复习,含英文术语、成立条件与自拟练习解析。

手机上宽表格可左右滑动;自测答案默认收起,点击题目下方按钮查看。

非官方自拟模拟卷 B,正式考试范围、题型、时长和开闭卷要求以讲师通知为准。 按现有期中前密码学基础、L01-L05 与 Lab 1 编写,借鉴所提供往年期末卷的可见设问结构;不加入期中后专题。本卷不是往年期中真题或押题。

全卷 100 分,建议练习 100 分钟。Part A 为自拟单选 15 题共 30 分;Part B 共 70 分。原参考文件没有选择题正文,不能据此预测实际选择规则。每题答案和给分点默认收起,自评分不等于教师评分。

统一前提:Solidity 0.8.30、默认 checked arithmetic;采用普通 EOA 交易模型,不讨论账户代码委托。代码仅用于教学;除题目说明外,gas 充足、无隐藏操作、无额外费用。计算按题面精确数值。

读题词:attacker = 攻击者;justify = 给出原因;at least = 至少;strictly = 严格;resulting state = 结果状态。问题中的“攻击者”不是哈希性质的名称。

来源代号:C01 是密码学基础;L01-L05 对应逐讲注解。答案回查页码均为原 PDF 页序。英文同义表达与机制正确的替代答案可以成立。

B 卷导航:单选题 1-8 · 单选题 9-15 · 机制与应用 16-20 · 重入推演 21 · 升级 状态与钱包 22-24

前一套复习题入口 · 复习资料

单选题 1-8

B1 · Q1 A fixed document [2 marks]

An attacker is given a particular document D and tries to find a different document D′ with the same cryptographic hash. Which property directly addresses this attack?

A. Preimage resistance
B. Second-preimage resistance
C. Confidentiality
D. Availability

B1 · 查看答案与解析

Q1 · B · Second-preimage resistance

推理过程:先圈 particular document D:原消息已经指定,攻击者不能自由换掉它。随后要求“另找不同 D′,但摘要相同”,正是固定消息找替身,所以选 B。A 从一个摘要出发找输入;C 机密性问别人能否读到内容;D 可用性问能否取得服务,都不符合这次任务。

英文易混词:attacker = 攻击者;preimage = 原像;preimage resistance = 抗原像性;second-preimage resistance = 抗第二原像性。“原像”指经过哈希映射前的输入,不是免疫学的“抗原”(antigen)。题干里的 attacker 是发起攻击的人,不是某种安全性质。

English: The original message is fixed. The attacker must find a different message with the same digest, which is a second-preimage problem.

中文:抗原像性要求“给摘要找输入”很难;抗第二原像性要求“给固定消息找同摘要替身”很难;抗碰撞性要求“任意找一对不同消息却有同摘要”很难。三者不能只凭“哈希相同”混判。C、D 是机密性与可用性,不对应这个攻击目标。回查:C01 p.4-7。

B2 · Q2 A signed laboratory report [2 marks]

A report says that a physical product passed a safety test. Its digital signature verifies against the laboratory’s trusted public key. Which conclusion is justified by this cryptographic verification alone?

A. The signed data can be authenticated relative to that key; the physical claim still needs a trust assumption.
B. The report is hidden from everyone except the laboratory.
C. The physical product necessarily passed the test.
D. The laboratory can no longer lose control of its signing key.

B2 · 查看答案与解析

Q2 · A · Authentication is not physical truth

推理过程:先区分“这份话是谁批准的”与“这份话是否符合现实”。验签能支持前者,所以 A 成立;它没有重新做实体产品的实验,不能推出 C。消息没有因此被加密,B 不成立;一次验签也不能保证实验室未来永不丢密钥,D 不成立。

English: Verification authenticates the signed data relative to the trusted key. It does not establish the truth of the laboratory’s physical observation.

中文:签名能帮助查内容是否被改、是否由对应密钥授权;实验室可能撒谎、测错,或密钥泄露。签名也不是加密,不承诺将来的密钥安全。authenticity ≠ truthfulness ≠ confidentiality。回查:C01 p.37-44。

B3 · Q3 Merkle membership [2 marks]

For a perfect binary Merkle tree with eight leaves (all leaves at the same depth), how many sibling hashes are needed for a single-leaf proof, excluding the leaf and root? Assume left/right order is also supplied.

A. 3
B. 4
C. 7
D. 8

B3 · 查看答案与解析

Q3 · A · Three sibling hashes

推理过程:从待证明叶子开始:① 给出另一片叶子的摘要,算出父节点;② 给出旁边两叶子子树的摘要,算出四叶子子树;③ 给出另一半四叶子子树的摘要,算出根。每层缺的一半叫 sibling hash(兄弟哈希)。三层各一个,共 3,不需要把其他 7 片叶子逐个给出。

English: The path has three hashing levels: 8 leaves → 4 parents → 2 parents → 1 root. One ordered sibling hash is required at each level.

中文:不是给其他七个叶子;部分子树用一个摘要代表。方向不可漏,否则 H(left ∥ right) 可能被算成相反顺序。结论限定于题设满二叉树,不能套到所有 trie。回查:C01 p.32-36。

B4 · Q4 Account state [2 marks]

Which list contains the four account-state fields in the Ethereum model taught in class?

A. private key, public key, nonce, balance
B. gas limit, base fee, tip, signature
C. state root, transaction root, receipts root, timestamp
D. nonce, balance, storage root, code hash

B4 · 查看答案与解析

Q4 · D · Account-state fields

推理过程:题目问的是账户状态,不是钱包备份、交易或区块头。D 的 nonce(账户计数器)、balance(余额)、storage root(存储根)、code hash(代码哈希)都属于这一层。A 把私钥混入账户字段;B 混入费用和签名;C 列的是更大范围的区块信息。因此先认对象,再选字段。

English: The account-state fields are nonce, balance, storage root and code hash. A private key is not an account-state field stored on-chain.

中文:B 是费用/授权字段拼凑;C 更接近区块层面的承诺。分清 account、transaction、block 三层。普通 EOA 的账户 nonce 表示下一笔可接受交易的序号;它与这笔交易所带的 nonce 是状态与请求之间的匹配关系。回查:L02 p.13-27。

B5 · Q5 Contract creation [2 marks]

Which transaction form deploys a contract in the ordinary EOA model?

A. A transfer to the all-zero address with no data.
B. Any transaction containing an ABI JSON document.
C. Any call to an address containing code.
D. A transaction with no destination and creation code in its data.

B5 · 查看答案与解析

Q5 · D · Creation code, not a zero-address transfer

推理过程:部署先要让 EVM 执行创建代码,因此 D 的“无普通接收地址 + data 带创建代码”符合条件。A 是向指定零地址转账;B 的 ABI JSON 只是调用接口说明,不是创建代码;C 是调用已经有代码的地址,不能仅凭这一点认作创建交易。

English: A creation transaction has no ordinary destination and carries creation code. Sending a normal transaction to the zero address is a different action.

中文:ABI 是接口描述,不是可部署机器码;调用现有工厂合约可以间接创建子合约,但顶层仍是调用交易,不属于题目问的创建交易类型。回查:L02 p.42-54;L04b p.3-5。

B6 · Q6 ERC-20 approval [2 marks]

Alice has 90 units of a standard ERC-20 token. Her allowance for Bob is zero. She successfully calls approve(Bob, 50). There are no other actions. What changes immediately?

A. Alice’s balance becomes 40; Bob’s balance increases by 50.
B. Bob receives 50 ETH.
C. The allowance becomes 50; Alice’s token balance remains 90.
D. The token’s total supply increases by 50.

B6 · 查看答案与解析

Q6 · C · Approval does not transfer tokens

推理过程:把两个格子分开记:Alice 的 balance(余额)初始为 90,Bob 的 allowance(授权额度)由 approve 设为 50。题面只执行授权,没有执行转账,所以余额仍是 90,额度是 50,选 C。不要做 90 - 50;也不要把额度记录当作 Bob 已收到的代币。

English: The successful approval sets Bob’s allowance to 50. No token transfer is performed by that approval, so Alice still has 90 units.

中文:allowance 是授权额度,不是余额,也不是 ETH。后续能否 transferFrom 还受余额、额度和合约规则约束。回查:L03 p.20-32。

B7 · Q7 BIP39 sizes [2 marks]

BIP39 uses 224 bits of entropy, a checksum of ENT / 32 bits, and 11 bits per word index. Which pair gives the mnemonic word count and derived seed length?

A. 21 words; 512 bits
B. 21 words; 224 bits
C. 24 words; 512 bits
D. 20 words; 256 bits

B7 · 查看答案与解析

Q7 · A · 21 words; 512-bit seed

推理过程:先从 224 位 entropy(熵,即原始随机数据)算 7 位 checksum(校验和);拼成 231 位后,每 11 位选一个词,得到 21 词。这一步回答词数。seed(种子)由助记词与可选附加口令另行派生,固定输出 512 位,因此选 A。不要把前一步输入长度当成后一步输出长度。

Working: CS = 224 / 32 = 7 bits; total = 231 bits; words = 231 / 11 = 21. BIP39 seed derivation produces 512 bits = 64 bytes.

中文:熵长度、含校验和的位数、助记词数、seed 长度是四个量。seed 不是把 224 bits 原样复制出来。回查:L03 p.41-56 及钱包补充。

B8 · Q8 A watch-only wallet [2 marks]

A service has only a parent’s BIP32 extended public key. For valid child indices, which capability is available without any private key?

A. Signing transactions from every child.
B. Deriving non-hardened child public keys.
C. Recovering the parent private key from the xpub alone.
D. Deriving every hardened child public key.

B8 · 查看答案与解析

Q8 · B · Non-hardened public derivation

推理过程:先固定题目只有 xpub(扩展公钥)的前提。它能走非硬化规则派生子公钥,故 B 成立;A 签交易需要私钥,C 仅凭 xpub 不能恢复父私钥,D 则把非硬化能力误推广到硬化规则。chain code(链码,派生配套数据)虽参与派生,却不等于签名所需的私钥。

English: An xpub supports non-hardened public-child derivation, but does not alone permit signing or crossing a hardened derivation boundary.

中文:xpub 的 chain code 是派生材料,不是私钥。题目明确“只有 xpub”;若另有对应非硬化子私钥泄露,风险会改变,不能把这个限定删掉。回查:L03 p.41-56 及 BIP32 补充。

下一页 →
Q07 期中模拟卷 B|单选题 9-15

个人整理的学习笔记,不是官方材料;数字与结论以课件和讲师为准。