Job DAY005

A, JavaScript quiz

Topic Copywriter: Explain the output of the following code.

console.log(0.1 + 0.2); //0.30000000000000004
console.log(0.1 + 0.2 == 0.3); //false

A: JavaScript in binary, parsing each will be converted to a binary floating-point number, and after the completion of operational converted back to decimal. Thus (0.1 + 0.2) .30000000000000004 result of, rather than 0.3.

 

Two, MySQL programming problems

Topic Copywriter: table name student_score

name course score
Joe Smith Chinese 81
Joe Smith mathematics 75
John Doe Chinese 76
John Doe mathematics 90
Wang Wu Chinese 81
Wang Wu mathematics 100
Wang Wu English 90

Check out student information is greater than the average score of 75 points, "Zhang" surnamed students.

Answer: (1) SQL statement is as follows:

SELECT *
FROM student_score
WHERE name IN (SELECT name
    FROM student_score
    WHERE name LIKE '张%'
    GROUP BY name
    HAVING AVG(score) > 75)

       (2) query results shots are as follows:

 

Three, Java programming problem

Topic Copywriting: Monkey eating peach issues: the monkey off his first day of a number of peach, half eaten immediately, not addiction, but also to eat the next morning a turn eaten by the remaining peach half, then eat the One. After the morning before the rest of the day eat half a zero. When the morning of the 10th day want to eat, see only one peach. Seeking first day were picked number.

A: (1) code is as follows:

Package Package1; 

public  class COUNT {
     public  static  void main (String [] args) {
         int NUM =. 1 ;
         for ( int I =. 1; I <=. 9; I ++ ) { 
            NUM = (NUM +. 1) * 2 ; 
        } 
        the System .out.println ( "the first day were picked" + num + "peach" ); 
    } 
}

       (2) run results screenshot:

 

Guess you like

Origin www.cnblogs.com/fighting2015/p/11286434.html