1.
How can we starts Javascript ?
Correct Answer
A. Script tag
Explanation
To start JavaScript, we can use the "script" tag. This tag is used to define a client-side script, such as JavaScript, within an HTML document. By placing the JavaScript code within the "script" tags, the browser knows to interpret and execute the code. This allows us to include JavaScript functionality and interactivity on our webpages. The other options mentioned (javascript tag, language tag, none of above) are not valid ways to start JavaScript.
2.
Is javascript case sensitive ?
Correct Answer
A. True
Explanation
JavaScript is indeed case sensitive. This means that it distinguishes between uppercase and lowercase letters. For example, variables named "myVariable" and "myvariable" would be treated as two separate variables. Similarly, functions or object names must be referenced with the exact casing used when they were declared. Therefore, "True" is the correct answer as JavaScript is case sensitive.
3.
In script tag what are the attribute we can use what are the attribute we can use ?
what attribute we can use ?
Correct Answer(s)
B. Language
C. Type
Explanation
The question is asking for the attributes that can be used in a script tag. The correct answer is "language" and "type". These attributes are commonly used in script tags to specify the programming language and type of the script being included.
4.
How can we declare variable in javascript
Correct Answer
B. Var
Explanation
In JavaScript, we can declare a variable using the "var" keyword. This keyword is used to create a new variable and assign a value to it. It is followed by the variable name, which can be any valid identifier, and optionally, we can also specify the data type of the variable. The "var" keyword is essential for declaring variables in JavaScript and is widely used in coding practices.
5.
.length is ____________
Correct Answer
property
Explanation
The ".length" is a property in many programming languages, including JavaScript. It is used to retrieve the length or size of a string, array, or other data structure. The property returns the number of characters in a string or the number of elements in an array. Therefore, ".length" is a property.
6.
.push () is which type of function
Correct Answer
C. Array
Explanation
The .push() function is a method used to add one or more elements to the end of an array. It modifies the original array by adding the elements at the end. Therefore, the correct answer is "array" as .push() is a function that specifically operates on arrays.
7.
Script tag used in which part
tag is used in _____________?
Correct Answer
C. Head tag and body tag both
Explanation
The script tag is used in both the head tag and the body tag. It is commonly used to include or reference external JavaScript files in a web page. Placing the script tag in the head tag allows the browser to load and parse the JavaScript file before rendering the rest of the page. On the other hand, placing the script tag in the body tag allows the JavaScript to be executed after the page has been rendered, which can be useful for manipulating the DOM or interacting with elements on the page.
8.
If we want to print any message in message box we use ___________ in javascript
Correct Answer
C. Alertbox
Explanation
In JavaScript, if we want to display a message in a message box, we use the "alert" function. This function displays a pop-up box with the specified message and an "OK" button for the user to acknowledge the message. Therefore, the correct answer is "alertbox". The other options mentioned, such as "promptbox" and "confirmbox", are not valid functions in JavaScript for displaying messages in a message box.
9.
To take value from user at runtime we use _________
Correct Answer
A. Promptbox
Explanation
To take value from the user at runtime, we use a promptbox. The promptbox is a built-in function in JavaScript that displays a dialog box with a message prompting the user to input data. It allows the user to enter a value, which can then be stored in a variable or used for further processing in the program. This method is commonly used when interactive input is required from the user during program execution.
10.
Take choice from user either yes and no or cancel we use ________
Correct Answer
C. Confirmbox
Explanation
When we want to take a choice from the user with options such as "yes" and "no" or "cancel", we use a confirmbox. A confirmbox is a dialog box that pops up and displays a message to the user along with buttons for different options. The user can then select one of the options provided. Therefore, the correct answer is confirmbox.
11.
In do-while .. while with condition required ';' at the end of ()
Correct Answer
A. True
Explanation
In a do-while loop, the condition is checked at the end of each iteration. The condition is enclosed within parentheses, and a semicolon is required at the end of the parentheses to indicate the end of the condition. This is necessary for the proper syntax of the do-while loop. Therefore, the statement "in do-while .. while with condition required ';' at the end of ()" is true.
12.
What is the use of document.getElementById("...").value in javascript
Correct Answer
A. To take value from any form tool
Explanation
The correct answer is "to take value from any form tool". The document.getElementById("...").value in JavaScript is used to retrieve the value of an input element or form tool on a webpage. It can be used to obtain the value from various form tools such as textboxes, checkboxes, radio buttons, dropdown menus, etc. This method allows developers to access and manipulate the values entered by users in a web form.
13.
What is the use of document.getElementById("...").innerHTML="[message]"
Correct Answer
A. To show our output in any tool
Explanation
The correct answer is "to show our output in any tool". The document.getElementById("...").innerHTML=" [message]" is used to manipulate the content of an HTML element with the specified ID. By setting the innerHTML property to a specific value, we can display our desired output in any HTML element, not just limited to a textbox or an alert box.
14.
When we use function and onClick event as example is it must to use <script> and function in <head> only ?
Correct Answer
A. True
Explanation
The answer is true because when using a function and onClick event as an example, it is necessary to include the script tag and define the function within the head section of the HTML document. This is because the head section is where the script tag is typically placed to ensure that the function is loaded and available before the rest of the page is rendered. Placing the script tag and function in the head section ensures that the function can be called and executed properly when the onClick event is triggered.