2011-03-19 00:28:14|?次阅读|上传:wustguangh【已有?条评论】发表评论
27.读代码选择正确答案
class A { virtual void func1(); void func2(); } Class B: class A { void func1(){cout << "fun1 in class B" << endl;} virtual void func2(){cout << "fun2 in class B" << endl;} }
A, A中的func1和B中的func2都是虚函数.
B, A中的func1和B中的func2都不是虚函数.
C, A中的func2是虚函数.,B中的func1不是虚函数.
D, A中的func2不是虚函数,B中的func1是虚函数.
答:
A
---------------------------------------------------------------------
28.
数据库:抽出部门,平均工资,要求按部门的字符串顺序排序,不能含有"human resource"部门,employee结构如下:employee_id, employee_name, depart_id, depart_name, wage
答:
select depart_name, avg(wage) from employee where depart_name <> 'human resource' group by depart_name order by depart_name
---------------------------------------------------------------------
29.
给定如下SQL数据库:Test(num INT(4)) 请用一条SQL语句返回num的最小值,但不许使用统计功能,如MIN,MAX等
答:
select top 1 num from Test order by num desc
---------------------------------------------------------------------
30.
输出下面程序结果。
#include <iostream.h> class A { public: virtual void print(void) { cout<<"A::print()"<<endl; } }; class B:public A { public: virtual void print(void) { cout<<"B::print()"<<endl; }; }; class C:public B { public: virtual void print(void) { cout<<"C::print()"<<endl; } }; void print(A a) { a.print(); } void main(void) { A a, *pa,*pb,*pc; B b; C c; pa=&a; pb=&b; pc=&c; a.print(); b.print(); c.print(); pa->print(); pb->print(); pc->print(); print(a); print(b); print(c); }