问题 单项选择题

在静态测试中,主要是对程序代码进行静态分析。“数据初始化、赋值或引用过程中的异常”属于静态分析中的()

A.控制流分析

B.数据流分析

C.接口分析

D.表达式分析

答案

参考答案:B

解析:

本题考查静态测试方法的知识点。

静态测试是指被测试程序不在机器上运行,而采用人工检测和计算机辅助静态分析的手段对程序进行检测。静态测试包括对文档的静态测试和对代码的静态测试。对代码的静态测试包括控制流分析、数据流分析、接口分析和表达式分析。

①控制流分析。控制流分析是指使用控制流程图检查被测程序控制结构的过程。例如,可检查被测程序是否存在没有使用的语句或子程序、是否调用并不存在的子程序,以及是否存在无法达到的语句等。

②数据流分析。数据流分析是指使用控制流程图分析数据各种异常情况的过程,包括数据初始化、赋值或引用过程中的异常。例如,引用未定义的变量、对以前未使用的变量再次赋值等程序差错或异常情况。

③接口分析。接口分析主要包括模块之间接口的一致性分析、模块与外部数据库及其他软件配置项之间的一致性分析、子程序和函数之间的接口一致性分析等。例如可以检查函数形参与实现的数量、顺序、类型和使用的一致性。

④表达式分析。表达式分析用于检查程序代码中的表达式错误。例如,括号不配对、数组引用越界、除数为零,以及浮点数变量比较时的误差等错误。

单项选择题
填空题

One is never at a loss for a place to (1) in Malaysia.The country’s cities and major towns have a (2) range of accommodation to suit all tastes and budgets. Most international- (3) hotels cater to total living requirements and as such, one (4) easily find restaurants, entertainment outlets and fitness centres within the (5) complex.
Several resort hotels even have adjoining golf courses and (6) parks with special privileges accorded to hotel guests. Family outings (7) these hotels can be a practical yet fun-filled activity. Guests (8) on longer stays may appreciate the serviced apartments situated within (9) major cities.
Malaysia is also an excellent destination for romantic getaways, (10) for honeymooners seeking an idyllic tropical retreat with (11) amenities. The country’s award-winning island resorts are paradises waiting to be (12) .
For budget-conscious tourists, there is an array of accommodations located (13) to amenities and tourist attractions. Budget accommodations in Malaysia are (14) according to the Orchid Classification Scheme and include hostels, bed (15) breakfast establishments, inns, boarding houses, rest houses and lodging houses. (16) Orchid rating is awarded to tourist accommodations offering basic facilities (17) well as safe and clean premises.
Adventurous souls can try (18) the innumerable value-for-money kampung-style chalets located along popular beaches. Nature (19) seeking communion with nature in Malaysia’s world-famous nature parks such (20) Taman Negara will be amazed by the easy availability of chalets with modern facilities in these areas.