Professional Documents
Culture Documents
A. L i biên d ch.
B. L i th c thi
C. Xu t hi n màn hinh: “Ma so: 001 Ten: Nguyen Van A Tuoi: 20”
D. Không hi n th gì trên màn hình.
Câu 15: Khi th c thi o n ch ng trình sau k t qu s là :
#include<iostream.h>
class Base{
public:
Base(){ cout<<”Base class”<<endl; }
};
class Derive:Base
{
public:
Derive(){ cout<<”Derive class”<<endl; }
};
void main(){
Derive d;
}
A. Base class
Derive class
B. Derive class
Base class
C. Base class
D. Derive class
void Print(){
for(int i=0; i<size; i++) cout<<" "<<elems[i];
}
Set Func(Set);
~Set() {delete []elems;}
};
Set Set::Func (Set s1 ){
Set s = s1;
return s;
}
void main(){
Set s(10);
Set s1= s.Func(s);
s.Print();
}
A. L i biên d ch B. L i th c thi
C. K t qu là : 0 1 2 3 4 5 6 7 8 9 D. Là m t k t qu khác
Câu 27:
1. #include<iostream.h>
2. template <class T> T max(T a, T b) {
3. if (a > b) return a;
4. return b;
5. }
6. float max (float fa, float fb) {
7. if (fa - fb >0) return fa;
8. return fb;
9. }
10. void main(){
11.
12. cout<<max(a,b);
13. }
Tìm 1 câu d i ây mà vào dòng 11 thì ch ng trình báo l i
Câu 28:
1. #include<iostream.h>
2. template <class T, class U>
3. void func (T a, U b){
4. cout<<a<<b ;
5. }
6. void main(){
7.
8. func(a,b);
9.}
Tìm 1 câu úng nh t d i ây mà vào dòng 7 thì ch ng trình không báo l i