# 后端面试题
1. 当一个Js function被调用时,将会被放在那里?
A. the call stack (调用栈)
B. the event loop (事件循环)
C. the poll phase (调查阶段)
D. the events queue (事件队列)
2. 下列哪项Object是stream(流)?
A.process.uptime
B.process.stdout
C.process
D.Buffer
3. 下列哪个module variable为目前module的绝对路径?
A. __pathname
B. __location
C. __flder
D.__filename
4. 下列代码的输出为?
```javascript=
const http = require('http');
const hostname = '127.0.0.1'; const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200; res.setHeader("Content-Type", "text/plain"); res.end("Hello World\n");
});
server.listen(port, hostname, () => { console.log(`server running at http://${hostname}:${port}/`); });
```
A. server running at http://localhost:3000/
B. server running at port 3000
C. server running at http://localhost:4000/
D. server running at http://127.0.0.1:3000/
5. 下面代码的作用是什么?
```javascript=
const fs = require('fs'); const os = require('os');
const system = os.platform(); const user = os.userInfo().username;
fs.appendFile('hello.txt', `Hello ${user} on ${system}`, (err) => { if (err) throw err; console.log('The data was appended to file!');}
);
```
A. 创建一个文件 hello.txt,并在后面添加自定义文本
B. 创建一个图片文件
C. 在终端打印系统信息
D. 创建一个命名数据并添加数字
6. 请解释下列git命令的意义?
```bash=
git reset --hard HEAD~5
git merge --squash HEAD@{1}
```
A. 重设头到仓库的第五个提交上,并合并到主分支。
B. 重设头到仓库的倒数第五个提交上,并将他们压缩为一个提交。
C. 删除最后五个提交。
D. 合并最后的五个提交到新的分支上。
7. 该.gitignore文件将会省去?
```
#.swift
build/
*.txt
*.metadata
```
A. 所有以.switf, .txt, 或者metadata结尾的文件与整个build目录下的文件。
B. 只有build目录下。
C. 所有build目录下的文件,与以.txt与.metadata结尾的文件。
D. 只有.switf与.txt结尾的文件。
8. 你会使用下列哪项命令,用于用master分支的文件强制复写本地文件?
```
A.
git pull --all
git reset --hard origin/master
B.
git pull -u origin master
git reset --hard master
C.
git pull origin master
git reset --hard origin/myCurrentBranch
D.
git fetch --all
git reset --hard origin/master
```
9. 你要导出整个数据库,包括其中的数据。你会使用下列那条语句?
A. mysqlexport
B. mysqladmin
C. mysqldump
D. mysqld
10. 下列SQL语句返回的是什么?
```sql=
SELECT * FROM Employees WHERE EmployeeName LIKE 'a%'
```
A. Employees表中所有EmployeeName不含'a'的记录。
B. Employees表中所有EmployeeName以'a'开头的记录。
C. Employees表中所有EmployeeName包含'a'的记录。
D. Employees表中所有EmployeeName以'a'结尾的记录。
11. 你拥有如下表,你想要使用full-text搜索住在street或者drive的customer。你将会使用那条命令?
| ID | lastname | firstname | phone | address | city | state | zip |
| ---- | -------- | --------- | ------------ | ------------------- | ----------- | ----- | ----- |
| A001 | Smith | Bob | 212-555-1212 | 1001 1st Street | New York | NY | 10001 |
| A002 | Chang | John | 213-555-5678 | 888 Rodeo Drive | Los Angeles | CA | 90210 |
| A003 | Smith | Mary | 999-999-9999 | 123 Main Street | Anytown | VA | 12345 |
| A004 | Johnson | Jack | 312-312-3120 | 1111 Chicago Avenue | Chicago | IL | 60606 |
| A005 | Lopez | Linda | 737-777-3333 | 123 Main Street | Austin | TX | 73344 |
A.
```
SELECT *
FROM customers
WHERE address MATCH 'Street' OR 'Drive';
```
B.
```
SELECT *
FROM customers
WHERE MATCH(address) IN ('street, drive');
```
C.
```
SELECT *
FROM customers
WHERE address MATCH 'Street' OR address MATCH 'Drive';
```
D.
```
SELECT *
FROM customers
WHERE MATCH(address) AGAINST ('street, drive');
```
12. 如果file.sql包含了将要被执行的语句,file.txt将包含什么?
```bash=
mysql < file.sql > file.txt
```
A. 一份来自file.sql的拷贝。
B. 提示语法错误的错误信息。
C. 来自MySQL的错误输出。
D. 来自MySQL的无错误输出。
13. 什么是OAuth?
A. 一个授权框架,用于生成委托接入许可。
B. 一个单一登入API的实现方法。
C. 一个API授权的方法。
D. HTTP基础的授权2.0。
14. 下列哪项为GraphQl比起REST的优点?
A. 灵活请求和返回。
B. 更稳定的API。
C. 兼容更多网关。
D. 默认设置更加安全
15. 下列Cron 语句代表多久运行一次task?
```
0 1 * * *
```
A. 该小时中的每一分钟
B. 每天中的每小时
C. 每天的1:00AM
D. 仅在星期一运行