FliQi Education App Download
प्रश्न-बैंक · Web Technology

Functions — प्रश्न और उत्तर

Web Technology · 56 जाँचे हुए (verified) प्रश्न

  • 56 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
हम अलर्ट बॉक्स में "Hello World" कैसे लिखते हैं?
How do we write "Hello World" in an alert box?
  1. AalertBox("Hello World");
  2. BmsgBox("Hello World");
  3. Cmsg("Hello World");
  4. Dalert("Hello World");

सही उत्तर / Answer: (D)

हल / Solution
जावास्क्रिप्ट में alert बॉक्स window ऑब्जेक्ट की alert() method से खुलता है। जो संदेश दिखाना हो, उसे quotes में argument बनाकर देते हैं, जैसे alert("Hello World"); इससे OK बटन वाला एक छोटा बॉक्स खुलता है। alertBox() और msg() जावास्क्रिप्ट में बने ही नहीं हैं, इसलिए इन्हें बुलाने पर त्रुटि आएगी। msgBox() VBScript का फ़ंक्शन है, जावास्क्रिप्ट का नहीं। इसलिए सिर्फ़ विकल्प 4 चलता है।
In JavaScript, an alert box is opened with the alert() method of the window object. The message is passed as a quoted string argument, as in alert("Hello World"); which shows a small box with an OK button. alertBox() and msg() are not built-in JavaScript functions, so calling them raises a ReferenceError. msgBox() belongs to VBScript, not JavaScript, which is why only option 4 works.
प्रश्न 2उत्तर + हल
जावास्क्रिप्ट में किसी फ़ंक्शन को परिभाषित करने का सबसे सामान्य तरीका ____ कीवर्ड का उपयोग करना है।
The most common way to define a function in JavaScript is by using the ____ keyword.
  1. Afun
  2. Bvar
  3. Cfunction
  4. Ddefine

सही उत्तर / Answer: (C)

हल / Solution
जावास्क्रिप्ट में फ़ंक्शन बनाने का सबसे आम तरीका function कीवर्ड है। पहले function लिखते हैं, फिर नाम, फिर कोष्ठक में parameters और अंत में { } के अंदर code, जैसे function add(a, b) { return a + b; }। fun जावास्क्रिप्ट का कीवर्ड नहीं है, यह Kotlin जैसी भाषा में चलता है। var से variable घोषित होता है, फ़ंक्शन नहीं। define भी जावास्क्रिप्ट का कोई कीवर्ड नहीं है।
The standard way to create a function in JavaScript is the function keyword. You write function, then the name, the parameters in parentheses and the body in braces, as in function add(a, b) { return a + b; }. fun is not a JavaScript keyword; it is used in languages such as Kotlin. var declares a variable, not a function, although a variable can hold one. define is not a JavaScript keyword at all.
प्रश्न 3उत्तर + हल
जावास्क्रिप्ट में किस प्रकार के पॉप-अप बॉक्स उपलब्ध हैं?
What types of pop-up boxes are available in JavaScript?
  1. AAlert
  2. BPrompt
  3. CConfirm
  4. DAll of these

सही उत्तर / Answer: (D)

हल / Solution
जावास्क्रिप्ट में तीन तरह के पॉप-अप बॉक्स होते हैं और तीनों window ऑब्जेक्ट की method हैं। alert() सिर्फ़ संदेश दिखाता है और OK दबाने तक रुकता है। confirm() में OK और Cancel होते हैं, और यह true या false लौटाता है। prompt() उपयोगकर्ता से text लेता है और वही string लौटाता है; Cancel दबाने पर null मिलता है। तीनों मौजूद हैं, इसलिए अकेला कोई एक विकल्प अधूरा है और सही उत्तर All of these है।
JavaScript offers three kinds of pop-up boxes, and all three are methods of the window object. alert() just shows a message and waits for OK. confirm() shows OK and Cancel and returns true or false. prompt() asks the user to type something and returns that string, or null if Cancel is pressed. Since all three exist, picking any single one would be incomplete, so the answer is "All of these".
प्रश्न 4उत्तर + हल
जावास्क्रिप्ट कोड को ___ का उपयोग करके कॉल किया जा सकता है।
JavaScript code can be called by using ___.
  1. APreprocessor
  2. BFunction/Method
  3. CRMI
  4. DTriggering Event

सही उत्तर / Answer: (B)

हल / Solution
जावास्क्रिप्ट में कोड का एक हिस्सा फ़ंक्शन या ऑब्जेक्ट की method में रखा जाता है। फिर उसके नाम से उसे बुलाया (call) जाता है, जैसे greet(); या document.write()। क्लिक जैसा ईवेंट भी आख़िर में किसी फ़ंक्शन, यानी event handler, को ही बुलाता है। इसलिए कोड बुलाने का असली ज़रिया फ़ंक्शन/method है। Preprocessor, C जैसी भाषाओं में compile से पहले का चरण है। RMI जावा में दूसरी मशीन की method बुलाने की तकनीक है।
In JavaScript, a piece of code is wrapped in a function or an object method and then run by calling it by name, as in greet(); or document.write(). Even an event such as a click ends up calling a function, the event handler, so the real mechanism is a function or method call. A preprocessor is a pre-compilation step in languages like C, and RMI is Java's way of invoking methods on another machine.
प्रश्न 5उत्तर + हल
getSelection() को कौन-सा कथन सबसे अच्छी तरह समझाता है?
Which best explains getSelection()?
  1. AReturns the VALUE of a selected OPTION.
  2. BReturns document.URL of the window in focus.
  3. CReturns the value of cursor-selected text
  4. DReturns the VALUE of a checked radio input.

सही उत्तर / Answer: (C)

हल / Solution
window.getSelection() उस text को लौटाता है जिसे उपयोगकर्ता ने cursor या mouse से चुना है। असल में यह एक Selection ऑब्जेक्ट देता है, और उस पर toString() लगाने से चुना हुआ text मिल जाता है। इसलिए विकल्प 3 सही है। किसी select सूची के चुने गए option की value select.value से मिलती है। पेज का URL document.URL या location.href से मिलता है। चुने हुए radio बटन की value उसके value गुण से पढ़ी जाती है।
window.getSelection() returns the text the user has highlighted with the cursor or mouse. Strictly it returns a Selection object, and calling toString() on it gives the selected text, so option 3 is correct. The value of a chosen option in a select list comes from select.value. The page address comes from document.URL or location.href. The value of a checked radio button is read from its value property, not from getSelection().
प्रश्न 6उत्तर + हल
बटन ऑब्जेक्ट में blur विधि का सिंटैक्स ____ है।
The syntax of the blur method in a button object is ____.
  1. ABlur()
  2. BBlur(contrast)
  3. CBlur(value)
  4. DBlur(depth)

सही उत्तर / Answer: (A)

हल / Solution
blur() विधि किसी तत्व, जैसे बटन, से फ़ोकस हटा देती है। यह focus() का उलटा काम करती है। इसे बिना किसी argument के बुलाते हैं, जैसे document.getElementById("btn").blur(); इसलिए सही सिंटैक्स blur() है। विकल्प 2, 3 और 4 में contrast, value और depth जैसे argument दिए गए हैं। blur() कोई argument लेती ही नहीं, इसलिए ये तीनों ग़लत हैं। CSS वाले blur फ़िल्टर से इसे मत मिलाइए।
The blur() method removes focus from an element such as a button, doing the opposite of focus(). It is called with no arguments, for example document.getElementById("btn").blur(); so the correct syntax is blur(). Options 2, 3 and 4 pass arguments such as contrast, value or depth, but blur() takes none, so all three are wrong. Do not confuse it with the CSS blur() filter, which does take a length.
प्रश्न 7उत्तर + हल
जब प्रपत्र (form) तत्व फ़ोकस खो देता है, तो निम्न में से कौन-सा ईवेंट सक्रिय होता है: <button>, <input>, <label>, <select>, <textarea>?
Which of the following events fires when a form element loses focus: <button>, <input>, <label>, <select>, <textarea>?
  1. Aonfocus
  2. Bonblur
  3. Conclick
  4. Dondblclick

सही उत्तर / Answer: (B)

हल / Solution
जब कोई form तत्व, जैसे textbox या select सूची, फ़ोकस खो देता है तब blur ईवेंट होता है। इसे onblur से पकड़ते हैं। उपयोगकर्ता Tab दबाकर या बाहर क्लिक करके आगे बढ़ता है, तभी यह चलता है। इसलिए भरे हुए खाने की तुरंत जाँच (validation) में यह बहुत काम आता है। onfocus इसका उलटा है, यह फ़ोकस मिलने पर चलता है। onclick एक क्लिक पर और ondblclick दो बार क्लिक करने पर चलता है।
The blur event fires when a form element such as a text box or select list loses focus, and onblur is the handler that catches it. It runs when the user presses Tab or clicks somewhere else, which makes it handy for validating a field right after it is filled. onfocus is the opposite, firing when the element gains focus. onclick fires on a single click and ondblclick on a double click, so neither is about losing focus.
प्रश्न 8उत्तर + हल
जावास्क्रिप्ट में कौन-सा वेरिएबल फ़ंक्शन आर्ग्युमेंट के रूप में काम करता है?
Which variable works as a function argument in JavaScript?
  1. AFunction variable
  2. BGlobal variable
  3. CLocal variable
  4. DObject variable

सही उत्तर / Answer: (C)

हल / Solution
फ़ंक्शन के कोष्ठक में लिखे parameters फ़ंक्शन के अंदर local variable की तरह काम करते हैं। जब फ़ंक्शन बुलाया जाता है, तब हर argument की value इन्हीं में आती है। जैसे function add(a, b) में a और b सिर्फ़ add के अंदर मौजूद रहते हैं और फ़ंक्शन ख़त्म होते ही मिट जाते हैं। Global variable फ़ंक्शन के बाहर घोषित होता है और हर जगह दिखता है। Function variable और Object variable जावास्क्रिप्ट में वेरिएबल के प्रकार नहीं हैं।
Parameters written inside a function's parentheses behave as local variables of that function. When the function is called, each argument value is copied into them. In function add(a, b), the names a and b exist only inside add and vanish when it returns. A global variable is declared outside every function and is visible everywhere. "Function variable" and "Object variable" are not variable kinds in JavaScript, so the answer is local variable.
प्रश्न 9उत्तर + हल
किसी सरणी में नया तत्व जोड़ने के लिए किस विधि का उपयोग किया जाता है?
Which method is used to add new element to an array?
  1. AJoin()
  2. BPush()
  3. CPop()
  4. DShift()

सही उत्तर / Answer: (B)

हल / Solution
push नया तत्व सरणी के अंत में जोड़ देता है और जोड़ने के बाद की नई लंबाई लौटाता है। एक बार में कई तत्व भी दिए जा सकते हैं। मूल सरणी ही बदलती है, नई सरणी नहीं बनती। pop अंतिम तत्व हटाता है और shift पहला तत्व, यानी दोनों घटाने का काम करते हैं। join सिर्फ़ तत्वों को जोड़कर स्ट्रिंग बनाता है, सरणी में कुछ जोड़ता नहीं।
push adds a new element at the end of the array and returns the new length after adding. Several elements can be passed in one call. It changes the original array rather than building a new one. The option pop removes the last element and shift removes the first one, so both take away instead of adding. The option join only builds a string, so push is the answer.
प्रश्न 10उत्तर + हल
कौन-सी विधि किसी सरणी से अंतिम तत्व को हटाती है?
Which method removes the last elements from an array?
  1. AJoin()
  2. BPush()
  3. CPop()
  4. DShift()

सही उत्तर / Answer: (C)

हल / Solution
pop सरणी के आख़िरी तत्व को निकाल देता है, उसकी लंबाई एक घटा देता है और निकाला हुआ तत्व लौटा भी देता है। ख़ाली सरणी पर चलाने से undefined मिलता है। shift भी तत्व हटाता है पर सबसे पहले वाला, आख़िरी वाला नहीं। push नया तत्व अंत में जोड़ता है और join सारे तत्व मिलाकर स्ट्रिंग बनाता है, इसलिए वे ग़लत हैं।
pop takes out the last element of an array, reduces its length by one and also returns the element that was removed. Running it on an empty array gives undefined. The option shift also removes an element, but the very first one rather than the last. The option push adds a new element at the end and join builds a string from all elements, so pop is correct.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 14उत्तर app में
फॉर लूप में इनिशियलाइज़ेशन भाग का उद्देश्य क्या है?
What is the purpose of initialization part in 'for' loop?
  1. Aलूप से बाहर निकलनाexit the loop
  2. Bशर्त की जाँच करनाevaluate the condition
  3. Cआरम्भिक चर को बढ़ाना या घटानाincrease or decrease the initial variable
  4. Dचर को आरम्भिक मान देनाInitiate the variable
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
लूप का कौन-सा भाग शर्तों का मूल्यांकन करता है?
Which part in loop evaluates the conditions?
  1. Aशर्त वाला भागCondition part
  2. Bबढ़ाने या घटाने वाला भागIncrement /Decrement part
  3. Cआरम्भ करने वाला भागInitialization part
  4. Dलूपिंग भागLooping part
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
निम्नलिखित कथन क्या करता है?
Var x = document.cookie;
What does the following statement do?
Var x = document.cookie;
  1. Aसारी कुकीज़ x नाम के चर में आ जाती हैंgets all cookies in a variable named x
  2. Bइनपुट माँगकर उसका मान x में रख देता हैprompts for input and stores the input value in x
  3. Cत्रुटि का संदेश दिखाता हैalerts regarding an error
  4. Dदस्तावेज़ का पृष्ठभूमि रंग तय करता हैsets the background color of the document
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
किसी फंक्शन के बाहर घोषित चर की वैधता ____ के भीतर रहती है।
Any variable declared outside a function has validity within the____.
  1. Aकेवल ब्लॉकblock only
  2. Bकेवल फंक्शनfunction only
  3. Cग्लोबल स्कोपglobal scope
  4. Dस्थिरांकconstant
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
किसी फंक्शन के भीतर घोषित चर की वैधता ____ के भीतर ही रहती है।
Any variable declared inside a function has validity within the____.
  1. Aकेवल ब्लॉकblock only
  2. Bकेवल फंक्शनfunction only
  3. Cग्लोबल स्कोपglobal scope
  4. Dस्थिरांकconstant
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
जावास्क्रिप्ट में फंक्शन ____ भी होते हैं।
In JavaScript, functions are also___
  1. Aचरvariables
  2. Bऑब्जेक्टobjects
  3. Cचर और ऑब्जेक्ट दोनोंboth variables and objects
  4. Dन चर न ऑब्जेक्टneither variables nor objects
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 22उत्तर app में
जावास्क्रिप्ट में फंक्शन कीवर्ड और फंक्शन पैरामीटर के बीच ____ रखा जाता है।
____is placed between function keyword and function parameters in JavaScript.
  1. Aफंक्शन का आरम्भFunction opening
  2. Bफंक्शन का अंतFunction end
  3. Cफंक्शन का नामFunction name
  4. Dफंक्शन का कोड ब्लॉकFunction code block
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 23उत्तर app में
किसी फंक्शन को दिए जाने वाले पैरामीटर या तर्क, फंक्शन के नाम के बाद ____ के भीतर लिखे जाते हैं।
Parameters/ arguments to be passed to a function are enclosed in _____ after the name of the function.
  1. A( ... )
  2. B{ ... }
  3. C[ ... ]
  4. D< ... >
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 26उत्तर app में
जावास्क्रिप्ट में ____ फंक्शन स्ट्रिंग के आरम्भ और अंत से स्पेस, टैब या ऐसी ही ख़ाली जगह हटा देता है।
_____function in Javascript removes space, tab or other space holders from beginning and end of a string.
  1. AtoLowerCase()
  2. BtoUpperCase()
  3. Ctrim()
  4. DfromCharCode()
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 30उत्तर app में
जावास्क्रिप्ट में ____ फंक्शन दिए गए सूचकांक से निर्दिष्ट अंतिम सूचकांक तक का सबस्ट्रिंग लौटाता है।
_____function in Javascript returns the substring from given index location to specified ending index location.
  1. AindexOf()
  2. BlastIndexOf()
  3. Csubstr()
  4. Dsubstring()
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Functions के सभी 56 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

Web Technology के दूसरे topics

सभी topics