l In C language, a (2) is a series of charactrs enclosed in double quotes.
A. matrixB. stringC. programD. stream
第1题:
执行以下程序,输出结果为()。main(){chara[]='program';printf("%c",a[0]);}。
A. pro
B. p
C. program
D. a
第2题:
阅读以下说明和C++代码,
[说明]
现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1,y1,x2,y2)画一条直线,DP2则用drawline(x1,x2,y1,y2)画一条直线。当实例化矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图6-1显示了各个类间的关系。
[图6-1]

这样,系统始终只处理3个对象:Shape对象、Drawingg对象、DP1或DP2对象。以下是C++语言实现,能够正确编译通过。
[C++代码]
class DP1{
public:
static void draw_a_line(double x1,double y1,double x2,double y2){
//省略具体实现
}
};
class DP2{
public:
static void drawline(double x1,double x2,double y1,double y2){
//省略具体实现
}
};
class Drawing{
public:
(1) void drawLine(double x1,double y1,double x2,double y2)=0;
};
class V1Drawing:public Drawing{
public:
void drawLine(double x1,double y1,double x2,double y2){
DP1::draw_a_line(x1,y1,x2,y2);
}
};
class V2Drawing:public Drawing{
public:
void drawLine(double x1,double y1,double x2,double y2){
(2)
}
};
class Shape{
privatc:
(3) dp;
public:
Shape(Drawing*dp);
virtual void draw()=0;
void drawLine(double x1,double y1,double x2,double y2);
};
Shape::Shape(Drawing*dp)
{
_dp=dp;
}
void Shape::drawLine(double x1,double y1,double x2,double y2)
{ //画一条直线
(4);
}
class Rectangle:public Shape{
privatc:
double_x1,_y1,_x2,_y2;
public:
Rectangle(Drawing *dp,double x1,double y1,
double x2,double y2);
void draw();
};
Rectangle::Rectangle(Drawing*dp,double x1,double y1,double x2,double y2)
: (5)
{
_x1=x1;_y1=yl;_x2=x2;_y2=y2;
}
void Rectangle::draw()
{
//省略具体实现
}
(1)
第3题:
使用VC6打开考生文件夹下的工程test1_1,此工程包含一个源程序文件test1_1.cpp,但该程序运行有问题,请改正main函数中的错误,使该程序的输出结果如下:
Constructor called.
Default constructor called.
Area is 6
Area is 0
Area is 6
源程序文件test1_1,cpp清单如下:
include<iostream.h>
class RectAngle
{
private:
double ledge,sedge;
public:
RectAngle()
{
cout<<"Default constructor called.";
}
RectAngle(double l,double s)
{
ledge=l;sedge=s;
cout<<"Constructor called.";
}
void Set(double l,double s)
{
ledge=l;sedge=s;
}
void Area()
{
cout<<"Area is"<<ledge*sedge<<endl;
}
};
void main()
{
/***************** found *****************/
RectAngle Rect1(2,3);
RectAngle Rect2(1);
/**************** found *****************/
RectAnglC Rect3;
Rectl.Area();
/***************** found *****************/
RecL2.lodge=0;Rect2.sedge=0;
Reck2.Area();
Rect3.Area();
}
第4题:
在J2EE中,下面的代码中出现编译错误的是()。
A.Filef=newFile("/","autoexec.bat");
B.DataInput Streamdin=new Data Input Stream(new File Input Stream("autoexec.bat"));
C.Input Stream Readerin=new Input Stream Reader(System.in);
D.Output Stream Writer out=new Output Stream Writer(System.in);
第5题:
A.1.unsigned,2.int,3.double
B.1.double,2.double,3.double
C.1.int,2.double,3.char
D.1.unsigned,2.double,3.int
第6题:
In C language, a ______ is a series of characters enclosed in double quotes.
A.matrix
B.string
C.program
D.stream
第7题:
以下程序的主函数中调用了在其面前定义的fun函数 #include<stdio.h> . . . main( ) {double a[15],k; k=fun(a); . . .
} 则以下选项中错误的fun函数首部是( )。 、
A.double fun(double a[l5])
B.double fun(double *a) 。
C.double fun(double a[])
D.double fun(double a)
第8题:
按Java语言规则,下列赋值语句中不合法的是( )。
A.float a=2.0
B.double b=2.0
C.int c=2
D.long d=2L
第9题:
若已定义 x和 y为double类型,则表达式: x=l, y=x+3/2结果是( )
A.l
B.2
C.2.0
D.2.5
第10题:
设有定义:char c;float f;int i;unsignedu;double d;下列各表达式的类型分别是()1.u+92.d!=f&&(i+2)3.8.2*i+c
第11题:
Given: Integer i = new Integer (42); Long l = new Long (42); Double d = new Double (42.0); Which two expression evaluate to true?()
第12题:
int same(int,double);double same(int,double);
int same1(int,double);int same2(int,double);
int same(int=0);int same(int);
int same(int,double);int same(int,double,double);
第13题:
有下列程序: int funl(double a){return a*=a;} int fun2(double x,double y) {double a=0,b=0; a=funl(x);b=funl(y);return(int)(a+b); } main( ) {double w;w=fun2(1.1,2.0),……} 程序执行后变量w中的值是( )。 、
A.5.21
B.5
C.5.0
D.0.0
第14题:
In C language,a _____ is a series of characters enclosed in double quotes。
A.matrix
B.string
C.program
D.stream
A.
B.
C.
D.
第15题:
what value is stored in m in the following assembly language code
fragment if n=7?
LDAA #n
LABEL1: CMPA #5
BHI L3
BEQ L2
DECA
BRA L1
LABEL2: CLRA
LABEL3: STAA #m
第16题:
字面常量42、4.2、42L的数据类型分别是( )。
A.long,double、int
B.lon9、float、int
C.int、double、long
D.int、float、long
第17题:
有如下两个类定义: class XX{ private: double xl; protected: double x2; public: double x3; }; class YY:protected XX{ private: double yl; protected: double y2; public: double y3; 在类YY中保护成员变量的个数是( )。
A.1
B.2
C.3
D.4
第18题:
有以下程序; int f1(double A) { return a*a; } int f2(double x,double y) { double a, b; a=n(x); b=f1(y); return a+b; } main() { double w; w=f2(1.1,2.0); ┇ } 变量w中的值是( )
A.5.21
B.5
C.5
D.0
第19题:
In C language, a(67) is a series of characters enclosed in double quotes.
A.matrix
B.string
C.program
D.stream
第20题:
A sequence of any number of characters enclosed in the double queotes“”is called a character ______.
A.array
B.group
C.set
D.string
第21题:
第22题:
以下正确的重载函数是()
第23题:
Which of the following statements are legal?()