有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static void print(sample s);};sample:: sample(int a){ x=a; y+=x;}void sample:: print(sample s){ cout<<"x="<<s. x<<",y="<<y<<end1;}int sample:: y=0;int main( ){ sample s1(10); sample s2(20); sample:: print(s2); return 0;}程序运行后的输出结果是( )。

A:x=10,y=20 B:x=20,y=30 C:x=30,y=20 D:x=30,y=30

对长度为10的线性表进行冒泡排序,最坏情况下需要比较的次数为 【1】

在树中,度为零的结点称为 【2】

按“先进先出”原则组织数据的数据结构是 【3】

数据结构分为线性结构和非线性结构,线性表、栈和队列都属于 【4】

冒泡排序算法在最好的情况下的元素交换次数为 【5】

若有整型变量x=2,则表达式x<<2的结果是 【6】

重载的运算符仍然保持其原来的操作数个数、优先级和 【7】 不变。

C++在重载运算中,如用成员函数重载一元运算符参数表中需要 【8】 个参数,如用友元函数重载一元运算符参数表中需要1个参数。

若有以下程序: #include <iostream> using namespace std; class Base { public: void who( ){ cout<<"Base"<<end1;} }; class Derivedl: public Base { public: void who( ) { cout<<"Derived"<<end1; } }; int main( ) { Base *p; Derived1 obj1; p=&obj1; p->who( ); return 0; } 则该程序运行后的输出结果是 【9】

微信扫码获取答案解析
下载APP查看答案解析