问题 单项选择题

面向对象系统中有两种基本的复用方式:框架复用和类库复用。下列关于框架和类库的描述不正确的是 (24)

A.框架是一个“半成品”的应用程序

B.类库只包含一系列可被应用程序调用的类

C.框架会为一个特定的目的实现一个基本、可执行的架构

D.类库是框架的一种扩展形式

答案

参考答案:D

解析:

[分析]: 框架与类库都可以认为是一种基础结构,而我们编写的代码是应用代码,若是基础代码调用应用代码,则这种基础结构是框架。反之,若是应用代码调用基础代码,则这种基础结构是类库。
框架是一个“半成品”的应用程序,而类库只是包含一系列可被应用程序调用的类。类库给用户提供了一系列可复用的类,这些类的设计都符合面向对象原则和模式。用户使用时,可以创建这些类的实例,或从这些类中继承出新的派生类,然后调用类中相应的功能。在这一过程中,类库总是被动地响应用户的调用请求。框架则会为某一特定目的实现一个基本、可执行的架构。框架中已经包含了应用程序从启动到运行的主要流程,流程中那些无法预先确定的步骤留给用户来实现。程序运行时,框架系统自动调用用户实现的功能组件。这时,框架系统的行为是主动的。所以,可以说类库是死的,而框架是活的。应用程序通过调用类库来完成特定的功能,而框架则通过调用应用程序来实现整个操作流程。框架是控制倒转原则的完美体现。
应用程序和框架系统之间依赖关系的特点:
(1)应用程序和框架系统之间实际上是双向调用,双向依赖的关系。
(2)依赖倒转原则可以减弱应用程序到框架之间的依赖关系。
(3)控制反转及具体的模板方法模式可以消解框架到应用程序之间的依赖关系,这也是所有框架系统的基础。
(4)框架系统可以独立重用。
注:依赖是两个模型元素之间的关系,被依赖的模型元素发生变化就会影响到另一个模型元素。依赖倒转(Dependency Inversion Principle)的定义:上层模块不应该依赖于下层模块,它们共同依赖于一个抽象;抽象不能依赖于具象,具象依赖于抽象。其含意是:为了消解两个模块间的依赖关系,应该在两个模块之间定义一个抽象接口,上层模块调用抽象接口定义的函数,下层模块实现该接口。

阅读理解

D

The recent, apparently successful, prediction by mathematical models of an appearance of El Nino—the warm ocean How that periodically develops along the Pacific coast of South America has excited researchers.Jacob Bjerknes pointed out years ago how winds might create either abnormally warm or abnormally cold water in the eastern equatorial (赤道附近的) Pacific.Nevertheless, before the creation of the models, no one could explain why conditions should regularly change between appearances of the warm El Nino and the so-called anti-El Nino.The answer, at least if the current model that links the behavior of the ocean to that of the atmosphere is correct, is to be found in the ocean.

It has long been known that during an El Nino, two conditions exist: unusually warm water extends along the eastern Pacific and winds blow from the west into the warmer air rising over the warm water in the east.The contribution of the model is to show that the winds of an El Nino, which raise sea level in the east, send a signal to the west lowering sea level at the same time.According to the model, that signal is created as a negative (负的) Rossby wave, a wave of lower sea level, that moves westward parallel to the equator at 25 to 85 kilometers per day.Taking months to move across the Pacific, Rossby waves march to the western boundary of the Pacific basin, which is modeled as a smootli wall but in reality consists of quite irregular island chains.

When the waves meet the western boundary, they are reflected, and the model predicts that Rossby waves will be broken into many coastal Kelvin waves carrying the same negative sea-level signal.These eventually shoot toward the equator, and then head eastward along the equator drove by the earth at a.speed of about.250 kilometers per day.When enough Kelvin waves of adequate amplitude (振幅) arrive from the western Pacific, their negative sea-level signal overcomes the feedback mechanism, raising the sea level, and they begin to drive the system into the opposite cold mode.This produces a gradual change in winds, one that will eventually send positive sea-level Rossby waves westward, waves that will eventually return as cold cycle—ending positive Kelvin waves beginning another warming cycle.

67.What is the passage mainly about?

A.How Rossby waves are found.

B.Where El Nino is formed.

C.What the models predict.

D.How the models work.

68.Where does El Nino often appear?

A.Along the western coast of the USA .

B.In the Pacific in the south, of the equator.

C.In the Pacific in the north of the equator.

D.Along the southern coast of South America.

69.What is right according to the passage?

A.Rossby waves and Kelvin waves move in opposite directions along the equator.

B.People could explain El Nino before the creation of the mathematical models.

C.Adequate sea-level waves can produce westward positive cold cycle.

D.The speed of Rossby waves is faster than that of Kelvin waves.

70.What does the underlined word "waves" in Paragraph 3 refer to?

A.Kelvin waves.       B.Sea-level signals.   C.Coastal waves.   D.Rossby waves.

单项选择题