zoukankan      html  css  js  c++  java
  • 20172315 2017-2018-2 《程序设计与数据结构》第3周学习总结

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

    教材学习内容总结

    • 了解了如何对对象的创建
    • 学习了String类的用法
    • 知道了包的概念
    • 学习到了包中的一个Random的用法
    • 了解了Math类的使用
    • 知道了什么叫枚举型及包装器类

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

    • 问题1:不太懂书中的格式化输出小节的内容
    • 问题1解决方案:通过询问同学,查百度,参考蓝墨云的学习资料后初步了解
    • 问题2:对于书中的概念记忆不太深刻
    • 问题2解决方案:反复研读教材,并加以运用

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

    • 问题1:在pp3.3中最后的结果不知道怎么表示

    • 问题1解决方案:经过认真思考已经仔细研读书本后想到了一种表达方式。如下。

    • 问题2:对于很多程序编写时总是容易出错

    • 问题2解决方案:使用了老师在蓝墨云上介绍的代码调试方法后错误可以容易的被找出来

    代码托管

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

    上周考试错题总结

    • Of the following types, which one cannot store a numeric value? (在下列数据类型中,哪一个不能存储一个数值型数据?)
      A . int
      B . byte
      C . float
      D . char
      E . all of these can store numeric values (以上所有类型都可以存储数值型数据)
      int和字节用于存储整数(整数),而浮点用于存储实数或浮点值(用小数点表示的值)。字符存储单个字符,包括字母、标点符号和数字。但是,存储数字数字“5”与存储数字5不一样。
    • What value will z have if we execute the following assignment statement? float z = 5 / 10; (如果我们执行下面的赋值语句,得到的z将会是什么值?)
      A . z will equal 0.0 (z将等于0.0)
      B . z will equal 0.5 (z将等于0.5)
      C . z will equal 5.0 (z将等于5.0)
      D . z will equal 0.05 (z将等于0.05)
      E . none of the above, a run-time error arises because z is a float and 5 / 10 is an int (以上都不对,因为z是float类型,5 / 10是int类型,所以会发生运行时错误)
      5和10都是int值,所以5/10是整数除法。结果是0。即使z是浮点数,也能存储真正的答案,0.5,因为整数除法,它只能得到0。为了获得0.5,我们必须首先投5或10作为一个浮动。
    • Which of the following is true regarding the mod operator, %? (关于求余运算符%,下面哪项是正确的?)
      A . It can only be performed on int values and its result is a double (它只能执行int类型的数值,其结果是double类型的数)
      B . It can only be performed on int values and its result is an int (它只能执行int类型的数值,其结果也是int类型的数)
      C . It can only be performed on float or double values and its result is an int (它只能执行float或者double类型的数值,其结果是int类型的数)
      D . It can only be performed on float or double values and its result is a double (它只能执行float或者double类型的数值,其结果是double类型的数)
      E . It can be performed on any numeric values, and the result always is numeric (它可以执行任何类型的数值,其结果始终是数值)
      mod,或模,返回由除法产生的余数。余数总是数值的。虽然通常使用整数值,但%运算符可用于各种数值数据。
    • What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5? (如果x和y是int类型的数值,x=10,y=5,那么语句System.out.println(""+x+y);的输出是什么?)
      A . 15
      B . 105
      C . 10 5
      D . x+y
      E . An error since neither x nor y is a String (因x和y都不是字符串而引起的一个错误)
      使表达式的其余部分被视为字符串,因此两个+符号用作字符串连接。因此,x变成y,与y或105连在一起。
    • If a, b, and c are int variables with a = 5, b = 7, c = 12, then the statement int z = (a * b - c) / a; will result in z equal to (如果a、b和c是int类型的变量,a=5,b=7,c=12,那么语句int z = (a * b - c) / a;得出的z等于___)
      A . 0
      B . 4
      C . 5
      D . -5
      E . 23
      (a * b - c) / a = (5 * 7 - 12) / 5 = (35 - 12) / 5 = 23 / 5,并且由于23和5是int值,除法执行为int除法,或23/5=4。
    • A variable of type boolean will store either a 0 or a 1. (Boolean类型的变量将被存储为0或1)
      A . true
      B . false
      布尔变量只能存储两个值中的一个,但这些值是保留字true和false。在C,C++,C #布尔值为int变量只有0或1的存储实现,但在java语言的作者选择使用布尔常量true和false这是语义上更容易理解(更安全)。
    • You cannot cast a String to be a char and you cannot cast a String which stores a number to be an int, float or double. (你不能将字符串强制转换为char类型,也不能将一个字符串强制转换为int、float或double类型。)
      A . true
      B . false
      没有投一个字符串的一个原始类型的机制,但也有方法可以发挥类似的作用,在一个给定的位置,返回一个字符(定时)或返回int,float或double值相当于存储在字符串的个数。

    学习进度条

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

    参考资料

    • [《Java程序设计与数据结构教程(第八版)》]
    • 蓝墨云
  • 相关阅读:
    HDU 6182 A Math Problem 水题
    HDU 6186 CS Course 位运算 思维
    HDU 6188 Duizi and Shunzi 贪心 思维
    HDU 2824 The Euler function 欧拉函数
    HDU 3037 Saving Beans 多重集合的结合 lucas定理
    HDU 3923 Invoker Polya定理
    FZU 2282 Wand 组合数学 错排公式
    HDU 1452 Happy 2004 数论
    HDU 5778 abs 数论
    欧拉回路【判断连通+度数为偶】
  • 原文地址:https://www.cnblogs.com/huzhitao/p/8645775.html
Copyright © 2011-2022 走看看