选择题 设有表示学生选课的3张表,学生S(学号、姓名、性别、年龄、身份证号)、课程C(课号、课名)、选课SC(学号、课号、成绩),则表SC的关键字(键或码)为______。
选择题 有如下程序:
# include<iostrcam>
# include<iomanip>
using namespace std;
int main(){
int s[]={123,234};
cout<<setfill('*')<<setw(6);
for(int i=0;i<2;i++){cout<<s[i]<<endl;}
return 0;
}
运行时的输出结果是______。
选择题 下列说法中错误的是______。
选择题 有如下程序段:
int i=1; int j=4;
int main() {
int i=5; j+=i;
cout<<i<<j<<endl;
}
运行时的输出结果是______
选择题 下列关于运算符重载的描述中,错误的是______。
选择题 下列代码段中声明了3个类:
class Person {};
class Student: public Person {};
class Undergraduate: Student {};
下列关于这些类之间关系的描述中,错误的是______。
选择题 下面程序的输出结果是______。
#include <iostream>
using namespace std;
int main()
{
int x;
for(int i=1; i<=100; i++){
x=i;
if(++x%2==0)
if(++x%3==0)
if(++x%7==0)
cout<<x<<',';
}
cout<<endl;
}
选择题 下面这个程序段的时间复杂度是 。
for (i=1; i<n; i++)
{
y=y+1;
for (j=0;j<=(2*n);j++)
x++;
}
选择题 类Base及其派生类Derived的定义如下:
class Base{
private:
int a;
public:
int b;
friend class Derived;
};
class Derived:public Base{
public:
void foo(){
a=0;//①
b=0;//②
}
};
则下列说法正确的是______。
选择题 以下程序的输出结果是 。
min()
{
int i=0,a=0;
while(i<20)
{
for(;;)
{
if((i%10)==0)break;
else i--;
}
i+=11;a+=i;
}
cout<<a<<endl;
}
选择题 有如下程序:
#include<iostream>
#include<string>
using namespace std;
class MyString{
public:
char str[80];
MyString(const char*s){strepy(str s);}
MyStringoperator+=(MyString a){
streat(str, a.str);
return*this;
}
};
ostream operator<<(ostream s, const MyString z){return<<z.str;}
int main(){
MyString x('abc'), y('cde');
cout<<(x+=y)<<endl;
return 0;
}
运行这个程序的输出结果是______。
选择题 下列关于类定义的说法中,正确的是______。
选择题 有如下类定义:
class B
{
public: void funl(){}
private: void fun2(){}
protected: void fun3(){}
};
class D: public B
{
protected: void fun4(){}
};
若obj是类D的对象,则下列语句中不违反访问控制权限的是______。
选择题 有如下类定义:
class Person{
public:
void SetAge(double val);
private:
double Age;
};
若要在类体外给出对成员函数SetAge的定义,下列选项中正确的是______。
选择题 下列语句段将输出字符'*'的个数为______。
int i=100;
while(1){
i--;
if(i==0) break;
cout<<'*';
}
选择题 下列程序的输出结果为 。
main()
{
int a=4,b=3,c=1,d
d=abb>c-!0;
cout<<d;
}
选择题 以下哪些不是程序调试的基本步骤______?
选择题 下列是重载乘法运算符的函数原型声明,其中错误的是 。
选择题 有下列程序:
#include <stdio.h>
void main()
{ int a=5,b=1,t;
t=(a<<2)|b;printf('%d\n',t);
}
程序运行后的输出结果是______。
选择题 下列关于运算符重载的描述中,错误的是______。