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

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

教材学习内容总结

1.各类循环判断语句:if,while,switch,for
2.循环语句的嵌套

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

  • 问题1:迭代器的概念不太理解
  • 问题1解决方案:通过查找网上的资料找到了对迭代器的解释:就是提供一种方法对一个容器对象中的各个元素进行访问,而又不暴露该对象容器的内部细节。(和接口一起理解)
  • 问题2:for循环的嵌套有些难以理解
  • 问题2解决方案:通过实际操作弄懂了for语句嵌套的应用

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

  • 问题1:在做PP5.3的时候出现了无限循环的情况
  • 问题1解决方案:一开始我以为是外循环的问题,后然发现是我自己做的内循环出现问题,我的解决方案是加break语句

[代码托管](https://gitee.com/CS-IMIS-23/20172307java.git

)

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

上周考试错题总结

  • The behavior of an object is defined by the object's
    A . instance data
    B . constructor
    C . visibility modifiers
    D . methods
    E . all of the above
    正确 :D
  • The relationship between a class and an object is best described as
    A . classes are instances of objects
    B . objects are instances of classes
    C . objects and classes are the same thing
    D . classes are programs while objects are variables
    E . objects are the instance data of classes
    正确:B
    对象是类的实例。
  • In order to preserve encapsulation of an object, we would do all of the following except for which one?
    A . Make the instance data private
    B . Define the methods in the class to access and manipulate the instance data
    C . Make the methods of the class public
    D . Make the class final
    E . All of the above preserve encapsulation
    正确:D
    A选项实例数据私人化对保护私有性没有用
  • A variable whose scope is restricted to the method where it was declared is known as a(n)
    A . parameter
    B . global variable
    C . local variable
    D . public instance data
    E . private instance data
    正确 : D
    公共实例数据的定义。
  • A class' constructor usually defines
    A . how an object is initialized
    B . how an object is interfaced
    C . the number of instance data in the class
    D . the number of methods in the class
    E . if the instance data are accessible outside of the object directlyc
    正确: A
    构造函数定义了对象是如何初始化的

其他(感悟、思考等,可选)

在做PP5.7的时候遇到了不少麻烦,循环嵌套上出了很多错误,积累经验吧。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 200/200 2/2 20/20
第二周 300/500 2/4 18/38
第三周 500/1000 3/7 22/60
第四周 300/1300 2/9 30/90

参考资料

原文地址:https://www.cnblogs.com/20172307hyt/p/8783588.html