بدائل If (مثل Unless, Provided That, As Long As, In Case)

بدائل If (مثل Unless, Provided That, As Long As, In Case) — Exercise 2

/ 10

بدائل If (مثل Unless, Provided That, As Long As, In Case) — Exercise 2

Practice English grammar topic بدائل If (مثل Unless, Provided That, As Long As, In Case) with 10 multiple-choice questions. Answer at least 70% correctly to complete the test.

أدوات شرط أخرى: unless (إذا لم)، provided that، as long as (فقط إذا)، in case (كإجراء احترازي).

B2 · فوق المتوسط TOEIC 605–780 IELTS 5.5–6.5 الجمل الشرطية والعبارات
10 questions درجة النجاح: 70% Test 2

How to take the test

  • Read each question carefully and select the best answer.
  • The test is not timed — you can complete it at your own pace.
  • Click تسليم الاختبار when finished to see your score and detailed explanations.

سجّل دخولك لحفظ نتيجتك

يمكنك أداء هذا الاختبار دون تسجيل الدخول، لكن لن يتم حفظ نتيجتك. تسجيل الدخول لمتابعة تقدمك.

  1. 1

    Which of the following is NOT a keyword typically associated with a `switch` statement?

  2. 2

    In JavaScript, if you have `const user = null; const username = user?.name ?? 'Guest';`, what will `username` be?

  3. 3

    A function `processInput(data)` should immediately stop and return an error if `data` is null. Which alternative to `if-else` is best for this?

  4. 4

    To manage different actions based on user input (e.g., 'add', 'edit', 'delete'), you store functions in a dictionary/map where keys are the input strings and values are the corresponding functions. What is this technique called?

  5. 5

    Which operator provides a concise way to write conditional expressions, often replacing simple if-else statements?

  6. 6

    To provide a default empty object for a variable `options` if it's null or undefined, which operator is most suitable?

  7. 7

    You are building a system that needs to retrieve configuration values (e.g., `API_KEY`, `DATABASE_URL`) from 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?

  8. 8

    You are building a GUI application where various menu items (e.g., 'Save', 'Open', 'Copy') need to perform different actions when clicked. Instead of using a large `if-else if` block to check which item was clicked and then execute its logic, you encapsulate each action into a separate object. Which design pattern does this describe?

  9. 9

    Which of the following is a common use case for the ternary operator?

  10. 10

    You want to log a message only if a `debugMode` flag is true. Which short-circuiting operator can achieve this concisely?

← العودة إلى الموضوع