पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
निम्नलिखित उदाहरण में दिखाया गया Conditional Operator _________ है। marks = (mark<35)?"Fail":"Pass";
The Conditional Operator shown in the following example is a _____________. marks = (mark<35)?"Fail":"Pass";
ATernary Operator
BUnary Operator
Cइनमें से कोई नहींNone of these
DBinary Operator
सही उत्तर / Answer: (A)
हल / Solution
operator का प्रकार operands की गिनती से तय होता है। इस उदाहरण में तीन हिस्से हैं: शर्त (mark<35), true होने पर मान "Fail" और false होने पर मान "Pass"। तीन operands होने से यह ternary operator है। JavaScript में यह अकेला ternary operator है। unary में एक operand होता है, जैसे ++x, और binary में दो, जैसे a + b। सही प्रकार मौजूद है, इसलिए इनमें से कोई नहीं ग़लत है।
An operator's type depends on how many operands it takes. This example has three parts: the condition (mark<35), the value "Fail" when it is true, and the value "Pass" when it is false. Three operands make it a ternary operator, the only one in JavaScript. A unary operator has one operand, like ++x, and a binary one has two, like a + b. So none of these is wrong.
प्रश्न 2उत्तर + हल
निम्नलिखित उदाहरण में प्रयुक्त टर्नरी ऑपरेटर को किस नाम से जाना जाता है? marks = (mark<35)?"Fail":"Pass";
By what name is the ternary operator used in the following example known? marks = (mark<35)?"Fail":"Pass";
AColon Operator
BConditional Operator
CLogical Operator
DBitwise Operator
सही उत्तर / Answer: (B)
हल / Solution
इस पंक्ति में ? और : वाला operator है, जिसे conditional operator कहते हैं। तीन operands होने से इसे ternary operator भी कहते हैं। यहाँ शर्त mark < 35 है। true हो तो marks में "Fail" जाएगा, वरना "Pass"। colon इस operator का सिर्फ़ एक हिस्सा है, कोई अलग operator नहीं। यहाँ && या || नहीं है, इसलिए logical नहीं, और bits पर काम नहीं होता, इसलिए bitwise भी नहीं।
This line uses the operator made of ? and :, which is called the conditional operator. Because it takes three operands, it is also known as the ternary operator. Here the condition is mark < 35. If it is true, marks gets "Fail"; otherwise it gets "Pass". The colon is only one part of this operator. There is no && or ||, so it is not logical, and no bits are used, so it is not bitwise.
प्रश्न 3उत्तर + हल
JavaScript में एक _____ होता है जो किसी शर्त के आधार पर एक वेरिएबल को मान देता है।
JavaScript contains a _____ that assigns a value to a variable based on some condition.
AConditional operator
BLogical operator
CAssignment operator
DBitwise operator
सही उत्तर / Answer: (A)
हल / Solution
conditional operator को ternary operator भी कहते हैं। इसका रूप है condition ? value1 : value2। शर्त true हो तो पहला मान मिलता है, false हो तो दूसरा। जैसे let result = (age >= 18) ? "Adult" : "Minor"। assignment operator मान रखता तो है, पर शर्त नहीं देखता। logical operator true या false जोड़ते हैं, और bitwise operator bits पर काम करते हैं।
The conditional operator is also called the ternary operator. Its form is condition ? value1 : value2. If the condition is true, the first value is chosen; if false, the second. For example, let result = (age >= 18) ? "Adult" : "Minor". The assignment operator stores a value but checks no condition. Logical operators combine true and false values, and bitwise operators work on bits.
प्रश्न 4उत्तर + हल
निम्नलिखित में से किस ऑपरेटर का उपयोग दो स्ट्रिंग्स को जोड़ने के लिए किया जाता है?
Which of the following operators is used to concatenate two strings?
APlus (+)
BDot (.)
CArrow (=>)
DComma (,)
सही उत्तर / Answer: (A)
हल / Solution
JavaScript में strings जोड़ने के लिए plus (+) operator लगता है। जैसे "Good" + "Morning" से "GoodMorning" बनता है। += से भी किसी string के आगे और पाठ जोड़ा जा सकता है। dot (.) PHP में strings जोड़ता है, पर JavaScript में वह object की property पढ़ने के काम आता है। arrow (=>) arrow function बनाता है, और comma (,) values या parameters अलग करता है।
In JavaScript, strings are joined with the plus (+) operator. For example, "Good" + "Morning" gives "GoodMorning". The += form can also add more text to an existing string. The dot (.) joins strings in PHP, but in JavaScript it is used to read an object property. The arrow (=>) creates an arrow function, and the comma (,) separates values or parameters.
प्रश्न 5उत्तर + हल
किसी वेरिएबल को मान देने (assign करने) के लिए किस ऑपरेटर का उपयोग किया जाता है?
Which operator is used to assign a value to a variable?
AX
B-
C*
D=
सही उत्तर / Answer: (D)
हल / Solution
किसी चर में मान रखने के लिए assignment operator = लगता है। यह दाईं ओर का मान लेकर बाईं ओर के चर में रख देता है, जैसे let age = 20। यहाँ = का अर्थ गणित वाला बराबर नहीं, बल्कि रखो है। - घटाने का arithmetic operator है और * गुणा करने का। X तो JavaScript में कोई operator है ही नहीं, वह एक साधारण चर का नाम हो सकता है।
To store a value in a variable, the assignment operator = is used. It takes the value on the right and places it in the variable on the left, as in let age = 20. Here = does not mean equal as in maths; it means store. The - sign is the arithmetic operator for subtraction and * is for multiplication. X is not an operator at all; it could only be a variable name.
प्रश्न 6उत्तर + हल
निम्नलिखित JavaScript कोड का आउटपुट क्या होगा? var x = 13 + "03"; alert(x);
What will be the output of the following JavaScript code? var x = 13 + "03"; alert(x);
A16
B133
C1303
D13 03
सही उत्तर / Answer: (C)
हल / Solution
+ के एक ओर string हो तो JavaScript जोड़ नहीं करता, दोनों को string बनाकर जोड़ देता है। यहाँ 13 number है और "03" string है। इसलिए 13 भी "13" बन जाता है और नतीजा "13" + "03" = "1303" आता है। "03" का आगे वाला 0 नहीं हटता, इसलिए 133 ग़लत है। 16 तब आता जब दोनों number होते। बीच में कोई space नहीं जुड़ता, इसलिए 13 03 भी ग़लत है।
When one side of + is a string, JavaScript does not add; it turns both sides into strings and joins them. Here 13 is a number and "03" is a string. So 13 becomes "13", and the result is "13" + "03" = "1303". The leading 0 of "03" is kept, so 133 is wrong. 16 would appear only if both were numbers. No space is added, so 13 03 is wrong too.
प्रश्न 7उत्तर + हल
कौन-सा असाइनमेंट ऑपरेटर a = a * 5 के बराबर है?
Which assignment operator is equivalent to a = a * 5?
Aa = 5*9
Ba = * 5
Ca *= 5
Da = 5
सही उत्तर / Answer: (C)
हल / Solution
a *= 5 compound assignment है। इसका मतलब है a का मौजूदा मान 5 से गुणा करो और नतीजा फिर a में रख दो, यानी ठीक a = a * 5। ध्यान दीजिए कि * और = के बीच जगह नहीं होती। a = * 5 में क्रम उलटा है, इसलिए यह SyntaxError देता है। a = 5*9 हमेशा 45 रखता है और a = 5 सिर्फ़ 5 रखता है, a का पुराना मान काम में नहीं आता।
The form a *= 5 is a compound assignment. It means multiply the current value of a by 5 and store the result back in a, which is exactly a = a * 5. Note that there is no space between * and =. In a = * 5 the order is wrong, so it gives a SyntaxError. The form a = 5*9 always stores 45, and a = 5 stores 5; neither uses the old a.
प्रश्न 8उत्तर + हल
JavaScript में मान (value) और प्रकार (type) दोनों को जाँचने के लिए किस ऑपरेटर का उपयोग किया जाता है?
Which operator is used to check both value and type in JavaScript?
A#
B=
C==
D===
सही उत्तर / Answer: (D)
हल / Solution
=== को strict equality operator कहते हैं। यह type नहीं बदलता, इसलिए मान और type दोनों मिलें तभी true देता है। जैसे 10 === "10" false है, क्योंकि एक number है और दूसरा string। == पहले type बदलकर सिर्फ़ मान मिलाता है, इसलिए 10 == "10" true आता है। = तुलना नहीं करता, मान रखता है। # तो कोई तुलना operator है ही नहीं।
The === sign is the strict equality operator. It does not convert types, so it returns true only when both value and type match. For example, 10 === "10" is false because one is a number and the other a string. The == sign converts types first and compares only the values, so 10 == "10" is true. The = sign stores a value, and # is not a comparison operator.
प्रश्न 9उत्तर + हल
JavaScript में 'असाइनमेंट' ऑपरेटर का चिह्न कौन-सा है?
Which sign is the 'assignment' operator in JavaScript?
A=
B#
C==
D<>
सही उत्तर / Answer: (A)
हल / Solution
अकेला = चिह्न assignment operator है। यह दाईं ओर का मान बाईं ओर के चर में रख देता है, जैसे let x = 10। == तुलना का operator है, जो बराबरी जाँचकर true या false देता है। # JavaScript में class के private field के नाम में लगता है, operator नहीं है। <> कुछ दूसरी भाषाओं में not equal है, पर JavaScript में यह operator नहीं है।
A single = sign is the assignment operator. It stores the right-hand value in the variable on the left, as in let x = 10. The == sign is a comparison operator that checks equality and returns true or false. The # sign is only used in names of private class fields, not as an operator. The <> sign means not equal in some other languages, but not in JavaScript.
प्रश्न 10उत्तर + हल
JavaScript में फ़ंक्शन के पैरामीटर नामों को अलग करने वाला चिह्न कौन-सा है?
Which is the parameter name separator in JavaScript?
A,
B:
C-
D/
सही उत्तर / Answer: (A)
हल / Solution
function में एक से ज़्यादा parameters हों तो उन्हें comma (,) से अलग किया जाता है। जैसे function add(a, b, c) { return a + b + c; }। function बुलाते समय arguments भी comma से ही अलग होते हैं, जैसे add(1, 2, 3)। colon (:) object में key और value अलग करता है। - घटाने का operator है और / भाग देने का, इसलिए ये विकल्प ग़लत हैं।
When a function has more than one parameter, the names are separated by a comma (,). For example, function add(a, b, c) { return a + b + c; }. Arguments are also separated by commas when the function is called, as in add(1, 2, 3). The colon (:) separates a key from its value in an object. The - sign subtracts and / divides, so those options are wrong.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति