文库 真题 GESP真题

2024年6月GESP认证C++编程六级真题试卷及答案

gesp真题 c++真题 少儿编程题库 PDF   12页   下载1   2024-06-29   浏览195   收藏0   点赞0   评分-   9837字   免费文档
温馨提示:当前文档最多只能预览 2 页,若文档总页数超出了 2 页,请下载原文档以浏览全部内容。
2024年6月GESP认证C++编程六级真题试卷及答案 第1页
2024年6月GESP认证C++编程六级真题试卷及答案 第2页
剩余10页未读, 下载浏览全部
题号123456789101112131415 答案DBABBAACAAADCAC C++ 六级 2024 年 06 月 1单选题(每题 2 分,共 30 分) 第 1 题 面向对象的编程思想主要包括( )原则。 A. 贪心、动态规划、回溯 B. 并发、并行、异步 C. 递归、循环、分治 D. 封装、继承、多态 第 2 题 运行下列代码,屏幕上输出( )。 A. 1 1 1 #include <iostream> using namespace std; class my_class { public:    static int count;    my_class() {        count++;   }    ~my_class() {        count--;   }    static void print_count() {       cout  << count << " ";   } }; int my_class::count = 0; int main() {    my_class obj1;    my_class::print_count();    my_class obj2;    obj2.print_count();    my_class obj3;    obj3.print_count();    return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 B. 1 2 3 C. 1 1 2 D. 1 2 2 第 3 题 运行下列代码,屏幕上输出( )。 #include <iostream> using namespace std; class shape { protected:    int width, height; public:    shape(int a = 0, int b = 0) {        width = a;        height = b;   }    virtual int area() {        cout << "parent class area: " <<endl;        return 0;   } }; class rectangle: public shape { public:    rectangle(int a = 0, int b = 0) : shape(a, b) { }    int area () {        cout << "rectangle area: ";        return (width * height);   } }; class triangle: public shape { public:    triangle(int a = 0, int b = 0) : shape(a, b) { }    int area () {        cout << "triangle area: ";        return (width * height / 2);   } }; int main() {   shape *pshape;   rectangle rec(10, 7);   triangle  tri(10, 5);   pshape = &rec;   pshape->area();   pshape = &tri;   pshape->area();   return 0; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 A. rectangle area: triangle area: B. parent class area: parent class area: C. 运行时报错 D. 编译时报错 第 4 题 向一个栈顶为hs的链式栈中插入一个指针为s的结点时,应执行( )。 A. hs->next
GESP 6月认证 C++ 六级真题,2024年6月GESP认证C++编程六级真题试卷及答案,gesp真题,c++真题,少儿编程题库
下载提示

下载及版权说明:6547网文库内容来自网络及各平台公开内容(属于用户上传,不保证正确性,只做参考),旨在帮助同学们学习少儿编程相关知识及内容,仅限内部学习及使用,以分享为主,下载本文档之后请合法使用相关、真题、素材、课件、教程等内容,若内容存在侵权,请进行 举报 及查看 免责声明