คำแทนคำว่า If (เช่น Unless, Provided That, As Long As, In Case)

คำแทนคำว่า If (เช่น Unless, Provided That, As Long As, In Case) — Bài Tập 1

/ 10

คำแทนคำว่า If (เช่น Unless, Provided That, As Long As, In Case) — Bài Tập 1

Luyện tập ngữ pháp tiếng Anh chủ đề คำแทนคำว่า If (เช่น Unless, Provided That, As Long As, In Case) qua 10 câu hỏi trắc nghiệm. Trả lời đúng ít nhất 70% để hoàn thành bài.

คำเชื่อมเงื่อนไขอื่นๆ ได้แก่ unless (ถ้าไม่), provided that, as long as (ในกรณีที่เท่านั้น), in case (เพื่อเป็นการป้องกัน)

B2 · ระดับกลางตอนสูง (Upper Intermediate) TOEIC 605–780 IELTS 5.5–6.5 อนุประโยคและประโยคเงื่อนไข (Clauses & Conditionals)
10 câu hỏi Điểm qua: 70% Bài 1

Hướng dẫn làm bài

  • Đọc kỹ từng câu hỏi và chọn đáp án đúng nhất.
  • Bài thi không giới hạn thời gian — bạn có thể làm theo tốc độ của mình.
  • Nhấn Nộp bài khi đã hoàn thành để xem kết quả và giải thích chi tiết.

เข้าสู่ระบบเพื่อบันทึกผล

คุณสามารถทำแบบทดสอบได้โดยไม่ต้องเข้าสู่ระบบ แต่จะไม่มีการบันทึกผล เข้าสู่ระบบ เพื่อติดตามความก้าวหน้าของคุณ

  1. 1

    A function `calculateDiscount(price, coupon)` needs to return 0 if `coupon` is null or invalid. What is the best way to implement this using a guard clause?

  2. 2

    What is the result of `const result = (10 > 5) ? 'Greater' : 'Smaller';`?

  3. 3

    In a language with optional chaining, if `data` is an array of objects, and you want to safely access the `name` property of the first element, which might not exist, how would you write it?

  4. 4

    To provide a default value for a date variable `eventDate` to today's date if it's null or undefined, which operator is most suitable?

  5. 5

    A function `fetchData(id)` should return an empty array immediately if `id` is negative. How would you implement this using a guard clause?

  6. 6

    Consider the code: `let status = (score > 90) ? 'Excellent' : 'Good';`. What is 'Excellent' if score is 95?

  7. 7

    You want to ensure a function parameter `name` always has a value, defaulting to 'Anonymous' if it's not provided or is an empty string. Which operator can help achieve this concisely?

  8. 8

    You are building a system that needs to apply different validation rules (e.g., `EmailValidator`, `PasswordValidator`, `AgeValidator`) based on the type of data being validated. Instead of using `if-else if` to select the validator, you store validator instances in a map where keys are data types and values are validator objects. What is this an example of?

  9. 9

    You are building a system that needs to retrieve environment variables. If an environment variable is not set, you want to use a default value. Which operator is ideal for this, especially if an empty string is a valid configuration?

  10. 10

    When is it generally preferable to use a `switch` statement over a long `if-else if` ladder?

← กลับไปหัวข้อ