A. have taught
B. have been taught
C. has taught
D. had been taught
第1题:
在下向程序和横线处填上适当的内容,使程序执行后的输出结果为1/2005。
include <iostream>
using namespace std;
class Date
{
public:
Date(int m=1,int y=0):month(m),year(y){}
void Print() {cout<<month<<"/"<<year<<end 1; }
【 】 operator+(eonst Date& d1, const Date& d2);
private:
int month,year;
};
【 】 operator+(const Date& d1, const Date& d2)
{
int year,month;
year=d1.year+d2.year;
month=d1. month+d2.month;
year+=(month-1 )/12;
month=(month-1 )% 12+1;
return Date(month,year);
}
void main()
Date d1 (3,2004),d2,d3(10);
d2=d3+d1;
d2,Print();
}
第2题:
已知last指向单向简单链表的尾结点,将s所指结点加在表尾,不正确的操作是____。
A.last->next=s,last=s,last->next=NULL;
B.last->next=s,s->next=NULL,last=s;
C.s->next=NULL, last->next=s, s=last;
D.s->next=NULL, last->next=s,last=s;
第3题:
已知last指向单向简单链表的尾结点,将s所指结点插入在表尾,正确的操作是____。
A.s->next=s,last=s,last->next=NULL;
B.last->next=s,s->next=NULL,last=s;
C.s->next=NULL, last->next=s, s=last;
D.s->next=last, last->next=NULL,last=s;
第4题:
有以下程序: class Date { public: Date(int y, int m, int d); year = y; month = m; day = d; Date(int y = 2000) year = y; month = 10; day = 1; Date(Date &d) { year = d.year; month = d.month; day = a.day; } void print() cout<<year<<"."<<month<<"."<<day<<end1; } private: int year, month,day; }; Date fun(Date d) Date temp; temp = d; return temp; } int main() { Date date 1 (2000,1,1),date2(0,0,0); Date date3(date 1); date2 = fun(date3); return 0; } 程序执行时,Date 类的拷贝构造函数被调用的次数是
A.2
B.3
C.4
D.5
第5题:
7、已知last指向单向简单链表的尾结点,将s所指结点加在表尾,正确的操作是____。
A.s->next=s,last=s,last->next=NULL;
B.last->next=s,s->next=NULL,last=s;
C.s->next=NULL, last->next=s, s=last;
D.s->next=last, last->next=NULL,last=s;
第6题:
已知last指向单向简单链表的尾结点,将s所指结点加在表尾,正确的操作是____。
A.s->next=s,last=s,last->next=NULL;
B.last->next=s,s->next=NULL,last=s;
C.s->next=NULL, last->next=s, s=last;
D.s->next=last, last->next=NULL,last=s;