2024年9月GESP编程能力认证C++等级考试试卷五级真题(含答案).docxVIP

  • 1
  • 0
  • 约5.91千字
  • 约 9页
  • 2026-02-06 发布于山东
  • 举报

2024年9月GESP编程能力认证C++等级考试试卷五级真题(含答案).docx

2024年9月GESP编程能力认证C++等级考试试卷五级真题(含答案)

姓名:__________考号:__________

题号

总分

评分

一、单选题(共10题)

1.以下哪个选项是C++中的逻辑运算符?()

A.

B.||

C.

D.|

2.在C++中,如何定义一个整型常量?()

A.intconstant=10;

B.constintconstant=10;

C.#defineCONSTANT10;

D.alloftheabove

3.以下哪个函数可以用来检查一个字符串是否以指定的子串开始?()

A.startsWith()

B.beginsWith()

C.startWith()

D.alloftheabove

4.在C++中,以下哪个是正确的函数重载示例?()

A.voidfunc(intx);voidfunc(doublex);

B.voidfunc(intx);voidfunc(floatx);

C.voidfunc(intx);voidfunc(doublex,inty);

D.voidfunc(intx);voidfunc(floatx);

5.在C++中,以下哪个是正确的引用传递方式?()

A.voidfunc(intx);

B.voidfunc(intx);

C.voidfunc(intx){x=10;}

D.voidfunc(int*x);

6.在C++中,以下哪个是正确的构造函数声明?()

A.classMyClass{MyClass(intx);};

B.classMyClass{MyClass(intx)=default;};

C.classMyClass{MyClass(intx):x(x){};};

D.alloftheabove

7.在C++中,以下哪个是正确的析构函数声明?()

A.~MyClass();

B.classMyClass{~MyClass(intx);};

C.classMyClass{~MyClass(){};};

D.alloftheabove

8.在C++中,以下哪个是正确的虚函数声明?()

A.virtualvoidfunc();

B.virtualfunc();

C.virtualvoidfunc(intx);

D.virtualfunc(intx);

9.在C++中,以下哪个是正确的异常处理方式?()

A.try{throwerror;}catch(intx){std::coutx;}

B.try{throwerror;}catch(constchar*x){std::coutx;}

C.try{throwerror;}catch(std::stringx){std::coutx;}

D.try{throwerror;}catch(intx){std::coutx;}

10.在C++中,以下哪个是正确的模板函数声明?()

A.templatetypenameTvoidfunc(Tx);

B.templatetypenameTvoidfunc(Tx){returnx;}

C.templatetypenameTvoidfunc(Tx)=default;

D.alloftheabove

11.在C++中,以下哪个是正确的范围for循环声明?()

A.for(inti:arr);

B.for(inti=0;iarr.size();i++);

C.for(autoi=arr.begin();i!=arr.end();++i);

D.alloftheabove

二、多选题(共5题)

12.在C++中,以下哪些是合法的运算符?()

A.+

B.=

C.

D.instanceof

E.-

13.以下哪些是C++中的标准库容器?()

A.vector

B.list

C.map

D.set

E.string

14.在C++中,以下哪些是构造函数的特性?()

A.有相同的名字和类名

B.可以有参数

C.在创建对象时自动调用

D.可以没有返回类型

E.可以返回值

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档