下列关于成员函数特征的描述中,错误的是( )。
A:成员函数一定是内联函数 B:成员函数可以重载 C:成员函数可以设置参数的默认值 D:成员函数可以是静态的
如有下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun(n-2)); else return 2; } int main( ) { cout<<fun(3)<<endl; return 0; } 则该程序的输出结果应该是( )。
A:2 B:3 C:4. D:5
下列函数的运行结果是( )。 #include<iostream.h> int f(int a,int b) { int c; if(a>b)c=1; else if(a==b)c=0; else c=-1; return(c);} void main( ) {int i=2,j=3; iht p=f(i,j); cout<<p;}
A:-1 B:1 C:2 D:编译出错,无法运行
对于模板定义关键字class和typename说法不正确的是( )。
A:程序中的class并不能都替换为typename B:class和typename都可互相替换 C:程序中的typename都能替换为Class D:程序中的部分class可以替换为typename
类MyClass的定如下,若要对value赋值,则下面语句正确的是( )。 class MyClass { public: MyClass( ){} MyClass(int i){value=new int(i);} int*value; };
A:MyClass my;mvalue=10; B:MyClass my;*mvalue=10; C:MyClass my;m*value=10; D:MyClass my(10);
在C++程序中,如果要求通过函数来实现一种简单的功能,并且要求尽可能加快序执行速度,则应该选用( )。
A:内联函数 B:重载函数 C:递归调用 D:嵌套调用
阅读以下程序 #include<iostream.h> void main( ) { charline[10]; in>>line; cout<<line<<endl; } 如运行时输入This is an example.<CR>,则程序的输出结果是( )。
A:This B:This is C:This is a D:This is an exampl
C++语言本身没有定义I/O操作,但I/O操作包含在C++实现中。C++标准库iostream提供了基本的I/O类。I/O操作分别由两个类istream和( )提供。
A:fstream B:iostream C:ostream D:cin
考虑以下的函数原型:void A(int a,int b=5,char Z='*');下面的函数调用中,不正确的是( )。
A:A(7) B:A(3,4) C:16,'#' D:A(O,2,'*
索引属于( )。
A:模式 B:内模式 C:外模式 D:概念模式