setSize(int width,int height)
setSize(int x,int y,int width,int height)
setSize(Dimension dim)
以上皆不是
第1题:
以下正确的函数原型语句是( )。
A、double fun(int x,int y)
B、double fun(int x;int y)
C、double fun(int,int);
D、double fun(int x,y);
第2题:
以下正确的函数原型语句是(48)。
A.double fun(int x,int y);
B.double fun(int x;int y);
C.double fun(int,int);
D.double fun(int x,y);
第3题:
下列函数定义中,会出现编译错误的是 ______。
A.max(int x,int y,int *z) { *z=x>y? x:y;}
B.int max(int x,y) {int z; z=x>y? x;y; return z; }
C.max(int x,int y) { int z; z=x>y? x:y; return(z); }
D.int max(int x,int y) { return(x>y?x:y);}
第4题:
下列函数定义中,会出现编译错误的是
A.max(int x,int y,int *z) { *z=x>y ? x:y; }
B.int max(int x,y) { int z; z=x>y ? x:y; return z; }
C.max(int x,int y) { int z; z=x>y?x:y; return(z); }
D.int max(int x,int y) { return(x>y?x:y); }
第5题:
有以下程序: #include <iostream> using namespace std; class A { private: int x,y; public: void set (int i,int j) { x=i; y=j; } int get_y() { return y; } }; class box { private: int length,width; A label; public: void set(int 1,int w, int s,int p) { length=1; width=w; label.set(s,p); } int get_area() { return length*width; } }; int main() { box small; small.set(2,4,1,35); cout<<small.get_area()<<end1; return 0; } 运行后的输出结果是( )。
A.8
B.4
C.35
D.70
第6题:
在一个VC编写的对话框应用程序中,对话框的OnInitDialog事件函数里面最后有这么一段程序:
int scx = ::GetSystemMetrics(SM_CXSCREEN);
int scy = ::GetSystemMetrics(SM_CYSCREEN);
CRect myrect;
GetWindowRect(&myrect);
int fromx = (scx - myrect.Width())/2;
int fromy = (scy - myrect.Height())/2;
SetWindowPos(NULL,fromx,fromy,myrect.Width(),myrect.Height(),SWP_NOZORDER);
请描述其作用,你觉得这段程序在方式、效率上是否能进行提高,如果能,请说明方法。
第7题:
下列带缺省值参数的函数说明中,正确的说明是 ______。
A.int Fun(int x, int y=2,int z=3);
B.int Fun(int x=1,int y,int z=3);
C.int Fun(int x, int y=2,iht z);
D.int Fun(int x=1,int y, int z=3);
第8题:
给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A }
第9题:
组件的setSize()方法签名正确的是哪项?()
第10题:
在下面C语言的函数说明语句中,正确的是()。
第11题:
setSize(intwidth,intheight)
setSize(intx,inty,intwidth,intheight)
setSize(Dimensiondim)
以上皆不是
第12题:
setSize(int width,int height)
setSize(int x,int y,int width,int height)
setSize(Dimension dim)
以上皆不是
第13题:
使用VC6打开考生文件夹下的工程test42_1,此工程包含一个源程序文件test42_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为:
rect area: 12
rectb area: 30
源程序文件test42_1.cpp清单如下:
include <iostream.h>
class CRectangle
{
/***************** found *****************/
int *width, height;
public:
CRectangle (int,int);
~CRectangle ();
int area (void) {return (*width * *height);}
};
CRectangle::CRectangle (int a, int b)
{
width = new int;
height = new int;
/***************** found *****************/
width = a;
*height = b;
}
CRectangle::~CRectangle ()
{
delete width;
delete height;
}
/***************** found *****************/
void main ()
{
CRectangle rect (3,4), rectb (5,6);
cout << "rect area: "<< rect.area() << endl;
cout << "rectb area: "<< rectb.area() << endl;
return 0;
}
第14题:
指出下面程序段中的错误,并说明出错原因【 】。
class Location {
int X, Y=20;
protected:
int zeroX, zeroY;
int SetZero(int ZeroX, iht ZeroY);
private:
int length, height;
public:
float radius;
void init(int initX,int initY);
int GetX();
Int GetY();
};
第15题:
下面是一个Applet程序,程序的功能输出一个彩色窗体。请改正程序中的错误(有下划线的语句),使程序能输出正确结果。
注意:不改动程序的结构,不得增行或删行。
程序的输出结果为:

import java.awt.*;
import java.awt.image.*;
import java.applet.Applet;
public class MemoryImage extends Applet
{
Image IMG nClick=over(this) title=放大;
public void init()
{
Dimension d=getSize();
int w=d.width,h=d.height;
int pix[ ]=new int[w*h];
int index=0;
for(int y=0;y<h;y++)
for(int x=0;x<w;x++)
{
int red=(x|y)&&0xff;
int green=(x*2|y*2)&0xff;
int blue=(x*4|y*4)&0xff;
pix[index++]=(255<<24)|(red<<16)|(green<<8)|blue;
}
IMG nClick=over(this) title=放大=createImage(new FilteredImageSource(w,h,pix, 0,w));
}
public void paint(Graphics g)
{
g.drawImage(IMG nClick=over(this) title=放大, 0,0,super);
}
}
ex36_3.html:
<html>
<head>
<title>A Simple Program</title>
</head>
<body>
<applet code=" MemoryImage.class" width=800 height=400>
</applet>
</body>
</html>
第16题:
有关绘图,下面的说法正确的是( )。 Ⅰ:drawArt(int x,int y,int width,int height,ing stanAngle,int arcAngle)是用来指定在矩形的边界内从起始角度到结束角度之间画弧。 Ⅱ:drawLine(int x1,int y1,int x2,int y2)用来绘制从点(x1,y1)到(x2,y2)的线段。当计算出线段上点的坐标不是整数时,向该点的右下方取整。 Ⅲ:drawRet(int x,int y,int width,int height)绘制指定矩形的轮廓。 Ⅳ:drawPloygon(Polygon p)绘制由特定的点指定的多边形。
A.Ⅱ、Ⅲ
B.Ⅱ、Ⅲ、Ⅳ
C.Ⅰ、Ⅱ
D.Ⅰ、Ⅲ、Ⅳ
第17题:
请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,该工程中包含一个程序文件 main.cpp,其中有类CPolygon(“多边形”)、CRectangle(“矩形”)、CTriangle(“三角形”)的定义。请在横线处填写适当的代码并删除横线,以实现上述类定义。该程序的正确输出结果应为: 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。 include<lostream> {tout<<——<<endl;} class CRectangle:public CPolygon{ CRe&angle(int w,int h):width(w),height(h){} int area(void){return(width *height);} class CTriangle:public CPolygon{ int length;//三角形一边长 int height;//该边上的高 public: CTriangle(int l,int h):length(1),height(h){} //*********found********* int area(void){return(——)/2;} }; int main{ CRectangle rect(4,5); CTriangle trgl(4,5); //*********found********* ______ *ppolyl,* ppoly2; ppolyl=&rect; ppoly2=&trgl; ppolyl->printarea; ppoly2->printarea; retun 0;
(1)virtual int area(void)=0;
(2)area
(3)length*height
(4)CPolygon
第18题:
下列函数定义不正确的是 ( )
A.int max { int x y,z; z=x>y? x: y }
B.int max(x,y) int x,y; { int z; z=x>y? x:y; return(z) }
C.int max(x,y) { int x,y z; z=x>y? x: y; return(z); }
D.int max( ) {}
第19题:
下面给出的四个关于函数定义形式中,正确的是()。
第20题:
下列方法中哪个方法是Sprite类中用来设置对准点的方法:()
第21题:
以下正确的函数定义形式是()。
第22题:
double FUN(int x;int y)
double FUN(int x,int y)
double FUN(int x,int y);
double FUN(int x,y)
第23题:
public int cal(int x,int y,float z){return 0;}
public int cal(int x,int y,int z){return 0;}
public void cal(int x,int z){}
public viod cal(int z,int y,int x){}
第24题:
struct ord{int x;int y;int z;};struct ord a;
struct ord{int x;int y;int z;}struct ord a;
struct ord{int x;int y;int z;}a;
struct {int x;int y;int z;}a;