程序: class MyDate{ private int year; private int month; private int day; public MyDate(int year,int month,int day){ this.year=year; this.month=month; this.day=day; } //Override Method } 为了让new MyDate(1980,11,9)==new MyDate(1980,11,9) 返回true,必须在Override Method处覆盖哪个方法?()
第1题:
对于模板定义关键字class和typename说法不正确的是( )。
A.程序中的class并不能都替换为typename
B.class和typename都可互相替换
C.程序中的typename都能替换为Class
D.程序中的部分class可以替换为typename
第2题:
有如下程序:#include<iostream>using namespace std;class test{private: int a;public: test(){cout<<"constructor"<<endl;} test(int a){cout<<a<<endl;} test(const test&_test) { a=_test.a; cout<<"copy constructor"<<en+dl; } ~test(){cout<<"destructor"<<endl;}};int main(){ test A(3); rerun 0;}运行时输出的结果是
A.3
B.constructor destructor
C.copy constructor destructor
D.3 destructor
第3题:
以下程序段运行的结果为()
Private Sub Form_Click( )
MyTime = #9:21:30 PM#
MyDate = #7/21/1997#
Print Tab(2); Format(MyDate, "mmmm-yy")
Print Tab(2); Format(MyTime, "hh:mm:ss A/P")
End Sub
A.July-97 9:21:30 P
B.July-97 09:21:30 P
C.07-97 9:21:30 P
D.July-97 9:21:30
第4题:
有以下程序:
include<iostream>
using namespace std;
class Base
{
public:
Base()
{
K=0;
}
int x;
};
class Derivedl:virtual public Base
{
public:
Derivedl()
{
x=10;
}
};
class Derived2:virtua1 public Base
第5题:
下列程序实现对ZIP文件file.zip的检索,在横线处填入正确的语句( )。
A.en=zis.getNextEntry( )
B.en==zis.getNextEntry( )
C.en=zis.getEntry( )
D.zis.getNextEntry( )
第6题:
2下列程序实现对ZIP 文件file.zip 的检索,在横线处填入正确的语句是( )。package test;import java.io.*;import java.util.*; import java.util.zip.*;public class Exam{ public static void main(String[] args){ try{ FileInputStream fis = new FilelnputStream("test/file.zip"); ZipInputStream zis = new ZiplnputStream(fis); ZipEntry en; while ((______ )!= null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e){ e.pfintStackTrace(); }}
A.en = zis. getNextEntry()
B.en == zis.getNextEntry(
C.en=zis. getEntry()
D.zis.getNextEntry()
第7题:
以下程序的执行结果为______。
include<iostream>
using namespace std;
class base
{
public:
virtual void who()
{
cout<<"base class"<<endl;
}
};
class derivel:public base
{
public:
void who()
{
cout<<"d
第8题:
以下程序段运行的结果为()
Private Sub Form_Click( )
MyDate = #7/21/1997#
Print Format(MyDate, "dddd,mmmm,dd,yyyy")
End Sub
A.21,07,1997
B.21,07,21,1997
C.Monday,July,21,1997
D.Monday,07,21,1997
第9题:
有如下程序: #include<iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B<public:B(){cout<<"B";)); class C:public A { B b; public: C(){cout<<"C";} }; int main(){Cobj;retum 0;} 执行后的输出结果是
A.CBA
B.BAC
C.ACB
D.ABC
第10题:
有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE( ){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE