中南大学网络教育学院C++程序设计网上作业模拟试卷及答案.docxVIP

  • 1
  • 0
  • 约5.13千字
  • 约 11页
  • 2026-03-14 发布于北京
  • 举报

中南大学网络教育学院C++程序设计网上作业模拟试卷及答案.docx

中南大学网络教育学院C++程序设计网上作业模拟试卷及答案

考试时间:______分钟总分:______分姓名:______

1.C++中,用于定义浮点型变量的关键字是()

A.int

B.float

C.char

D.bool

2.在C++中,以下哪个运算符的优先级最高?()

A.+

B.*

C.=

D.++

3.类的成员默认访问权限是()

A.public

B.private

C.protected

D.friend

4.用于动态释放内存的关键字是()

A.malloc

B.free

C.new

D.delete

5.以下哪个是C++的基本数据类型?()

A.string

B.int

C.vector

D.array

6.在循环结构中,用于跳过本次循环的关键字是()

A.break

B.continue

C.return

D.exit

7.函数参数传递中,值传递的特点是()

A.形参改变影响实参

B.形参改变不影响实参

C.必须使用引用符号

D.只能用于指针参数

8.C++中,用于定义静态变量的关键字是()

A.const

B.static

C.volatile

D.register

9.以下哪个是正确的字符串定义?()

A.stringstr=hello;

B.stringstr(h,e,l,l,o);

C.stringstr={h,e,l,l,o};

D.stringstr(hello);

10.继承时,子类可以访问父类的()成员。

A.public

B.private

C.protected

D.以上都是

11.C++中,用于输入输出的头文件是______。

12.在函数中,使用______关键字可以提前结束函数执行。

13.指针变量p指向数组arr时,*(p+1)表示______。

14.析构函数的名字与类名______,且无返回值。

15.文件操作中,用于打开文件的函数是______。

16.给出以下代码,写出输出结果:

```cpp

#includeiostream

usingnamespacestd;

intmain(){

intx=3;

inty=x++;

coutxyendl;

return0;

}

```

17.分析以下代码,问输出是什么:

```cpp

#includeiostream

usingnamespacestd;

intadd(inta,intb){

returna+b;

}

intmain(){

int(*p)(int,int)=add;

coutp(2,3)endl;

return0;

}

```

18.给出以下类定义,写出创建对象后的输出:

```cpp

#includeiostream

usingnamespacestd;

classBox{

public:

Box(intw,inth){

width=w;

height=h;

}

intarea(){

returnwidth*height;

}

private:

intwidth;

intheight;

};

intmain(){

Boxb(4,5);

coutb.area()endl;

return0;

}

```

19.以下代码有错误,请指出并改正:

```cpp

#includeiostream

usingnamespacestd;

classCircle{

public:

Circl

文档评论(0)

1亿VIP精品文档

相关文档