20172315 2017-2018-2 《程序设计与数据结构》第八周学习总结

学号 2017-2018-2 《程序设计与数据结构》第八周学习总结

教材学习内容总结

  • 后绑定对于多态性的引用要延迟到程序运行时才能执行。
  • 后绑定的效率低于编译阶段的绑定效率
  • 继承可用来实现多态性
  • 接口可用于实现多态性
  • 选择排序通过比较大小交换位置实现排序
  • 插入排序通过比较大小依次挪动位置实现排序
  • 选择排序和插入排序都有n方的效率
  • 线性搜索不需要有序的数组,依次逐个进行搜索
  • 二分搜索需要有序的数列,进行二分搜索
  • 二分搜索效率高于线性搜索

教材学习中的问题和解决过程

  • 问题1:对于书上的Speaker current = new Philosopher();语句不太懂其中含义
  • 问题1解决方案:该语句是将Philosopher对象指向Speaker接口引用变量。
  • 问题2:如果二分搜索的对象是偶数的话该如何进行
  • 问题2解决方案:老师课堂讲解后知道是取2个中点的第一个进行二分搜索

代码调试中的问题和解决过程

  • 问题1:XXXXXX
  • 问题1解决方案:XXXXXX
  • 问题2:XXXXXX
  • 问题2解决方案:XXXXXX
  • ...

代码托管

(statistics.sh脚本的运行结果截图)

上周考试错题总结

  • 错题1及原因,理解情况
    If a programmer writes a class wanting it to be extended by another programmer, then this programmer must
    A . change private methods and instance data to be protected
    B . change public methods and instance data to be protected
    C . change all methods to be protected
    D . change the class to be protected
    E . none of the above, the programmer does not have to change anything
    正确答案: A
    你的答案: C
    protected的项目可由定义它们的类的任何子类访问,而private项不能被任何其他类访问。
  • 错题2及原因,理解情况
    Abstract methods are used when defining
    A . interface classes
    B . derived classes
    C . classes that have no constructor
    D . arrays
    E . classes that have no methods
    正确答案: A
    你的答案: B
    接口是一个定义了它的一些组件的类,但是会留下其他方法以供实现。
  • 错题3及原因,理解情况
    Which of the following is true regarding Java classes?
    A . All classes must have 1 parent but may have any number of children (derived or extended) classes
    B . All classes must have 1 child (derived or extended) class but may have any number of parent classes
    C . All classes must have 1 parent class and may have a single child (derived or extended) class
    D . All classes can have any number (0 or more) of parent classes and any number of children (derived or extended) classes
    E . All classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
    正确答案: A
    你的答案: E
    Java支持继承,但不支持多重继承,所以Java类可以有任意数量的子类元素,但只有一个父类元素。
  • 错题4及原因,理解情况
    A derived class has access to all of the methods of the parent class, but only the protected or public instance data of the parent class.
    A . true
    B . false
    正确答案: B
    你的答案: A
    由于方法也可以声明为private,任何private方法都不能被派生类访问。
  • 错题5及原因,理解情况
    Using the reserved word, super, one can
    A . access a parent class'constructor(s)
    B . access a parent class'methods and instance data
    C . access a child class'constructor(s)
    D . access a child class'methods and instance data
    E . none of the above
    正确答案: E
    你的答案: B
    super保留字提供了访问父类的方法和实例数据(不管它们是否隐藏)的机制。 另外,可以使用super访问父类的构造器。

    结对及互评

点评模板:

  • 博客中值得学习的或问题:
    • xxx
    • xxx
    • ...
  • 代码中值得学习的或问题:
    • xxx
    • xxx
    • ...
  • 基于评分标准,我给本博客打分:XX分。得分情况如下:xxx

点评过的同学博客和代码

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 200/200 2/2 20/20
第二周 287/481 2/4 18/38
第三周 320/801 3/7 22/60
第四周 900/1600 2/9 30/90
第五周 807/2407 2/11 40/130
第六周 619/3023 2/13 40/170
第七周 621/3644 2/15 40/210
第八周 805/4364 2/17 40/250

参考资料

猜你喜欢

转载自www.cnblogs.com/huzhitao/p/8977512.html