20180320

1. JavaScript programming questions

    What is the difference between null and undefined?

The undefined type has only one value, undefined. When the declared variable has not been initialized, the default value of the variable is undefined.
The null type also has only one value, which is null. null is used to represent an object that does not yet exist, and is often used to indicate that a function attempts to return an object that does not exist.

2. MySQL programming questions

    table name students


    Find out the student numbers and names of all students who only took one course.

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

3. Java programming questions

    Print out all the "Daffodil Numbers", the so-called "Daffodil Numbers" refers to a three-digit number whose cubic sum of the digits is equal to the number itself. For example: 153 is a "daffodil number" because 153=1 cubed + 5 cubed + 3 cubed.

package exercise;

public class exercise09 {
	public static void main(String[] args) {
		for (int num = 100; num < 1000; num++) {
			int a = num % 10;// one digit
			int b = num / 10 % 10;// ten digit
			int c = num / 100 % 10;// hundreds digit

			if (Math.pow(a, 3) + Math.pow(b, 3) + Math.pow(c, 3) == num) {
				System.out.println(num);
			}
		}
	}
}


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326942733&siteId=291194637