"Data Structures and object-oriented programming" 2-3 week learning summary

Student ID 20182329 2019-2020-1 "Object-oriented programming and data structures," the first two to three weeks learning summary

Learning content summary

  • The use of conditional statements and loops
  • Input and output statements use words Bureau
  • Conversion of basic data types and applications
  • Use of various types, and a method of formatted output.
  • Basic writing class

Textbook learning and problem-solving process

  • Question 1: When an exception occurs when the scanner input short nextShort input ().
  • Problem 1 Solution: Enter with a former should own the specified data type can only be the same.
  • Question 2: used when the application does not add impoet package I need to use when import Java.util *..
  • Problem 2 Solution: When later found java.lang * All packages will be automatically greet each program, but it is best to use a separate import statement in reference to a package.
  • Question 3: Follow the cone3.NAME call the book the use of enumerated classes, but found it impossible to output.
  • Question 3 Solution: After declaring, inside the computer each enumeration type are stored as an integer value, so I use a card double type declaration, and the use of decimals will lose data.

Code debugging and problem solving in the process

  • Question 1: Figure discovered errors ---- can not find the class at compile time.

  • Problem 1 Solution: I will setpogyrightdate method when writing their own set of operations carried out as a class, so the class can not be found
  • Question 2: Can not find the book variables.

  • Problem 2 Solution: because toString in class should use (the new variable name) .toString ().
  • Question 3: When using the file shown in tests found it impossible to return value

  • Question 3 Solution: not tested value input, but rather Scanner input; secondly return the return value in the loop, and this cycle and there is no need, not a qualified program.

Code hosting

(Run results screenshot statistics.sh script)

Last week exam wrong question summary

  • A variable the Java On May Contain the In
    A
    .
    A reference value A or
    B
    .
    A Package
    C
    .
    A Method
    D
    .
    A class
    E
    .
    The any of The above
    analysis: English, but related, meaning it wrong reference. The java class instance variables containing values or reference.
  • If two variables contain aliases of the same object then

    A . the object may be modified using either alias

    B . the object cannot be modified unless there's but a single reference to it

    C . a third alias is created if/when the object is modified

    D . the object will become an "orphan" if both variables are set to null

    E . answers A and D are correct

    Analysis: Alias ​​provides a method may modify the object. If these two variables are set to null, then the object is not any variable reference (any alias)
  • An "alias" is when

A . two different reference variables refer to the same physical object

B . two different numeric variables refer to the same physical object

C . two different numeric variables contain identical values

D . two variables have the same names

E . none of the above

Parsing: alias alias, when there are two or more references point to the same physical object, it will happen "Alias."

  • These two ways of setting up a String yield identical results:

a) String string = new String(12345);

b) String string = new String("12345");

A . true

B . false

Analysis: is a new () in the String class must be quoted, or not compile

  • The printf method within System.out is designed to ease the conversion of legacy C code into Java.

A . true

B . false

Analysis: English misunderstanding, I understand is the contrast, in fact, enter the code.

  • The advantage(s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that

A . you may create several random number generators

B . the generators in Random are more efficient than the one in Math.random

C . you can generate random ints, floats, and ints within a range

D . you can initialize and reinitialize Random generators

E . all but answer B

Analysis: lack of English comprehension. Comprising a randomizer in all other properties of Math.random advantages.

  • Consider the following two lines of code. What can you say about s1 and s2?
    String s1 = "testing" + "123";

String s2 = new

String("testing 123");

A . s1 and s2 are both references to the same String object

B . the line declaring s2 is legal Java; the line declaring s1 will produce a syntax error

C . s1 and s2 are both references to different String objects

D . s1 and s2 will compare "equal"

E . none of the above

Parsing: s1 and s2 are legitimate, but the plus is not applicable.

  • Wrong title two What value will z have if we execute the following assignment statement float z = 5/10;? (If we execute the following assignment statement, is what will get the z value?)

A. Z will equal 0.0 (z will be equal to 0.0)

B. Z will equal 0.5 (z will be equal to 0.5)

C. Z will equal 5.0 (z will be equal to 5.0)

D. Z will equal 0.05 (z will be equal to 0.05)

E. None of the above, a run-time error arises because z is a float and 5/10 is an int (None of the above, since z is a float type, 5/10 is of type int, the operation occurs when an error)

Solution: calculated for fractional float line, the right analysis equation is an integer division type, the results of fractional part is discarded, to obtain 0, be converted after the extended type 0.0.

  • What is output with the statement System.out.println ( "" + x + y);? If x and y are int values ​​where x = 10 and y = 5 (if x and y is a number of type int, x = 10 , y = 5, the statement System.out.println ( "" + x + y); what output is)?

A . 15

B. 105

C . 10 5

D . x+y

E. An error since neither x nor y is a String (an error due to the x and y strings are not caused).

Analysis: Java code to obtain operation 105

  • Java is a strongly typed language. What is meant by "strongly typed"? (Java is a strongly typed language. "Strongly typed" refers to what?)

A.Every variable must have an associated type before you can use it (before using variables, each must have an associated type)

B.Variables can be used without declaring their type (you can use variables without declaration of its type)

C.Every variable has a single type associated with it throughout its existence in the program, and the variable can only types store values ​​of that type (in the program, each variable has an associated, and the variable can store the value of this type)

D.Variables are allowed to change type during their existence in the program as long as the value it currently stores is of the type it is currently declared to be (allowed to change the type of variable exists in the program, as long as it is currently stored value the current type declaration)

E.Variables are allowed to change types during their existence in the program but only if the change is to a narrower type (variable exists in the program is permitted to change the type, but only narrow conversion)

Analysis: textbook definition does not understand

  • Assume that x, y, and z are all integers (int) equal to 50, 20, and 6 respectively. What is the result of x / y / z? (Assuming x, y and z are integer (int) , respectively, then the result is equal to 50, 20 and 6 x / y / z what?)

A
.
0

B
.
12

C
.
16

D
.
A syntax error the this AS IS syntactically invalid (Invalid syntax error generated due to the syntax)

E
.
A RUN Because the this error-Time Division A by IS 0 (except due to errors generated by the operation 0)

Analysis: This question left to right order of operations, 50/20 = 2, 2/6 = 0; where there is no other than 0, the wrong reasons do not serious problems.

Pair peer review and

Grading

  1. Proper use Markdown syntax (1 point):
    • Do not use Markdown no extra points
    • A syntax error is not a plus (link does not work, does not form, the list is incorrect ...)
    • Typesetting confusion is not a plus
  2. Elements range (1 point) template
    • Missing "textbook learning and problem solving process" without points
    • Lack of "problem solving and debugging code in the process" without points
    • Managed code can not be opened without points
    • Missing "twinning and peer assessment" can not be opened without points
    • Missing "last week summed up the wrong title examination" can not be a plus
    • The lack of "progress bar" can not be a plus
    • Lack of "reference" can not be a plus
  3. Textbook learning and problem solving process, a problem 1 point

  4. Code debugging and problem solving in the process, a problem 1 point

  5. Week over 300 branches valid code (plus 2 points)
    • Submitted one week fewer than 20 times without points
  6. Other plus points:
    • Hair blog before Friday 1 point
    • Feelings, experience does not leave large empty 1 point
    • Typesetting fine plus one point
    • Progress bar records the learning time and improve the situation of 1 point
    • There are hands-on writing new code, add 1 point
    • After class choice has verified 1 point
    • Code Commit Message Specification 1 point
    • Learning the wrong questions in depth, add 1 point
    • Comments seriously, I can point out problems and blog code plus 1 point
    • Pair learning authentic plus 1 point
  7. Points:
    • Plagiarism buckle to 0
    • Cheat codes to buckle 0
    • Late assignments to buckle 0

Comments template:

  • Worth learning problems or blog:
    • This blog in the last exam modify the wrong title of a great effort, learning many of the linux commands, understand the multi-use linux in the command.
    • But the blog there is no problem in terms of self-study textbooks, and did not list all the knowledge, but to solve the problem of textbook learning real programming column.
    • In this blog link code debugging problems actively solve the problem, master the Java programming many details in the linux environment.
  • Code is worth learning or problem:
    • Because the output is simple to learn programming this week are the first chapter, so almost no problem, but on the programming format as beautiful and convenient, easy to modify.
    • There was an error in this blog settings class (identifier), hope to correct.
  • Based on score, I give this blog scoring: 10 points. Scores are as follows:
  • Correct typographical elements complete (+1)
  • Use makedown format (+1)
  • Teaching Materials (+3)
  • Code debugging problems (+3)
  • The wrong questions in depth (+1)
  • Comments seriously (+1)

  • Reference Example

Comments had students blog and code

  • Pair this week learning
    • 20182324
    • Pair Photo
    • Pair learning content
      • The use of conditional statements and loops
      • Input and output statements use words Bureau
      • Conversion of basic data types and applications
      • Use of various types, and a method of formatted output.
  • Last week blog peer assessment case

Other (perception, thinking, etc., optional)

In my opinion is applied to the C programming language on the Java program, first of all conditional statements and looping statements almost exactly the same language and C, all kinds of if statements, while statements, and so are the same; secondly to test the main code like C language and functions as the partition function, the value of the object during the transfer. Secondly, I gradually had to Java learning experience, nothing more than practice more and more, see more training may be familiar with will not forget, you can ask troubleshooting knowledge loopholes, so java learning can be more handy.

Learning progress bar

The number of lines of code (add / accumulate) Blog amount (add / accumulate) Learning time (add / accumulate) Important growth
aims 5000 rows 30 400 hours
the first week 107/107 2/2 15/15
the second week 454/526 2/4 32/47

Try recording "planned learning time" and "actual learning time" to the end see if you can improve their ability to plan. This study is very important work, is also useful.
Consuming an estimated equation: Y = X + X / N , Y = XX / N, training more often, X, Y will close.

  • Plan study time: 35 hours

  • The actual study time: 32 hours

  • Improvements: a little less play Saturday Sunday holiday, play a few more lines of code.

Reference material

Guess you like

Origin www.cnblogs.com/lyz182329/p/11569786.html