当前位置: 首页 > news >正文

百度测开面经(分类版)

1.Linux相关

1.查看家目录下a.log日志文件的最后200行

tail -n 200 ~/a.log

2.查看8080端口是否被占用

lsof -i :8080
lsof=list open files
-i :8080表示查看所有使用8080端口的进程

3.查看当前目录及子目录下的所有文件(超过3天的)

find . -type f -mtime +3
find是查找命令
.是当前目录
-type f只查找文件
-mtime +3修改时间超过3天(+表示早于)

4.两台机器传递文件命令

2.SQL相关

1.student表(student_id,name,year)score表(score_id,student_id,score)如何查询学生成绩

select student.student_id,student.name,score.score
from student这里from指定主数据来源表,然后通过JOIN再把其他表连起来
join score
on student.student_id=score.student_id这里的ON用来指定两张表之间的连接条件(匹配关系)另外写法
select 
s.student_id,
s.name,
sc.score
from student s这里就是把student表直接起了个s的别名
join score sc on s.student_id=sc.student_id

进一步筛选不要2023年和2024年的学生

select s.student_id,s.name,sc.score
from student s
join score sc on s.student_id=sc.student_id
where s.year not in (2023,2024);

2.删除一个表

drop table 表名

3.查找成绩为前三的同学的姓名(有两个表student和score)

select s.name,sc.score
from student s
join score sc on s.student_id=sc.student_id
order by sc.score desc
limit 3

如果只有一个表(student)

select name,score
from student
order by score desc
limit 3;

4.Redis和Mysql谁的读写速度快,为什么

Redis,直接在内存中进行读写,无需磁盘I/O,低层采用了高效的数据结构:哈希表,链表,字符串,集合,有序集合

Mysql每次查询/更新都可能涉及磁盘读写,低层使用B+树、磁盘页存储结构,需要磁盘寻址、索引查找

5.有一个学生选课表,包含字段:学生ID(studentid)、课程id(course id)、和课程得分(score)

如何查询至少选修两门课程的学生的学生ID

select student_id
from student_course
group by student_id
having count(distinct course_id)>=2;

3.算法题

1.将两个无序数组拼接成一个有序数组

public class Merge{public static void main (String args[]){Integer [] nums1={1,4,3,7};Integer [] nums2={1,0,3,6,3};ArrayList<Integer>list=new ArrayList<>();list.addAll(Arrays.aslist(nums1));list.addAll(Arrays.aslist(nums2));Collections.sort(list);System.out.println(list);}
}

2.翻转字符串

public class reverse2 {public static void main(String[] args) {String s="helloworld";List <Character> list=new ArrayList<>();for(char c:s,toCharArray()){list.add(c);}Collections.reverse(list);StringBuilder sb=new StringBuilder();for(char c:list){sb.append(c);}String str=new String(sb);System.out.println(str);}
}

3.无重复字符的最长子串(返回的是长度)

public class solution{public static int Longest(String s){int right=0;int max=0;Set<Charcter> occ=new HashSet<Character>();for(int i=0;i<s.length();i++){if(i!=0){occ.remove(s.charAt(i-1));}while(right<s.length() && !occ.contains(s.charAt(right)){occ.add(s.charAt(right));right++;}max=Math.max(right-i+1,max);}return max;}
}

(返回的是子串)

public class NotSmaeLongest {public static String Longest(String s){int right=-1;int ans=0;int best_start = 0;Set<Character>set=new HashSet<>();for ( int left = 0; left <s.length() ; left++) {if(left!=0) {set.remove(s.charAt(left - 1));}while(right+1<s.length()&&!set.contains(s.charAt(right+1))){set.add(s.charAt(right+1));right++;}int current=right-left+1;if(current>ans){ans=current;best_start=left;}}return s.substring(best_start,best_start+ans);}
}

4.反转字符串里的单词

class Solution {public String reverseWords(String s) {s.trim();List<String>list=Arrays.asList(s.split("\\s+"));Collections.reverse(list);return String.join(" ",list);}
}

5.快排

6.给定一个数组,将所有重复元素删除,只保留每个元素出现一次的元素,时间复杂度O(n)

import java.util.*;public class Delete_repeat {public static String find(int[] nums) {Set<Integer> set = new LinkedHashSet<>();for (int num : nums) {set.add(num);}return set.toString();}public static void main(String[] args) {int[] a = {1,1,2,2,3,3,4,4,5,5,6,6,7};System.out.println(find(a)); // [1, 2, 3, 4, 5, 6, 7]}
}

4.场景题

1.如何测试一个登录页面,写出测试用例,从哪几个方面进行测试

2.测试中你针对哪些模块进行功能测试

5.计算机网络

1.三次握手四次挥手

2.在网站输入网址后到查看网址的过程

3.有32台主机,需要的子网掩码要多少位

6.操作系统

1.并发与并行

并发是交替处理多个任务的能力,并行是真正同时执行多个任务的能力

http://www.dtcms.com/a/585475.html

相关文章:

  • 回归、分类、聚类
  • 【Linux网络】Socket编程TCP-实现Echo Server(上)
  • 关系型数据库-PostgreSQL
  • 英文网站定制哪家好wordpress上传主题提示要ftp
  • Vue 项目实战《尚医通》,已有医院数据的 TS 类型定义,笔记12
  • UE5 C++ 进阶学习 —— 02 - 小案例
  • Linux的waitpid函数:深入解析与应用实践
  • 历史数据分析——洛阳钼业
  • MySQL EXPLAIN 详解与优化指南
  • ADB 无线调试 APP 完全攻略(2025 最新版)—— 从连接到查看日志,一文搞定!
  • 商家入驻网站建设免费网站怎么做
  • C语言数据结构之堆
  • VIVO算法/大模型面试题及参考答案
  • 临海网站制作好了如何上线网站开发的要求
  • KingbaseES:从MySQL兼容到权限隔离与安全增强的跨越
  • 网站改版竞品分析怎么做可以先做网站再开公司吗
  • Go语言基础:语言特性、语法基础与数据类型
  • 解决 PyQt5 中 sipPyTypeDict() 弃用警告的完整指南
  • 内网门户网站建设要求西安摩高网站建设
  • github访问响应时间过长解决
  • Spring AoP的切点匹配
  • Cookie 与 Session 全解析:从属性原理到核心逻辑,吃透 Web 状态保持
  • STM32HAL库-F1内部Flash读写操作(官网驱动)
  • 辛集建设网站网络营销推广渠道
  • 外国排版网站企业名录2019企业黄页
  • 微信小程序开发实战:图片转 Base64 全解析
  • 秒杀-订单创建消费者CreateOrderConsumer
  • 单层前馈神经网络的万能逼近定理
  • C# 如何捕获键盘按钮和组合键以及KeyPress/KeyDown/KeyUp事件之间的区别
  • Windows系统不关闭防火墙,允许某个端口的访问怎么设置?