CHAPTER 05 · 5 LESSONS

05 · Modules and explicit imports

Modules let a lesson separate a public API from implementation details.

YOUR CHAPTER LEARNING PATH · सीखने का क्रम

Read. Check. Build.

Three linked steps using real Scarp source and verified output.

  1. Read the lessons · पाठ पढ़ें

    Work through all 5 verified examples. Save optional local lesson progress as you learn; this does not certify code execution.

    Start with Modular Inference ↗

    Lesson tracking is optional and only available when browser storage works.

  2. Check understanding · समझ जाँचें

    Try 3 bilingual questions linked directly to their original source and expected output. No quiz score is stored.

    Review all three questions here · यहाँ अभ्यास करें ↓
  3. Write Scarp · कोड लिखें

    Edit the real starter locally, compare output with the compiler-verified goal, and use the hint or tested solution when needed.

    Open Use a public module binding lab ↗

Lesson completion is voluntary local tracking. Passing a quiz or lab is not automatically recorded or claimed by this website. The Scarp compiler runs locally, not in your browser.

Lessons in this chapter

Practice this chapter · इस अध्याय का अभ्यास करें 3 bilingual, compiler-evidenced questions

Answer all three questions using the checked-in lessons. Feedback runs only in your browser; there is no stored score, automatic lesson completion or Scarp execution. Answers remain readable without JavaScript.

Question 1 of 3 · Modular Inference · View source and recorded output ↗

SOURCE-BACKED SELF-CHECK · स्रोत-आधारित अभ्यास

Quick checkpoint / त्वरित अभ्यास

Which score vector is returned by linear.predict([2.0, 1.0]) in this example?इस उदाहरण में linear.predict([2.0, 1.0]) कौन-सा स्कोर वेक्टर देता है?

Reveal the source-backed answer / सही उत्तर देखें

[4.0, 1.0] — The imported linear module computes the scores. The pinned fixture for this lesson prints [4.0, 1.0].[4.0, 1.0] — इम्पोर्ट किया गया linear मॉड्यूल स्कोर निकालता है। इस पाठ के सत्यापित आउटपुट में [4.0, 1.0] प्रिंट होता है।

This question checks understanding of a recorded compiler output. It does not run Scarp in the browser. यह प्रश्न सत्यापित आउटपुट पर आधारित है; ब्राउज़र में Scarp नहीं चलता।

Question 2 of 3 · Constant Expressions · View source and recorded output ↗

SOURCE-BACKED SELF-CHECK · स्रोत-आधारित अभ्यास

Quick checkpoint / त्वरित अभ्यास

What is the value of doubled when constants.answer is 42?constants.answer का मान 42 होने पर doubled का मान क्या होता है?

Reveal the source-backed answer / सही उत्तर देखें

84 — The exported binding doubled is constants.answer multiplied by 2. With answer = 42, doubled is 84.84 — exported binding doubled में constants.answer को 2 से गुणा किया गया है। 42 × 2 = 84।

This question checks understanding of a recorded compiler output. It does not run Scarp in the browser. यह प्रश्न सत्यापित आउटपुट पर आधारित है; ब्राउज़र में Scarp नहीं चलता।

Question 3 of 3 · Integer Series · View source and recorded output ↗

SOURCE-BACKED SELF-CHECK · स्रोत-आधारित अभ्यास

Quick checkpoint / त्वरित अभ्यास

What value does series.low_bits & 0x3 print in this example?इस उदाहरण में series.low_bits & 0x3 कौन-सा मान प्रिंट करता है?

Reveal the source-backed answer / सही उत्तर देखें

3 — The bitwise AND mask 0x3 keeps the lowest two bits; the checked output ends with 3.3 — bitwise AND मास्क 0x3 सबसे निचले दो बिट रखता है; सत्यापित आउटपुट का अंतिम मान 3 है।

This question checks understanding of a recorded compiler output. It does not run Scarp in the browser. यह प्रश्न सत्यापित आउटपुट पर आधारित है; ब्राउज़र में Scarp नहीं चलता।

All examples are validated with Scarp v0.0.6-alpha.3. Each lesson has its own code and expected-output page.