几个简单的面试题

笔试题:

1 斐波那契 递归

2 单词逆序

3 css改变字体颜色和字号

4 js 定义学员 学员信息 for循环实现十个学员信息输出

5 sql查询(单条件;范围查询 最大值)

6 冒泡排序的算法

7 html有什么标签

8 操作字符串的对象string stringbild string

9 三个集合有哪些,他们的区别set map list

答案:

一、
https://www.cnblogs.com/ynzj123/p/12606319.html

public class Fbnq {
    public static void main(String[] args) {
        System.out.println(Fibonacci(7));
    }
        public static int Fibonacci(int n) {
//        排除n等于0和1的情况
            if(n == 0)
                return 0;
            if(n == 1)
                return 1;
//            递归的原理是:不断调用自己;使问题由复杂变得简单(让n不断缩小)
            return Fibonacci(n-2) + Fibonacci(n-1);
        }
}

二、
https://www.cnblogs.com/ynzj123/p/12606319.html

public class ReverseDemo {
    public static void main(String[] args) {
//        不打印则不会输出
        System.out.println(reverse4("123abc"));
    }
    public static String reverse4(String s) {
//        reverse()方法是StringBuffer独有的方法
        return new StringBuffer(s).reverse().toString();
    }
}

三、

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CssDemo</title>
    <style>
        div{
            color: blue;
            font-size: 13px;
        }

    </style>
</head>
<body>
<div>今天要好好吃饭</div>
</body>
</html>

补充:三种选择器
标签 :无变化, p{属性1}
类 :加点, .x{属性1}
id :加#号, #y{属性1}


 

四、


五、
https://blog.csdn.net/yjb7268888/article/details/50014393
https://www.cnblogs.com/jum-bolg/p/11235427.html

/*
    1.查询年龄为20的顾客
    select customer from Personnel where age=20;
    2.查询在2019.1.1到2019.5.1期间,年龄最大的顾客
    select max(customer) from Personnel where Date>='2019.1.1' and Date<='2019.5.1';
    */

/*
    时间范围: Date>='2010-11-05' and Date<='2010-11-15';
    数据范围:
    查询年龄为18,28,38的人:where age in(18,28,38);
    查询年龄为12-18的人:where age between 12 and 18;
    */

六、
https://www.baidu.com/link?url=6p_tBHc1EPs-RODSuX53stDxzh5kkBUy-VmfGMz3P0ciwOCxyvS0_LFFOwgMjZ9RKBi24SYjKJbm-h67UhtP_xqElLkcF_2ARkv0WALQhp_&wd=&eqid=b35c5eb40001ddf0000000035fa4b7bd

冒泡排序的思想:它重复地走访需要排序的数列,按照已经规定好的排序顺序,每一次比较相邻两个元素,如果他们的顺序错误就把他们交换过来。 直到没有再需要交换的元素,该数列就排序完成。

import java.util.Arrays;

public class Bubble {
    public static void main(String[] args) {
//        调用方法
        show(new int[]{1,8,6,4,3});
    }
    public static void show(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
//            比较的次数
            for (int j = 0; j < nums.length - 1 - i; j++) {
//                前后两个数比较时,交换位置
                if (nums[j] > nums[j + 1]) {
                    int temp = nums[j];
                    nums[j] = nums[j + 1];
                    nums[j + 1] = temp;
                }
            }
        }
//        数组转换,打印输出
        System.out.println(Arrays.toString(nums));
    }
}

七、
html就是超文本标记语言
标题标签: h1~h6,分割线 hr/,字体 font size color,斜体 i,加粗 b,段落标签 p,换行 br/,
实体标签:空格 &nbsp;,引号 &quot;
图片标签 img/ src
form表单,input标签
 

八、
https://www.cnblogs.com/ynzj123/p/12602839.html

三者具有相同的构造和方法;都是字符串的缓冲区、可变的字符序列。
String:每次操作都会生成新的 String 对象,效率最低
StringBuffer:线程安全,效率中等
StringBuilder:线程不安全,效率最高
 

九、
https://www.cnblogs.com/ynzj123/p/12658146.html
https://www.cnblogs.com/ynzj123/p/12671207.html

List:是一个有序容器,可以允许重复对象,可以索引(可用普通的for循环遍历)
Set:无序,存取的顺序不同,数据不重复(使用equals()方法保证数据不重复)
Map:、是双列集合的顶层接口,有两个对象:键(是唯一的)、值(是不唯一的)。键值对,是映射关系

总之:

原文地址:https://www.cnblogs.com/ynzj123/p/13935646.html