北方工业大学
第一章单元测试
  1. 下列哪个不是面向对象技术的特点( )

  2. A:抽象 B:多态 C:逻辑 D:封装
    答案:逻辑
  3. C++中关于class和struct的说法正确的是( )

  4. A:struct的成员默认是公有的,而类的成员默认是私有的 B:二者默认成员都私有的 C:二者默认成员都公有的 D:二者没有区别
    答案:struct的成员默认是公有的,而类的成员默认是私有的
  5. 有以下类的定义:
    class Ex{
    int x;
    public:
    void setx(int t=0);
    };
    若在类外定义成员函数setx(),以下定义形式中正确的是( )

  6. A:Ex::void setx(int t) { ... } B:void Ex::setx(int t) { ... } C:void Ex::setx(){ ... } D:void setx(int t) { ... }
    答案:void Ex::setx(int t) { ... }
  7. #include<stdio>
    class Test {
    int x;
    };
    int main()
    {
    Test t;
    printf(“%d”, t.x);
    return 0;
    }
    以上代码运行结果是( )

  8. A:编译错误 B:0 C:任意数值 D:x
    答案:编译错误
  9. 类就是c语言中的结构类型。( )

  10. A:错 B:对
    答案:错
  11. A member function can always access the data in ( )

  12. A:the object of which it is a member B:the class of which it is member C:the private part of its class D:the public part of its class
    答案:the class of which it is member
  13. What does your class can hold? ( )

  14. A:Both a & b B:Functions C:None of the mentioned D:Data
    答案:Both a & b
  15. What purpose do classes serve? ( )

  16. A:all of the above B:providing a convenient way of modeling real-world objects C:simplifying code reuse D:data encapsulation
    答案:all of the above
  17. Which of the following is a valid class declaration? ( )

  18. A:class A { int x; }; B:public class A { } C:class B { } D:object A { int x; };
    答案:class A { int x; };
  19. OOP stands for ( )

  20. A:Object to Object Programming B:Object Oriented Processes C:Online Objects Programming D:Object Oriented Programming
    答案:Object Oriented Programming

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(2) dxwkbang
返回
顶部