跳转至

COMP201 期末模拟试题

Question 1

Which of the following statements best describes both verification and validation?
以下哪个陈述最能描述验证和确认?

a) Validation confirms the software is syntactically correct, verification confirms it operates according to the specification
a) 验证确认软件的语法正确,确认根据规范操作

b) Validation confirms the software is good for the end user, verification confirms it works according to the specification
b) 验证确认软件对最终用户是好的,确认它根据规范工作

c) Validation confirms the software is good for the end user, verification confirms that can be proved to work correctly in all cases
c) 验证确认软件对最终用户是好的,确认可以证明在所有情况下都能正确工作

d) Validation confirms the software is syntactically correct, verification confirms that can be proved to work correctly in all cases
d) 验证确认软件的语法正确,确认可以证明在所有情况下都能正确工作

e) None of the above
e) 以上都不是

Answer: b) Validation confirms the software is good for the end user, verification confirms it works according to the specification.
答案:b) 验证确认软件对最终用户是好的,确认它根据规范工作。
Explanation: Verification ensures the product meets specifications, while validation ensures it meets user needs.
解释: 验证确保产品符合规范,而确认确保其满足用户需求。


Question 2

Looking at the class diagram shown in Figure 1, which of the following describes all the IS-A relationships?
查看图1中的类图,以下哪个描述了所有的IS-A关系?

a) B is an A, C is an A, E is a C, F is a D only
a) B是A,C是A,E是C,F是D

b) B is an A, C is an A, E is a C, E is an A, F is a D only
b) B是A,C是A,E是C,E是A,F是D

c) C is a B, D is a C, F is an E only
c) C是B,D是C,F是E

d) B is a C, C is a D, E is an F only
d) B是C,C是D,E是F

e) A is an B, A is an C, C is an A, A is an E, D is a F only
e) A是B,A是C,C是A,A是E,D是F

Answer: b) B is an A, C is an A, E is a C, E is an A, F is a D only.
答案:b) B是A,C是A,E是C,E是A,F是D。
Explanation: The IS-A relationship indicates inheritance in class diagrams, and this option correctly identifies all relationships.
解释: IS-A关系表示类图中的继承,此选项正确识别了所有关系。

Exam Example 1


Question 3

Looking at Figure 1, which of the following best describes all of the IS PART OF relationships?
查看图1,以下哪个最能描述所有的IS PART OF关系?

a) B is part of C, C is part of D, E is part of F
a) B是C的一部分,C是D的一部分,E是F的一部分

b) B is part of C, C is part of D, E is part of F
b) B是C的一部分,C是D的一部分,E是F的一部分

c) B and C are part of A, E is part of F, C is part of D
c) B和C是A的一部分,E是F的一部分,C是D的一部分

d) C is part of B, D is part of C, F is part of E and D is part of B
d) C是B的一部分,D是C的一部分,F是E的一部分,D是B的一部分

e) E and F are part of C and D
e) E和F是C和D的一部分

Answer: c) B and C are part of A, E is part of F, C is part of D.
答案:c) B和C是A的一部分,E是F的一部分,C是D的一部分。
Explanation: This option accurately reflects the hierarchical structure of the components.
解释: 此选项准确反映了组件的层次结构。


Question 4

Look at Figure 2, which of the following would be the best match (note not all use cases are shown):
查看图2,以下哪个是最佳匹配(注意并非所有用例都显示)?

a) UseCase 1 Check item is in stock, UseCase 2 Item out of stock inform customer, UseCase 3 Payment failed
a) 用例1 检查商品是否有货,用例2 商品缺货通知客户,用例3 支付失败

b) UseCase 1 Take payment, UseCase 2 Payment failed, UseCase 3 Item out of stock
b) 用例1 收款,用例2 支付失败,用例3 商品缺货

c) UseCase 1 Take payment, UseCase 2 Invalid product code, UseCase 3 Item out of stock
c) 用例1 收款,用例2 无效产品代码,用例3 商品缺货

d) UseCase 1 Check item is in stock, UseCase 2 Item out of stock inform customer, UseCase 3 Take payment
d) 用例1 检查商品是否有货,用例2 商品缺货通知客户,用例3 收款

e) UseCase 1 Take payment, UseCase 2 Item out of stock inform customer, UseCase 3 Payment failed
e) 用例1 收款,用例2 商品缺货通知客户,用例3 支付失败

Answer: a) UseCase 1 Check item is in stock, UseCase 2 Item out of stock inform customer, UseCase 3 Payment failed.
答案:a) 用例1 检查商品是否有货,用例2 商品缺货通知客户,用例3 支付失败。
Explanation: This option logically follows the sequence of events in a shopping scenario.
解释: 此选项在购物场景中逻辑上遵循事件的顺序。


Question 5

Consider the Petri Net in Figure 3 with places p1, p2, p3 and p4 and transitions t1, t2 and t3. For the given initial state of the system shown in Figure 3, which transitions are enabled?
考虑图3中的Petri网,具有位置p1、p2、p3和p4以及转换t1、t2和t3。对于图3中显示的系统的初始状态,哪些转换是启用的?

a) Any two of T1, T2 and T3
a) T1、T2和T3中的任意两个

b) T1, T2 and T3
b) T1、T2和T3

c) T1 and T2 only
c) 仅T1和T2

d) T3 only
d) 仅T3

e) No transitions
e) 没有转换

Answer: b) T1, T2 and T3.
答案:b) T1、T2和T3。
Explanation: All transitions are enabled based on the initial state of the Petri net.
解释: 根据Petri网的初始状态,所有转换都是启用的。


Question 6

When the Petri Net shown in Figure 3 fires, which transitions will fire, and after firing what will be the state of the net?
当图3中显示的Petri网触发时,哪些转换将触发,触发后网的状态将是什么?

a) T1 will fire and the state will be (0,0,0,2)
a) T1将触发,状态将为(0,0,0,2)

b) T2 will fire and the state will be (0,1,0,0)
b) T2将触发,状态将为(0,1,0,0)

c) T3 will fire and the state will be (0,0,3,0)
c) T3将触发,状态将为(0,0,3,0)

d) T1 or T2 will fire we cannot determine which, if T1 fires the state will be (0,0,0,1) if T2 fires the state will be (1,1,0,0)
d) T1或T2将触发,我们无法确定哪个,如果T1触发状态将为(0,0,0,1),如果T2触发状态将为(1,1,0,0)

e) T1, T2 and T3 will fire we cannot determine which the state of the net will be random
e) T1、T2和T3将触发,我们无法确定哪个,网的状态将是随机的

Answer: d) T1 or T2 will fire we cannot determine which, if T1 fires the state will be (0,0,0,1) if T2 fires the state will be (1,1,0,0).
答案:d) T1或T2将触发,我们无法确定哪个,如果T1触发状态将为(0,0,0,1),如果T2触发状态将为(1,1,0,0)。
Explanation: The firing of transitions depends on the current state, and both T1 and T2 can potentially fire.
解释: 转换的触发取决于当前状态,T1和T2都可能触发。


Question 7

Which of the following statements about cohesion and coupling is true?
关于内聚性和耦合性,以下哪个陈述是正确的?

a) High cohesion and high coupling lead to high quality software
a) 高内聚和高耦合导致高质量软件

b) Low coupling makes software hard to test, high cohesion leads to stronger software with less bugs
b) 低耦合使软件难以测试,高内聚导致更强的软件,错误更少

c) Low coupling and high cohesion makes software easier to test and debug
c) 低耦合和高内聚使软件更容易测试和调试

d) High coupling makes the software run faster, low cohesion is a part of the syntactic structure of the code
d) 高耦合使软件运行更快,低内聚是代码语法结构的一部分

e) Coupling and cohesion are only relevant for distributed systems
e) 耦合和内聚仅与分布式系统相关

Answer: c) Low coupling and high cohesion makes software easier to test and debug.
答案:c) 低耦合和高内聚使软件更容易测试和调试。
Explanation: Low coupling reduces dependencies between modules, while high cohesion ensures that modules are focused on a single task, making testing and debugging simpler.
解释: 低耦合减少模块之间的依赖,而高内聚确保模块专注于单一任务,使测试和调试更简单。


Question 8

Which of the following are features of black box testing?
以下哪些是黑盒测试的特征?

X1 Code is hidden
X1 代码是隐藏的

X2 Path testing is done
X2 进行路径测试

X3 Software is tested according to specification using test cases
X3 软件根据规范使用测试用例进行测试

X4 Boundary cases are used
X4 使用边界情况

X5 Loop testing is done
X5 进行循环测试

a) All of the above
a) 以上所有

b) X1, X2, X3 and X4
b) X1、X2、X3和X4

c) X1, X2, X3 and X5
c) X1、X2、X3和X5

d) X1, X3 and X4
d) X1、X3和X4

e) X2, X3, X4 and X5
e) X2、X3、X4和X5

Answer: d) X1, X3 and X4.
答案:d) X1、X3和X4。
Explanation: Black box testing focuses on input and output without knowledge of internal code structure, hence code is hidden, and it tests according to specifications and boundary cases.
解释: 黑盒测试关注输入和输出,而不需要了解内部代码结构,因此代码是隐藏的,并根据规范和边界情况进行测试。


Question 9

Which of the following best describes high software robustness?
以下哪个最能描述高软件鲁棒性?

a) Low chance of software failure
a) 软件失败的可能性低

b) Low chance of data loss or corruption on crash
b) 崩溃时数据丢失或损坏的可能性低

c) Low chance of software testing failure
c) 软件测试失败的可能性低

d) Strong coupling between modules
d) 模块之间的强耦合

e) High speed of execution
e) 执行速度快

Answer: b) Low chance of data loss or corruption on crash.
答案:b) 崩溃时数据丢失或损坏的可能性低。
Explanation: Robust software is designed to handle errors gracefully and minimize data loss during failures.
解释: 鲁棒性软件旨在优雅地处理错误,并在故障期间最小化数据丢失。


Question 10

Which of the following are non-functional requirements?
以下哪些是非功能性需求?

X1 User uses username and password to login
X1 用户使用用户名和密码登录

X2 Passwords must be at least 10 characters long
X2 密码必须至少10个字符长

X3 Development team uses ISO9000 quality standard
X3 开发团队使用ISO9000质量标准

X4 Development is done in Java
X4 开发使用Java进行

X5 The system scans and processes paper sourced documents.
X5 系统扫描和处理纸质文档。

a) X1, X2, X3 and X4
a) X1、X2、X3和X4

b) X2, X3 and X4
b) X2、X3和X4

c) All of the above
c) 以上所有

d) X1 and X5
d) X1和X5

e) X2, X2, X4 and X5
e) X2、X2、X4和X5

Answer: b) X2, X3 and X4.
答案:b) X2、X3和X4。
Explanation: Non-functional requirements specify criteria that can be used to judge the operation of a system, such as performance, security, and standards compliance.
解释: 非功能性需求指定可用于判断系统操作的标准,例如性能、安全性和标准合规性。


Figure 1 Class Diagram
Figure 2 Actor Model
Figure 3 Simple Petri Net