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

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

教材学习内容

  • 数组是一个含有多个值的列表,数组中每个值都有带有编号的位置(索引),索引从0开始。
  • 数组的声明形式,如 int[] height = new int[11].
  • 数组边界检查方法:使用length常量。它保存了数组长度,是公有常量。
  • int[] grade;与int grades[];等价
  • 可以使用省略号的形式来表示该方法接受的参数是可变的。
  • 二维数组表达形式,如int[] [] table = new int [5] [10]

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

  • 问题1:不太清楚边界检查的概念
  • 问题1解决方案:查询资料后得知“边界检查在程序设计中是指在使用某一个变量前,用来检查该变量是否处在一个特定范围之内的过程。”
  • 问题2:对二位数组理解不是很深刻
  • 问题2解决方案:查询百度后得到以下概念:数组的数组---二维数组的每一个元素是一个一维数组。参考资料

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

  • 问题1:依旧是习惯性的掉符号

  • 问题1解决方案:只能写完代码之后多多检查

  • 问题2:在写pp8.1时发生变量冲突的情况

  • 问题2解决方案:去掉其中一个int即解决

  • 问题3:在写pp8.1时发生了main线路异常的情况

  • 问题3解决:在仔细检查后修改了main方法
  • 问题4:写pp8.1时使用了if-else语句,但不小心用“{”把它们隔开了。
  • 问题4解决:去掉“{”即恢复正常。
  • 问题5:错误的使用了break语句
  • 问题5解决:仔细看教材后发现循环语句要尽量避免使用break

代码托管

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

上周考试错题总结

  • 错题1及原因,理解情况
    Assume that count is 0, total is 20 and max is 1. The following statement will do which of the following? if (count != 0 && total / count > max) max = total / count;
    A . The condition short circuits and the assignment statement is not executed
    B . The condition short circuits and the assignment statement is executed without problem
    C . The condition does not short circuit causing a division by zero error
    D . The condition short circuits so that there is no division by zero error when evaluating the condition, but the assignment statement causes a division by zero error
    E . The condition will not compile because it uses improper syntax
    正确答案: A
    你的答案: D
    由于count为0,(count!= 0)为false。 由于&&条件的左侧为假,因此条件短路,因此不评估右侧。 因此,避免了零误差的潜在除法。 由于条件为false,因此不会执行max = total / count语句,从而避免可能的零点错误除法。
  • 错题2及原因,理解情况
    Which of the following are true statements about check boxes?
    A . they may be checked or unchecked
    B . radio buttons are a special kind of check boxes
    C . they are Java components
    D . you can control whether or not they will be visible
    E . all of the above
    正确答案: E
    你的答案: C
    有关复选框的四个陈述中的每一个都是真实的。
  • 错题3及原因,理解情况
    When comparing any primitive type of variable, == should always be used to test to see if two values are equal.
    A . true
    B . false
    正确答案: B
    你的答案: A
    int,short,byte,long,char和boolean都是如此,但不是double或float变量。 如果正在测试两个双变量x和y,则(x == y)只有在它们完全等于最后一个小数点时才为真。 通常是比较这两个值,但允许值有小的差异。 例如,如果THETA = 0.000001,我们可以通过(x-y <= THETA)而不是(x == y)来检验x和y,以更好地了解它们是否足够接近以被认为是相等的。
  • 错题4及原因,理解情况
    The statement if (a >= b) a++; else b--; will do the same thing as the statement if (a < b) b--; else a++;.
    A . true
    B . false
    正确答案: A
    你的答案: B
    如果我们逆转条件,我们可以反转if子句和else子句。 (a> = b)的相反条件是(a <b),所以这在逻辑上是可行的。 请注意,如果我们使用条件(a <= b),那么生成的语句将不会像原始的那样执行与a == b相同的操作。
  • 错题5及原因,理解情况
    You might choose to use a switch statement instead of nested if-else statements if
    A . the variable being tested might equal one of several hundred int values
    B . the variable being tested might equal one of only a few int values
    C . there are two or more int variables being tested, each of which could be one of several hundred values
    D . there are two or more int variables being tested, each of which could be one of only a few values
    E . none of the above, you would never choose to use a switch statement in place of nested if-else statements under any circumstance
    正确答案: B
    你的答案: A
    switch语句只能在被测试的单个变量使用时使用,并且它是一个整型(int或Java中的char)。 此外,因为您必须枚举每个可能的测试值,所以switch语句只有在被测试值的数量很小时才有意义。
  • 错题6及原因,理解情况
    If a switch statement is written that contains no break statements whatsoever,
    A . this is a syntax error and an appropriate error message will be generated
    B . each of the case clauses will be executed every time the switch statement is encountered
    C . this is equivalent to having the switch statement always take the default clause, if one is present
    D . this is not an error, but nothing within the switch statement ever will be executed
    E . none of the above
    正确答案: E
    你的答案: B
    虽然写这样一个转换语句是不寻常的,但它是完全合法的。 开关语句执行的正常规则适用于在计算开关表达式后执行的匹配的case子句。 之后,依次执行所有后续子句,因为没有终止开关/大小写执行的中断语句。
  • 错题7及原因,理解情况
    A continue statement
    A . may be used within a while or a do-while loop, but not a for loop
    B . is identical to a break statement within Java loops
    C . may be used within any Java loop statement
    D . may be used within a for loop, but not within a while or a do-while loop
    E . none of the above
    正确答案: C
    你的答案: E
    尽管应该避免使用continue语句,但是如果可能的话,它们可以在Java的三个循环中使用:for,while和do-while。

结对及互评

评分标准

  1. 正确使用Markdown语法(加1分):

    • 不使用Markdown不加分
    • 有语法错误的不加分(链接打不开,表格不对,列表不正确...)
    • 排版混乱的不加分
  2. 模板中的要素齐全(加1分)

    • 缺少“教材学习中的问题和解决过程”的不加分
    • 缺少“代码调试中的问题和解决过程”的不加分
    • 代码托管不能打开的不加分
    • 缺少“结对及互评”的不能打开的不加分
    • 缺少“上周考试错题总结”的不能加分
    • 缺少“进度条”的不能加分
    • 缺少“参考资料”的不能加分
  3. 教材学习中的问题和解决过程, 一个问题加1分

  4. 代码调试中的问题和解决过程, 一个问题加1分

  5. 本周有效代码超过300分行的(加2分)

    • 一周提交次数少于20次的不加分
  6. 其他加分:

    • 周五前发博客的加1分
    • 感想,体会不假大空的加1分
    • 排版精美的加一分
    • 进度条中记录学习时间与改进情况的加1分
    • 有动手写新代码的加1分
    • 课后选择题有验证的加1分
    • 代码Commit Message规范的加1分
    • 错题学习深入的加1分
    • 点评认真,能指出博客和代码中的问题的加1分
    • 结对学习情况真实可信的加1分
  7. 扣分:

    • 有抄袭的扣至0分
    • 代码作弊的扣至0分
    • 迟交作业的扣至0分

点评模板:

  • 博客中值得学习的或问题:

    • 改错非常详细。
    • 截图很多,更直观。
  • 代码中值得学习的或问题:

    • 遇到问题基本都会截图。很多不是很重要,不是很有参考价值的错误可以不必写。
  • 基于评分标准,我给本博客打分:11分。

点评过的同学博客和代码

  • 本周结对学习情况
    • 18
    • 结对学习内容
      • pp8.5的研究

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 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

参考资料

posted @ 2018-04-15 22:48  大雪将烬  阅读(319)  评论(2编辑  收藏  举报