DrillLab
练习Practice

动手做Get your hands on it

练习跟着课文走 —— 每节课尾都有本课的练习。这一页是全部练习的总库,想集中刷题的时候来。 每个练习都写清了它来自哪一节,卡住了就回去看那一节。Practice follows the lessons — every lesson ends with the exercises for that lesson. This page is the whole library, for when you want to drill in one sitting. Each exercise names the lesson it came from, so you can go back when you stall.

0 / 148个做对过you got right

练习Exercises

筛出 50 个练习(共 148 个) · 第 1 / 5 页。Showing 50 of 148 · page 1 / 5.
来自From Node.js、npm、node_modules 和 lockfileNode.js, npm, node_modules and the lockfile · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it这个包该放哪边?Which side does this package go on?

下面是 react-notes-app 真实的依赖之一。它在真实的package.json 里被放在哪个字段下?

Below is one of the real dependencies of react-notes-app. Which field of the real package.json is it under?

JSON示意Illustrative
1"vitest": "^4.1.10"
先选一个选项Pick an option first
来自From Node.js、npm、node_modules 和 lockfileNode.js, npm, node_modules and the lockfile · 地基 · 项目与语言Foundations · project and language
L1认出来Spot itlockfile 该怎么对待How to treat the lockfile

项目里已经有 package-lock.json,你要安装依赖。下面哪些做法是对的?(多选)

The project already has a package-lock.json and you need to install the dependencies. Which of these are correct? (more than one)

这题是多选。More than one answer is correct.

先选一个选项Pick an option first
来自From npm scripts:命令到底跑了什么npm scripts: what the command actually runs · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it怎么跑 react-notes-app 的测试How to run the tests of react-notes-app

你在 react-notes-app/ 目录下,想跑那 4 个判卷测试。 package.json 的 scripts 只有 devbuildq2。下面哪个命令能跑起来?

You are inside react-notes-app/ and want to run those 4 grading tests. The scripts in package.json are only dev, build and q2. Which command works?

先选一个选项Pick an option first
来自From 两个考试项目的目录,逐个说明The directory layout of both exam projects · 地基 · 项目与语言Foundations · project and language
L1认出来Spot itQ1 的 state 应该放在哪个文件Which file should hold the state for Q1

Q1 要求「表单提交后,新笔记出现在表格里」。表单是NoteForm,表格是 NoteTable,两者是兄弟。 那份笔记列表数据应该存在哪个组件里?

Q1 asks that a new note appears in the table after the form is submitted. The form is NoteForm, the table is NoteTable, and the two are siblings. Which component should hold the list of notes?

先选一个选项Pick an option first
来自From 两个考试项目的目录,逐个说明The directory layout of both exam projects · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it哪个是干扰项Which one is the distractor

Federation 项目里,下面哪个文件与你要完成的任务完全无关?

In the Federation project, which of these files has nothing at all to do with the task you have to finish?

先选一个选项Pick an option first
来自From 异步:Promise、await、all 和 allSettledAsync: Promise, await, all and allSettled · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it该用 all 还是 allSettledall or allSettled

Q2 的要求原文:「The runner NEVER throws, even if some tasks reject. It resolves with an array of results IN THE SAME ORDER as tasks.」 这描述的是哪个内置方法的语义?

The exact wording of the Q2 requirement: “The runner NEVER throws, even if some tasks reject. It resolves with an array of results IN THE SAME ORDER as tasks.” Which built-in method behaves like that?

先选一个选项Pick an option first
来自From 异步:Promise、await、all 和 allSettledAsync: Promise, await, all and allSettled · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it为什么 tasks 是「函数数组」而不是「Promise 数组」Why tasks is an array of functions, not an array of Promises

Task<T> = () => Promise<T>。 如果题目改成传一个 Promise<T>[] 进来, 会出什么问题?

Task<T> = () => Promise<T>. If the question passed in a Promise<T>[] instead, what would go wrong?

先选一个选项Pick an option first
来自From 泛型参数,以及怎么读 tsc 的报错Generic parameters, and how to read a tsc error · 地基 · 项目与语言Foundations · project and language
L1认出来Spot it这是谁的问题Whose problem is this

你刚 clone 好 react-notes-app,一行代码都还没写,先跑了npm run build,得到 10 个TS2582: Cannot find name 'test'。 同时 npx vitest run 显示 4 个测试全过。 最合理的判断是?

You have just cloned react-notes-app, written not one line of code, and run npm run build. You get 10 of TS2582: Cannot find name 'test'. At the same time npx vitest run shows all 4 tests passing. What is the most sensible conclusion?

先选一个选项Pick an option first
来自From 组件就是一个返回界面的函数A component is a function that returns what you see on screen · React 考试React exam
L1认出来Spot it哪一行会把变量的值显示出来Which line prints the value of a variable

下面哪一行会在页面上显示这条笔记的标题内容?

Which line below shows the title of this note on the page?

先选一个选项Pick an option first
来自From 组件就是一个返回界面的函数A component is a function that returns what you see on screen · React 考试React exam
L1认出来Spot it三道题的代码该写在哪个文件Which file the code for the three tasks belongs in

Q1 的三个任务(Add / Delete / Edit)都要改动笔记列表。 这些逻辑主要写在哪个文件里?

All three tasks in Q1 (Add / Delete / Edit) change the note list. Which file holds most of that logic?

先选一个选项Pick an option first
来自From 列表渲染与 keyRendering a list, and the key prop · React 考试React exam
L1认出来Spot it这个列表该用什么当 keyWhat should this list use as its key

notes 里每条是 { id: number; title: string; content: string }, 用户可以删除任意一条。下面哪个是最合适的 key?

Each item in notes is { id: number; title: string; content: string }, and the user can delete any of them. Which of these is the best key?

先选一个选项Pick an option first
来自From 列表渲染与 keyRendering a list, and the key prop · React 考试React exam
L1认出来Spot it哪一段什么都不会渲染Which one renders nothing at all

下面哪一段会导致表格里一行都不出现(而且不报错)?

Which of these makes the table show no rows at all, without reporting an error?

先选一个选项Pick an option first