{
  "assessmentTests": {
    "javascript_test": {
      "name": "جاوا اسکرپٹ ٹیسٹ",
      "desc": "بنیادی syntax اور type coercion، functions/scope/closures اور this، objects/arrays اور ڈیٹا کی ساخت، اور event loop/async/prototype طریقے پر 30 منظر نامے کے سوالات — معلوم کریں کہ آپ کا جاوا اسکرپٹ اس سے مطابقت رکھتا ہے جو نوکری کی پوسٹنگ کا مطلب ہے۔",
      "recommendation": "آپ کی جاوا اسکرپٹ مہارت کا پروفائل",
      "results": {
        "beginner": {
          "name": "ابتدائی",
          "desc": "آپ کام کرنے والے functions اور objects لکھ سکتے ہیں، لیکن جو سوالات آپ غلط کر گئے ہیں وہ type coercion اور reference semantics کے بارے میں ہیں نہ کہ سادہ syntax کے بارے میں — مثلاً == خاموشی سے اقسام بدل دیتا ہے موازنے سے پہلے، ایک array کو کسی نئی جگہ ڈالنا صرف reference کاپی کرتا ہے ڈیٹا نہیں، یا NaN خود سے برابر نہیں ہے۔ یہ جاوا اسکرپٹ میں کمزور ہونے کا مطلب نہیں؛ یہ خاص اصول ہیں جو ان لوگوں کو الجھاتے ہیں جنہوں نے زبان سیکھی بغیر سمجھے کہ values اور references دراصل کیسے کام کرتے ہیں۔ یہ باتیں اہم ہیں کیونکہ ہر ایک وہ جگہ ہے جہاں کوڈ بغیر غلطی کے چل تو جاتا ہے لیکن غلط کام کرتا ہے۔",
          "recommendation": "تین چیزوں سے شروع کریں، اسی ترتیب میں: == کیوں اقسام بدل دیتا ہے جب کہ === نہیں، کیوں کسی array یا object کو نئی جگہ ڈالنا reference کاپی کرتا ہے قیمت نہیں، اور var کیسے hoisted ہوتا ہے اور undefined سے شروع ہوتا ہے جب کہ let اور const اپنی تعریف تک دستیاب نہیں ہوتے۔ MDN کی جاوا اسکرپٹ guide ان تینوں کو runnable مثالوں کے ساتھ سمجھاتی ہے۔"
        },
        "intermediate": {
          "name": "درمیانی",
          "desc": "آپ روز مرہ کی application کوڈ آرام سے handle کرتے ہیں — functions، array methods، سادہ control flow — اور معمولی feature کے کام میں سست نہیں ہوتے۔ یہاں سے Advanced تک کا فرق زیادہ تر اس میں ہے کہ کیا ہوتا ہے جب جاوا اسکرپٹ کے scoping اور timing اصول آپس میں ملتے ہیں: ایک var جو loop کے callbacks میں trapped ہے سب اسی آخری value کو پڑھتے ہوئے، ایک this جو خاموشی سے object سے aloof ہو جاتا ہے جب method کو کاٹا جاتا ہے، یا ایک spread copy جو گہرا لگتا ہے لیکن صرف ایک level کاپی کرتا ہے۔ یہ وہ قسم کی bugs ہیں جو تیزی سے پڑھنے میں نہیں آتے اور صرف کسی خاص runtime condition میں نظر آتے ہیں۔",
          "recommendation": "اس پر توجہ دیں کہ scope اور this دراصل کال کے وقت کیسے resolve ہوتے ہیں definition کے وقت نہیں: کیوں ایک var-based loop ہر callback کو وہی آخری counter قیمت دیتا ہے جب کہ let نہیں، یہ ہے کہ this کا تعین اس سے ہوتا ہے کہ function کو کیسے call کیا جاتا ہے نہ کہ یہ کہاں لکھا گیا ہے، اور کیوں spread یا Object.assign صرف object کی top level کاپی کرتا ہے۔ پھر event loop، کیونکہ یہ ان لوگوں کو الجھاتا ہے جو پہلے سے promises کو فرد وار سمجھتے ہیں۔"
        },
        "advanced": {
          "name": "ایڈوانسڈ",
          "desc": "یہ وہ level ہے جو اکثر job postings سے \"مضبوت جاوا اسکرپٹ\" کا مطلب ہے۔ آپ filter/map/reduce کی chain پڑھتے ہیں اور بالکل دیکھ سکتے ہیں کہ یہ کیا return کرے گی بغیر original array کو mutate کیے، آپ جانتے ہیں کہ synchronous console.log ہمیشہ microtask کو شکست دیتا ہے جو ہمیشہ setTimeout کو شکست دیتا ہے، اور آپ Promise.all کے لیے پہنچتے ہیں یہ جانتے ہوئے کہ یہ فوری reject کرتا ہے جیسے ہی کوئی promise reject ہو۔ جو چیز یہاں سے top تک فرق کرتی ہے وہ prototype اور object-model کا کام ہے: prototype chain کیسے inherited method کو resolve کرتا ہے بمقابلہ hasOwnProperty، اور class کا private #field دراصل کیا چھپاتا ہے۔",
          "recommendation": "Prototype chain میں جائیں: جاوا اسکرپٹ کیسے method lookups کو resolve کرتا ہے جو instance پر نہیں ہیں، class کے private #fields باہر سے کیا چھپاتے ہیں، اور JSON.stringify کیسے undefined اور functions کو مختلف طریقے سے handle کرتا ہے plain object میں بمقابلہ array میں۔ MDN کا event loop اور prototype chain کا مواد دونوں کے لیے اگلا قدرتی وقفہ ہے۔"
        },
        "expert": {
          "name": "ماہر",
          "desc": "آپ نے ہر section میں اعلیٰ ترین scores حاصل کیے — بنیادی syntax، types اور coercion؛ functions، scope، closures اور this؛ objects، arrays اور data structures؛ اور async، event loop، prototypes اور idioms۔ عملی لحاظ سے، اس کا مطلب ہے کہ آپ کسی اور کا function دیا جا سکتا ہے اور بتا سکتے ہیں کہ یہ کیوں وہ return کرتا ہے، نہ کہ صرف یہ کہ syntax کہتا ہے کہ یہ کیا کرنا چاہیے — یہ مشکل اور زیادہ قیمتی مہارت ہے۔ اس level پر زبان خود ہی شاذ و نادر حد تک محدود کرتا ہے؛ حد عام طور پر async control flow یا اس کے نیچے ڈیٹا کی shape ہوتا ہے۔",
          "recommendation": "اب returns design اور diagnosis میں ہیں: Promise.all اور Promise.race کے درمیان race condition کے بارے میں سوچنا بجائے definitions دہرانے کے، یہ منتخب کرنا کہ کب closure private state کے لیے صحیح ہے بمقابلہ کب class private field ہے، اور production logs میں microtask-vs-macrotask ordering bugs کو پڑھنا۔ اگر آپ کسی role کے لیے screen ہو رہے ہیں، تو ایک timing bug کو سمجھائیں جو آپ نے پایا — stale closure variable یا out-of-order async callback — بجائے صرف جاوا اسکرپٹ features کا نام دینے کے؛ یہ reasoning کو ظاہر کرتا ہے، نہ کہ صرف vocabulary کو۔"
        }
      },
      "questions": [
        {
          "question": "console.log(x);\nvar x = 5;\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "5"
            },
            {
              "icon": "",
              "label": "ReferenceError: x is not defined"
            },
            {
              "icon": "",
              "label": "undefined"
            },
            {
              "icon": "",
              "label": "null"
            }
          ]
        },
        {
          "question": "console.log(y);\nlet y = 5;\nکیا ہوتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "یہ ReferenceError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "یہ undefined print کرتا ہے"
            },
            {
              "icon": "",
              "label": "یہ 5 print کرتا ہے"
            },
            {
              "icon": "",
              "label": "یہ SyntaxError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "const arr = [1, 2, 3];\narr.push(4);\nconsole.log(arr.length);\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "4"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "3"
            },
            {
              "icon": "",
              "label": "undefined"
            }
          ]
        },
        {
          "question": "console.log('' == 0);\nconsole.log('' === 0);\nدونوں لائنیں کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "true پھر true"
            },
            {
              "icon": "",
              "label": "false پھر false"
            },
            {
              "icon": "",
              "label": "true پھر false"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "console.log(NaN === NaN);\nconsole.log(Number.isNaN(NaN));\nدونوں لائنیں کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "true پھر true"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "false پھر false"
            },
            {
              "icon": "",
              "label": "false پھر true"
            }
          ]
        },
        {
          "question": "console.log(typeof null);\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "\"null\""
            },
            {
              "icon": "",
              "label": "\"object\""
            },
            {
              "icon": "",
              "label": "\"undefined\""
            },
            {
              "icon": "",
              "label": "\"boolean\""
            }
          ]
        },
        {
          "question": "مندرجہ ذیل میں سے کون truthy ہے جب if condition میں استعمال ہو؟",
          "options": [
            {
              "icon": "",
              "label": "0"
            },
            {
              "icon": "",
              "label": "\"\" (خالی string)"
            },
            {
              "icon": "",
              "label": "null"
            },
            {
              "icon": "",
              "label": "\"0\" (صفر والی string)"
            }
          ]
        },
        {
          "question": "foo();\nfunction foo() { console.log('a'); }\nbar();\nvar bar = function() { console.log('b'); };\nکیا ہوتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "دونوں calls print کرتی ہیں، \"a\" اور پھر \"b\""
            },
            {
              "icon": "",
              "label": "foo() \"a\" print کرتا ہے؛ bar() TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "foo() اور bar() دونوں ReferenceError throw کرتے ہیں"
            },
            {
              "icon": "",
              "label": "foo() ReferenceError throw کرتا ہے؛ bar() \"b\" print کرتا ہے"
            }
          ]
        },
        {
          "question": "function makeCounter() {\n  let count = 0;\n  return function() { count++; return count; };\n}\nconst counter = makeCounter();\nconsole.log(counter());\nconsole.log(counter());\nدونوں لائنیں کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "1 پھر 1"
            },
            {
              "icon": "",
              "label": "NaN پھر NaN"
            },
            {
              "icon": "",
              "label": "undefined پھر undefined"
            },
            {
              "icon": "",
              "label": "1 پھر 2"
            }
          ]
        },
        {
          "question": "for (var i = 0; i < 3; i++) {\n  setTimeout(() => console.log(i), 0);\n}\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "0, 1, 2"
            },
            {
              "icon": "",
              "label": "3, 3, 3"
            },
            {
              "icon": "",
              "label": "یہ ReferenceError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "undefined, undefined, undefined"
            }
          ]
        },
        {
          "question": "for (let i = 0; i < 3; i++) {\n  setTimeout(() => console.log(i), 0);\n}\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "3, 3, 3"
            },
            {
              "icon": "",
              "label": "یہ ReferenceError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "undefined, undefined, undefined"
            },
            {
              "icon": "",
              "label": "0, 1, 2"
            }
          ]
        },
        {
          "question": "function greet() { return `Hi, ${this.name}`; }\nconst person = { name: 'Ana' };\nconsole.log(greet.call(person));\nیہ کیا print کرے گا؟",
          "options": [
            {
              "icon": "",
              "label": "\"Hi, Ana\""
            },
            {
              "icon": "",
              "label": "\"Hi, undefined\""
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "\"Hi, ${this.name}\""
            }
          ]
        },
        {
          "question": "const timer = {\n  seconds: 0,\n  start: function() {\n    setInterval(() => { this.seconds++; }, 1000);\n  },\n};\nلوگ arrow function کو setInterval میں function() { this.seconds++ } کی بجائے کیوں prefer کرتے ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "Arrow functions start کا this استعمال کرتی ہیں، جو timer ہے"
            },
            {
              "icon": "",
              "label": "Arrow functions عام functions سے زیادہ تیز چلتی ہیں"
            },
            {
              "icon": "",
              "label": "Arrow functions میں this، global object سے bind ہو جاتا ہے"
            },
            {
              "icon": "",
              "label": "Arrow functions میں this ایک global variable بن جاتا ہے"
            }
          ]
        },
        {
          "question": "function multiply(a, b) { return a * b; }\nconst double = multiply.bind(null, 2);\nconsole.log(double(5));\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "5"
            },
            {
              "icon": "",
              "label": "10"
            },
            {
              "icon": "",
              "label": "NaN"
            },
            {
              "icon": "",
              "label": "7"
            }
          ]
        },
        {
          "question": "function outer() {\n  let x = 10;\n  function inner() {\n    let x = 20;\n    console.log(x);\n  }\n  inner();\n  console.log(x);\n}\nouter();\nیہ دونوں console.log کالز کیا print کرتے ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "20 اور پھر 20"
            },
            {
              "icon": "",
              "label": "20 اور پھر 10"
            },
            {
              "icon": "",
              "label": "10 اور پھر 10"
            },
            {
              "icon": "",
              "label": "یہ SyntaxError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "const a = [1, 2, 3];\nconst b = a;\nb.push(4);\nconsole.log(a.length);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "3"
            },
            {
              "icon": "",
              "label": "undefined"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "4"
            }
          ]
        },
        {
          "question": "const original = { name: 'Ana', tags: ['x', 'y'] };\nconst copy = { ...original };\ncopy.name = 'Bea';\ncopy.tags.push('z');\nconsole.log(original.name, original.tags.length);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "'Ana' 2"
            },
            {
              "icon": "",
              "label": "'Ana' 3"
            },
            {
              "icon": "",
              "label": "'Bea' 3"
            },
            {
              "icon": "",
              "label": "'Bea' 2"
            }
          ]
        },
        {
          "question": "const { a: x = 10, b: y = 20 } = { a: 5 };\nconsole.log(x, y);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "undefined undefined"
            },
            {
              "icon": "",
              "label": "5 undefined"
            },
            {
              "icon": "",
              "label": "10 20"
            },
            {
              "icon": "",
              "label": "5 20"
            }
          ]
        },
        {
          "question": "const [first, ...rest] = [1, 2, 3, 4];\nconsole.log(rest);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "[1, 2, 3, 4]"
            },
            {
              "icon": "",
              "label": "[2, 3, 4]"
            },
            {
              "icon": "",
              "label": "2"
            },
            {
              "icon": "",
              "label": "[1]"
            }
          ]
        },
        {
          "question": "const nums = [10, 1, 2];\nnums.sort();\nconsole.log(nums);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "[1, 2, 10]"
            },
            {
              "icon": "",
              "label": "[10, 1, 2]"
            },
            {
              "icon": "",
              "label": "[1, 10, 2]"
            },
            {
              "icon": "",
              "label": "[2, 1, 10]"
            }
          ]
        },
        {
          "question": "const user = { profile: { age: 0 } };\nconsole.log(user.profile?.age ?? 'unknown');\nconsole.log(user.address?.city ?? 'unknown');\nیہ دونوں lines کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "'unknown' اور پھر 'unknown'"
            },
            {
              "icon": "",
              "label": "0 اور پھر 'unknown'"
            },
            {
              "icon": "",
              "label": "0 اور پھر undefined"
            },
            {
              "icon": "",
              "label": "'unknown' اور پھر 0"
            }
          ]
        },
        {
          "question": "const obj = { a: undefined, b: function(){}, c: NaN, d: [undefined, function(){}, 1] };\nconsole.log(JSON.stringify(obj));\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "'{\"a\":null,\"b\":null,\"c\":null,\"d\":[null,null,1]}'"
            },
            {
              "icon": "",
              "label": "'{\"c\":NaN,\"d\":[1]}'"
            },
            {
              "icon": "",
              "label": "'{\"c\":null,\"d\":[null,null,1]}'"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "console.log('1');\nsetTimeout(() => console.log('2'), 0);\nPromise.resolve().then(() => console.log('3'));\nconsole.log('4');\nیہ کس ترتیب میں print ہوتے ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "1, 2, 3, 4"
            },
            {
              "icon": "",
              "label": "1, 4, 2, 3"
            },
            {
              "icon": "",
              "label": "1, 4, 3, 2"
            },
            {
              "icon": "",
              "label": "1, 3, 4, 2"
            }
          ]
        },
        {
          "question": "async function foo() {\n  console.log('a');\n  await null;\n  console.log('b');\n}\nconsole.log('start');\nfoo();\nconsole.log('end');\nیہ کس ترتیب میں print ہوتے ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "start, a, end, b"
            },
            {
              "icon": "",
              "label": "start, a, b, end"
            },
            {
              "icon": "",
              "label": "start, end, a, b"
            },
            {
              "icon": "",
              "label": "a, start, end, b"
            }
          ]
        },
        {
          "question": "Promise.all([\n  Promise.resolve(1),\n  Promise.reject('err'),\n  Promise.resolve(3),\n]).then(r => console.log('ok', r)).catch(e => console.log('fail', e));\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "'fail err'"
            },
            {
              "icon": "",
              "label": "'ok' [1, 3]"
            },
            {
              "icon": "",
              "label": "'ok' [1, undefined, 3]"
            },
            {
              "icon": "",
              "label": "یہ throw کرتا ہے، اور کوئی handler نہیں چلتا"
            }
          ]
        },
        {
          "question": "const fast = new Promise(res => setTimeout(() => res('fast'), 10));\nconst slow = new Promise(res => setTimeout(() => res('slow'), 100));\nPromise.race([fast, slow]).then(v => console.log(v));\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "'slow'"
            },
            {
              "icon": "",
              "label": "['fast', 'slow']"
            },
            {
              "icon": "",
              "label": "'fast'"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "function Animal(name) { this.name = name; }\nAnimal.prototype.speak = function() { return `${this.name} makes a sound`; };\nconst dog = new Animal('Rex');\nconsole.log(dog.speak());\nconsole.log(dog.hasOwnProperty('speak'));\nیہ دونوں lines کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "'Rex makes a sound' اور پھر true"
            },
            {
              "icon": "",
              "label": "undefined اور پھر false"
            },
            {
              "icon": "",
              "label": "یہ TypeError throw کرتا ہے"
            },
            {
              "icon": "",
              "label": "'Rex makes a sound' اور پھر false"
            }
          ]
        },
        {
          "question": "class Counter {\n  #count = 0;\n  increment() { this.#count++; return this.#count; }\n}\nconst c = new Counter();\nconsole.log(c.increment());\nconsole.log(c.count);\nیہ دونوں lines کیا print کرتی ہیں؟",
          "options": [
            {
              "icon": "",
              "label": "1 اور پھر undefined"
            },
            {
              "icon": "",
              "label": "1 اور پھر 0"
            },
            {
              "icon": "",
              "label": "1 اور پھر 1"
            },
            {
              "icon": "",
              "label": "یہ SyntaxError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "const items = ['a', 'b'];\nconst label = `Items: ${items.length > 0 ? items.join(', ') : 'none'}`;\nconsole.log(label);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "'Items: ${items.length > 0 ? items.join(\\', \\') : \\'none\\'}'"
            },
            {
              "icon": "",
              "label": "'Items: none'"
            },
            {
              "icon": "",
              "label": "'Items: a, b'"
            },
            {
              "icon": "",
              "label": "یہ SyntaxError throw کرتا ہے"
            }
          ]
        },
        {
          "question": "const nums = [1, 2, 3, 4, 5];\nconst result = nums.filter(n => n % 2 === 0).map(n => n * 10).reduce((sum, n) => sum + n, 0);\nconsole.log(result, nums);\nیہ کیا print کرتا ہے؟",
          "options": [
            {
              "icon": "",
              "label": "60 [1, 2, 3, 4, 5]"
            },
            {
              "icon": "",
              "label": "60 [2, 4, 20, 40]"
            },
            {
              "icon": "",
              "label": "150 [1, 2, 3, 4, 5]"
            },
            {
              "icon": "",
              "label": "60 [20, 40]"
            }
          ]
        }
      ],
      "optionOrderVersion": "7335aa056fc9d33a"
    }
  },
  "testNames": {
    "javascript-test": "JavaScript ٹیسٹ"
  }
}
