2.
What is the answer you get when typing the following code in JavaScript:102 == 102
Explanation
The code "102 == 102" is a comparison statement in JavaScript, using the equality operator (==). It checks if the value on the left side (102) is equal to the value on the right side (102). Since both values are the same, the result of this comparison is true. In JavaScript, the boolean value "true" can be represented in different ways, such as "true", "True", or "TRUE". Therefore, any of these options can be considered as the correct answer.
3.
What is the answer you get when typing the following code in JavaScript:102 == '102'
Explanation
The answer is "True,true,TRUE" because the double equals operator (==) in JavaScript performs type coercion, meaning it converts the operands to a common type before comparison. In this case, it converts the number 102 to a string "102" and then compares them. Since both operands are now strings and have the same value, the comparison evaluates to true. As for the three options, they are all valid representations of the boolean value true, but they may vary in case sensitivity.
4.
What is the answer you get when typing the following code in JavaScript:102 === '102'
Explanation
The answer is "False,false,FALSE" because the triple equals operator (===) in JavaScript compares both the value and the type of the operands. In this case, the operand on the left is a number (102) and the operand on the right is a string ('102'). Since the types are different, the comparison evaluates to false.
5.
What is the answer you get when typing the following code in JavaScript:typeof (4 + ‘5’);
Explanation
The code is attempting to add a number (4) with a string ('5'). In JavaScript, when you use the "+" operator with a number and a string, it performs concatenation instead of addition. Therefore, the result of the code will be a string. The answer options provided (String, STRING, string) all represent the same data type, which is the correct answer.
6.
What is the answer you get when typing the following code in JavaScript:12+10
Explanation
The given code in JavaScript is a simple addition operation that adds the numbers 12 and 10. When this code is executed, it will evaluate the expression and the result will be 22.
7.
What is the answer you get when typing the following code in JavaScript:(5+4)*2
Explanation
The given code performs a simple mathematical operation, where the sum of 5 and 4 is multiplied by 2. This results in the answer being 18.
8.
What is the answer you get when typing the following code in JavaScript:4 + ‘5’;
Explanation
In JavaScript, when you use the + operator with a number and a string, it performs string concatenation instead of addition. In this case, the number 4 is being concatenated with the string '5', resulting in the string '45'. Therefore, the answer you get when typing the given code is '45'.
9.
( 3 + 5 ) * 2 = 13
Explanation
The given equation is (3 + 5) * 2 = 13. To solve this equation, we first perform the addition inside the parentheses: 8 * 2 = 16. Therefore, the correct answer is False, as the equation does not equal 13.
10.
3 > 4
Explanation
The statement "3 > 4" is false because 3 is not greater than 4. In numerical terms, 4 is greater than 3. Therefore, the correct answer is False.
11.
How many variables are declared in the script above?
Explanation
In the given script, there are 8 variables declared. The script does not provide any code or context, so we cannot determine the specific variables or their purpose, but we can conclude that there are 8 variables based on the information given.
12.
Alert box is used to get information to the user
Explanation
An alert box is indeed used to display important information or messages to the user. It is a pop-up window that appears on the screen and interrupts the user's current activity, grabbing their attention. This allows developers to provide important notifications, warnings, errors, or prompts to the user, ensuring that they are aware of the information being conveyed. Therefore, the statement "Alert box is used to get information to the user" is true.
13.
What is the value of totalout and totalin?
Correct Answer
A. 110, 150
Explanation
The value of totalout is 110 and the value of totalin is 150.
14.
Many variables can be declared in one statement
Explanation
The statement is true because in many programming languages, including C++, Java, and Python, it is possible to declare multiple variables in a single statement. This can be done by separating the variable names with commas. For example, in Java, you can declare multiple variables of the same type in one line like this: int a, b, c; This can be convenient and save space in the code. However, it is important to note that each variable must still be assigned a value separately.
15.
JavaScript has two kind of popup boxes
Explanation
JavaScript actually has three kinds of popup boxes: alert, confirm, and prompt. The alert box is used to display a message to the user, the confirm box is used to get the user's confirmation (OK or Cancel), and the prompt box is used to get input from the user. Therefore, the statement "JavaScript has two kinds of popup boxes" is incorrect.
16.
Which JavaScript will Assign 8 to a variable called age.
Correct Answer
A. Var age = 8 ;
Explanation
The correct answer is "var age = 8 ;" because it follows the correct syntax for declaring a variable in JavaScript. The keyword "var" is used to declare a variable, followed by the variable name "age", an equal sign to assign a value, and the value "8".
17.
What is the result of the Script after you click on run?
Correct Answer
A. You only have 40 Dollars to spend
Explanation
The script will display the message "You only have 40 Dollars to spend" when it is run. This message indicates that the person only has 40 dollars available for spending.
18.
Which one is JavaScript Strict equal operator?
Explanation
The JavaScript strict equal operator is represented by ===. This operator compares two values for equality without performing any type conversion. It checks if the values are of the same type and have the same value. If they are, it returns true; otherwise, it returns false.
19.
Which JavaScript will Assign aic to a variable called school ?
Correct Answer
A. Var school = 'aic' ;
Explanation
The correct answer is "var school = 'aic' ;". This statement assigns the value 'aic' to a variable called school using the var keyword.
20.
Which one is JavaScript Modulus Operator ?
Explanation
The JavaScript modulus operator is represented by the symbol "%". It is used to calculate the remainder of a division operation. For example, if we divide 10 by 3 using the modulus operator, the result would be 1, as 10 divided by 3 equals 3 with a remainder of 1.
21.
What is the result of this script: alert (totalin + totalout + saving)
Explanation
The script is calculating the result by adding the values of "totalin", "totalout", and "saving". The given answer, 300, suggests that the sum of these three variables is equal to 300.
22.
3 + 5 * 2 = 13
Explanation
The given equation follows the order of operations, which states that multiplication should be done before addition. Therefore, we first multiply 5 and 2, which equals 10. Then, we add 3 to 10, resulting in 13. Since the equation is correctly solved and equals 13, the answer is True.
23.
3 + 5 +'2' = 82
Explanation
The given expression is adding the numbers 3, 5, and the string '2'. In JavaScript, when the + operator is used with a string, it performs string concatenation instead of addition. Therefore, the expression '2' is concatenated with the numbers 3 and 5, resulting in the string '352'. Finally, this string is compared to the string '82' using the equality operator, and since they are not equal, the answer is False.
24.
In JavaScript An Expression is a combination of : (tick all correct answers, missing any will mark your answer as wrong)
Correct Answer(s)
A. Values
A. Variables
A. Operators
Explanation
An expression in JavaScript is a combination of values, variables, and operators. Values are the actual data that is used in the expression, such as numbers or strings. Variables are used to store and represent values in the expression. Operators are used to perform operations on the values and variables, such as addition or comparison. Pictures are not part of JavaScript expressions as they are not valid data types or operators.
25.
Prompt box is used to confirm or verify information
Explanation
The prompt box is not used to confirm or verify information. It is used to display a message or request input from the user in a dialog box. It can be used to ask for confirmation or prompt the user for information, but it does not serve the purpose of verifying or confirming information.
26.
JavaScript creates cookies, what does the term cookies mean?
Correct Answer
A. Information stored locally then automatically retrieved
Explanation
Cookies in JavaScript refer to small pieces of data that are stored locally on the user's computer. These cookies are automatically retrieved by the browser and sent back to the server with each subsequent request. This allows websites to remember user preferences, track user behavior, and provide personalized experiences. Therefore, the correct answer is "Information stored locally then automatically retrieved."
27.
Which Script will display: Your total income is 150 Dollars.
Correct Answer
A. Alert("Your total income is " +totalin + " Dollars")
Explanation
The correct answer is alert("Your total income is " +totalin + " Dollars"). This script will display the message "Your total income is 150 Dollars" by concatenating the value of the variable "totalin" with the rest of the string using the "+" operator. The correct answer includes the correct spacing and capitalization for the message to be displayed correctly.
28.
Confirm box is used to get an input from a user
Explanation
The given statement is false. A confirm box is not used to get input from a user. Instead, it is used to display a message and prompt the user to confirm or cancel an action. It provides a way for the user to interact with the browser and make a decision. An input box or prompt box is typically used to get input from a user.
29.
What is the name of this JavaScript popup box ?
Correct Answer
A. Alert box
Explanation
The correct answer is "Alert box" because it refers to the JavaScript popup box that displays a message with an OK button for the user to acknowledge. It is commonly used to show important information or notifications to the user.
30.
What is the name of this JavaScript popup box ?
Correct Answer
A. Confirm box
Explanation
The correct answer is "Confirm box" because a confirm box is a type of JavaScript popup box that displays a message to the user with two options - OK and Cancel. It is commonly used to ask the user for confirmation before proceeding with an action.
31.
What is the name of this JavaScript popup box ?
Correct Answer
A. Prompt box
Explanation
The correct answer is "Prompt box" because a prompt box is a type of JavaScript popup box that allows the user to enter input by displaying a message and a text field for the user to enter their response. This type of popup box is commonly used when the user needs to provide a specific input or answer a question.
32.
JavaScript keywords can not be used as Variable names, tick the keywords : (tick all correct answers, missing any will mark your answer as wrong)
Correct Answer(s)
A. Else
A. This
A. Try
Explanation
The given question asks to identify JavaScript keywords that cannot be used as variable names. JavaScript keywords are reserved words that have predefined meanings in the language. In this case, the keywords "this", "try", and "else" are correctly identified as keywords that cannot be used as variable names. However, "school" and "code" are not keywords and can be used as variable names.
33.
Which Script will display: Your total income is 150 Dollars.
Correct Answer
A. Alert("Your total income is " +totalin + " Dollars")
Explanation
The correct answer is "alert("Your total income is " +totalin + " Dollars")" because it correctly concatenates the string "Your total income is " with the value of the variable "totalin" and the string " Dollars". The capitalization of "Dollars" matches the given sentence in the question.
34.
JavaScript is used to : (tick all correct answers, missing any will mark your answer as wrong)
Correct Answer(s)
A. Add interactivity to a web page
A. Detect and control browsers
A. Validate data (forms)
A. Create Cookies
Explanation
JavaScript is a programming language commonly used to add interactivity to web pages. It allows developers to create dynamic elements, such as buttons, sliders, and forms, that respond to user actions. JavaScript can also be used to detect and control browsers, ensuring that the web page functions properly on different devices and platforms. Additionally, it can validate data entered into forms, ensuring that the information provided by users is correct and complete. Lastly, JavaScript can be used to create cookies, which are small pieces of data stored on the user's computer to remember information or track user activity.
35.
Which one is JavaScript Greater than OR equal Operator ?
Explanation
The correct answer is ">=". The ">=" operator is the JavaScript Greater than OR equal Operator. It is used to compare two values and returns true if the left operand is greater than or equal to the right operand, otherwise it returns false.
36.
JavaScript variable names can contain: : (tick all correct answers, missing any will mark your answer as wrong)
Correct Answer(s)
A. Letters
A. Number
A. Dollar sign $
Explanation
JavaScript variable names can contain letters, numbers, and the dollar sign $. These characters are all valid for use in variable names in JavaScript. The hash symbol (#) and comma (,) are not valid characters for variable names in JavaScript.
37.
Tick all the correct variable names : (tick all correct answers, missing any will mark your answer as wrong)
Correct Answer(s)
A. Abc3
A. Abc$23
A. AgE
Explanation
The correct variable names are abc3, abc$23, and agE. These names follow the rules for variable naming in most programming languages, which include using letters, numbers, and underscores, starting with a letter or underscore, and not using reserved keywords like "else". The name 23abc does not meet these criteria as it starts with a number.
38.
Write JavaScript that will assign year7 to a variable name grade:
Correct Answer(s)
var grade = 'year7', var grade = "year7", var grade='year7'; var grade = "year7";
Explanation
The correct answer is: var grade = 'year7'. This is because it follows the correct syntax for assigning a value to a variable in JavaScript. The other options either have duplicate variable declarations or use double quotes instead of single quotes, which is not necessary in this case.
39.
Use scratchpad to find the area of the following rectangles:Rec1 length = 3.8 width = 28Rec2 length = 45 width = 1.9Rec3 length = 13.8 width = 258save the file and upload it here when done.
40.
What is the answer you get when typing the following code in JavaScript:typeof (4 > 5);
Correct Answer(s)
Boolean,boolean,BOOLEAN
Explanation
The code "typeof (4 > 5)" in JavaScript returns the data type of the expression "4 > 5", which is a boolean value. In JavaScript, boolean values can be either true or false, representing the result of a comparison or logical operation. The "typeof" operator is used to determine the data type of a value or expression. Therefore, the correct answer is "Boolean, boolean, BOOLEAN" because the code returns a boolean value.