免費免註冊,彰化一整天線上測驗:http://exam.bestdaylong.com/test8709.htm
| ( | ) | 1. | Git 中,哪一個指令是用來將修改過的檔案加入「暫存區 (Staging Area)」?(1)git commit (2)git push (3)git status (4)git add . | ||
| ( | ) | 2. | 若希望 useEffect 在變數 count 改變時才執行,依賴陣列應如何設定?(1)[count] (2)useEffect 不支援此功能 (3)[] (4)null | ||
| ( | ) | 3. | 若要將本地端的 Git 存檔推送到 GitHub 遠端倉庫,應使用什麼指令?(1)git remote (2)git push (3)git pull (4)git fetch | ||
| ( | ) | 4. | Tailwind CSS 中,p-4 代表什麼意思?(1)Font size 4px (2)Position 4 (3)Padding 1rem (通常是 16px) (4)Percentage 4% | ||
| ( | ) | 5. | 下列哪一行程式碼正確建立了 useState?(1)const {count, setCount} = useState(0); (2)const [count, setCount] = useState = 0; (3)const [count, setCount] = useState(0); (4)const count = useState(0); | ||
| ( | ) | 6. | 關於 React 的 JSX 語法,下列敘述何者錯誤?(1)標籤必須有閉合 (如 <input />) (2)只能有一個根元素 (Parent Element) (3)可以直接使用 if-else 語句在 {} 裡面 (4)class 屬性必須寫成 className | ||
| ( | ) | 7. | 在 React 中,父元件傳遞資料給子元件,是透過什麼機制?(1)API (2)Event (3)State (4)Props | ||
| ( | ) | 8. | 在 React 中,若要修改 state 的數值 (例如 count),必須怎麼做?(1)直接寫 count = count + 1 (2)直接寫 count++ (3)使用 setCount(count + 1) (4)修改 DOM 元素 document.getElementById | ||
| ( | ) | 9. | 在 React 中要新增一個項目到陣列 state (如 todos),且不破壞原陣列,應使用什麼語法?(1)todos.add(newItem) (2)setTodos([...todos, newItem]) (3)todos.push(newItem) (4)setTodos(todos + newItem) | ||
| ( | ) | 10. | 在 React 專案中,npm run build 指令的主要用途是什麼?(1)啟動開發伺服器 (2)安裝所有套件 (3)打包並壓縮程式碼,產生 dist 資料夾以供正式上線 (4)刪除專案 | ||
| ( | ) | 11. | 關於 Netlify 的 CI/CD 自動部署,下列敘述何者正確?(1)必須自己在終端機輸入 npm run build 才能更新 (2)每次都要手動拖拉資料夾上傳 (3)只要連結 GitHub,執行 git push 後 Netlify 會自動更新網站 (4)必須付費才能使用自動更新 | ||
| ( | ) | 12. | 使用 .map() 產生列表時,React 會要求每個 <li> 必須加上什麼屬性?(1)index (2)name (3)key (4)id | ||
| ( | ) | 13. | 使用 fetch 串接 API 時,通常會搭配哪個 React Hook 來在畫面載入時觸發請求?(1)useContext (2)useState (3)useRef (4)useEffect | ||
| ( | ) | 14. | 關於 useEffect(() => { ... }, []),當依賴陣列 (Dependency Array) 為空陣列 [] 時,Effect 何時執行?(1)每次畫面更新時 (2)只在元件第一次渲染 (Mount) 後執行一次 (3)當任何 state 改變時 (4)永遠不會執行 | ||
| ( | ) | 15. | 將 function add(a, b) { return a + b; } 改寫為箭頭函式簡寫,下列何者正確?(1)const add = a, b => a + b; (2)const add = (a, b) => a + b; (3)const add = (a, b) => { a + b } (4)const add = (a, b) => return a + b; | ||
| ( | ) | 16. | 在現代 JavaScript 中,哪種宣告方式具有「區塊作用域 (Block Scope)」且宣告後不能重新賦值?(1)const (2)let (3)function (4)var | ||
| ( | ) | 17. | 使用 Tailwind CSS 時,若要設定文字為紅色且字體加粗,應寫在哪個屬性?(1)style="text-red-500 font-bold" (2)className="text-red-500 font-bold" (3)class="text-red-500 font-bold" (4)css="text-red-500 font-bold" | ||
| ( | ) | 18. | 在 React Router 中,若要建立一個不會造成整頁重新整理的超連結,應使用哪個元件?(1)<a href="..."> (2)<Redirect to="..."> (3)<Route path="..."> (4)<Link to="..."> | ||
| ( | ) | 19. | 若出現 "useRoutes() may be used only in the context of a Router component" 錯誤,通常是忘了什麼?(1)忘記寫 <Route> (2)安裝 react-router-dom (3)在 main.jsx 用 <BrowserRouter> 包裹 <App /> (4)在 App.jsx 匯入 Routes | ||
| ( | ) | 20. | 若 const user = { name: 'React' },如何正確使用解構賦值取出 name?(1)const { name } = user; (2)const name = user(name); (3)const name = user; (4)const [name] = user; |