Job DAY009

A, JavaScript programming problem

Topic Copywriter: the difference between null and undefined?

answer:

null is represented by a "no" in the object , when the converted value is 0 ; a is undefined indicating "no," the original value , the value is converted NaN3 .

  • null means "no object", that is, there should not have value

(1) as a parameter, a parameter indicating the function is not an object.

(2) as an endpoint object prototype chain.

  • undefined means "default", that is, where there should be a value, but has not defined

(1) variable is declared, but no assignment, it means undefined.

(2) function is called, the parameters should be provided is not provided, the parameter is equal to undefined.

(3) the object attribute is not assigned, the value of the attribute undefined.

(4) When the function does not return a value, default return undefined.

 

Two, MySQL programming problems

Topic Copywriter: table students

id sno username course score
1 1 Joe Smith Chinese 50
2 1 Joe Smith mathematics 80
3 1 Joe Smith English 90
4 2 John Doe Chinese 70
5 2 John Doe mathematics 80
6 2 John Doe English 80
7 3 Wang Wu Chinese 50
8 3 Wang Wu English 70
9 4 Zhao six mathematics 90

Check out only enrolled in a course of all students in school number and name.

Answer: (1) SQL statement is as follows:

SELECT sno,username,count(course) FROM students
GROUP BY sno,username
HAVING count(course) = 1;

       (2) the results of the screenshot:

Three, Java programming problem

Topic Copywriter: print out all the "narcissistic number", the so-called "digital daffodils" refers to a three-digit number, which is equal to the digits of the cube and the number itself. For example: 153 is a "narcissistic number" because cubic cubic 153 cubic 1 = +5 +3.

A: (1) Code
Package Package1; 

public  class COUNT {
     public  static  void main (String [] args) {
         for ( int NUM = 100; NUM <1000; NUM ++ ) {
             // digit 
            int A NUM = 10% ;
             // Tens 
            int NUM = B / 10% 10 ;
             // hundreds digit 
            int C = NUM / 100% 10 ; 

            IF (Math.pow (A,. 3) + Math.pow (B,. 3) + Math.pow (C,. 3) == NUM) { 
                System.out.println (NUM); 
            } 
        } 
    } 
}
       (2) Results screenshot

 

Guess you like

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