20180330

1. JavaScript Short Answer Questions

Tell me about your understanding of json?

    a. JSON refers to JavaScript Object Notation;
    b. JSON is a lightweight text data exchange format, not a programming language;
    c. JSON exists independently of the language;
    d. JSON is self-describing, easier to understand;

    e. JSON can convert a set of data represented in a JavaScript object into a string, which can then be easily passed between functions, or data in asynchronous applications.


2. MySQL short answer questions

What are indexes and constraints in a database?

    The index is to improve the retrieval speed of the data. The index is built on the data table. The constraints established according to one or more fields are to maintain the integrity of the data. The constraints include non-null constraints, primary key constraints, foreign key constraints and so on.


3. Java programming questions

    There are 5 people sitting together and ask how old is the fifth person? He said he was 2 years older than the fourth person. Asked the age of the 4th person and he said he was 2 years older than the 3rd person. Ask the third person and say that he is two years older than the second person. Ask the second person and say he is two years older than the first person. Finally asked the first person, he said it was 10 years old. How old is the fifth person?

package exercise;

public class exercise16 {
	public static void main(String[] args) {
		int num = 5;
		int age = getAge(num);
		System.out.println("Age is: " + age);
	}

	public static int getAge(int num) {
		if (num == 1) {
			return 10;
		} else {
			return getAge(num - 1) + 2;
		}
	}
}
        Answer: The fifth person is 18 years old.

Guess you like

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