class A{public static int max(int a,int b){return a>b?a:b;}public static void main(Stri
class A{
public static int max(int a,int b){
return a>b?a:b;
}
public static void main(String args[]){
System.out.println(“max=”+max(5,23));
}
}
class A{
public static int max(int a,int b){
return a>b?a:b;
}
public static void main(String args[]){
System.out.println(“max=”+max(5,23));
}
}
第1题
A.abstract class Cat: Animal
{
abstract public void Move();
}
B.abstract class Cat: Animal
{
virtual public void Move(){Console.Write(Console.Write("Move!");)}
}
C.abstract class Cat: Animal
{
public void Move(){Console.Write(Console.Write("Move!");)};
}
D.abstract class Cat: Animal
{
public void Eat(){Console.Write(Console.Write("Eat!");)};
}
第2题
A.0
B.1
C.2
D.4
第3题
/****************** 文件shape.h*************************/
const float PI=3.14159f; // 定义圆周率常量
class Shape // 几何图形抽象类
{
public:
virtual float GetPerimeter()=0; // 纯虚函数,计算周长
virtual float GetAre()=0; // 纯虚函数,计算面积
};
class Rectangle: public Shape // 矩形类
{
public:
Rectangle (float len,float wid):length(len),width(wid){}
~Rectangle (){}
float GetPerimeter() {return 2*(length width);} // 计算矩形周长
float GetAre() {return length*width;} // 计算矩形面积
private:
float length, width; // 矩形的长和宽
};
class Circle: public Shape // 圆类
{
public: // 在下面编写每个成员函数
private:
float rad; // 圆的半径
};
class Square: public Rectangle // 正方形类
{
public:
Square(float len): Rectangle(len,len){}
~Square(){}
};
第4题
仔细阅读下面的程序,判断有几处错误。()import android.os.Bundle; public class HelloActivity{ public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.xx); } }()
A.1
B.2
C.3
D.4
第5题
class A
{
int a;
A(int b)
{a=b;}
void show()
{System.out.println(“a=”+a);}
}
public class Class1
{
public static void main (String args[])
{
A bj=new A(12345);
boolean b=false;
char ch=97;
obj.show();
System.out.println(“b=”+b+”/tch=”+ch);
}
}
第6题
写出以下程序的运行结果。public class Test2 {public static void main(String args[ ]){int i,j;int a[]={17,91,65,35,28};for (i = 0; i < a.length-1; i++ ) {int k = i;for(j = i; j < a.length; j++ )if (a[j]>a[k] )k = j;int temp =a[i];a[i] = a[k];a[k] = temp;}for (i =0; i<a.length; i++ )System.out.print(a[i]+" ");System.out.println();} }
第7题
A.第4行的方法
B.第3行的方法
C.第6行的方法
D.第7行的方法
第8题
若有以下程序:
#include using namespace std ; class Point { int x, y; public :
Point () { x = 0; y = 0; } void SetPoint (int x1, int y1) { x = x1; y = y1; } void DisPoint () { cout << "x=" << x << "," << "y=" << y << endl ; } }; int main() { Point * p = new Point ; p-> SetPoint (5, 12); p-> DisPoint (); delete p; return 0; } 上面程序的输出结果为:
第9题
The mother decided that she would herself have to get her sons to do better in school.She told them to go to the Detroit Public Library to read a book a week and do a book report for her.
One day, in Ben's ___2___, the teacher held up a rock and asked if anyone knew it.Ben put up his hand and the teacher let him ___3___."Why did Ben put up his hand?" his classmates wondered."He never said anything.What could he possibly want to say?"
Well, Ben not only ___4___ the rock, but also said a lot about it.He named other rocks in its group and even knew where the teacher had found it.The teacher and the students were surprised.Ben had learned all this from doing one of his book reports.
Ben later went on to the ___5___ of his class.When he finished high school, he went to Yale University and at last became one of the best doctors in the United States.
1、A.top
B.slow
C.class
D.answer
E.knew
2、A.top
B.slow
C.class
D.answer
E.knew
3、A.top
B.slow
C.class
D.answer
E.knew
4、A.top
B.slow
C.class
D.answer
E.knew
5、A.top
B.slow
C.class
D.answer
E.knew
第10题
A.java
B.class
C.java
D.class