Question:- What is the use of a Map object in JavaScript?
Answer:- The JavaScript Map object is used to map keys to values. It stores each element as key-value pair. It operates the elements such as search, update and delete on the basis of specified key.
Question:- What is the use of a WeakMap object in JavaScript?
Answer:- The JavaScript WeakMap object is a type of collection which is almost similar to Map. It stores each element as a key-value pair where keys are weakly referenced. Here, the keys are objects and the values are arbitrary values.
Question:- What are the falsy values in JavaScript, and how can we check if a value is falsy?
Answer:- Those values which become false while converting to Boolean are called falsy values. const falsyValues = [', 0, null, undefined, NaN, false]; We can check if a value is falsy by using the Boolean function or the Double NOT operator (!!).
Question:- What do you understand by hoisting in JavaScript?
Answer:- Hoisting is the default behavior of JavaScript where all the variable and function declarations are moved on top. In simple words, we can say that Hoisting is a process in which, irrespective of where the variables and functions are declared, they are moved on top of the scope. The scope can be both local and global.
Question:- Which of the following statement shows the primary difference between JavaScript and Java? a. There is no difference between JavaScript and Java. b. Functions are considered as fields. c. Variables are specific. d. Functions are values, and there is no such distinction between methods and fields.
Answer:- D is the correct option. We know that Java is an OOP language while JavaScript is an OOP scripting language. The most fundamental difference between JavaScript and Java is that the functions are values, and there is no such distinction between methods and fields.
Question:- Which of the following syntax is valid for creating a RegExp object? 1. var txt=new RegExp(pattern,attributes); 2. var txt=/pattern/attributes; a. Only 1 syntax b. Only 2 syntax c. Both 1 and 2 syntax d. None of the above
Answer:- C: Both the statements are correct and can be used for creating a RegExp object.
Question:- Which of the following statement specifies the meaning of Augmenting classes? a. Objects inherit prototype properties even in a dynamic state. b. Objects inherit prototype properties only in a dynamic state. c. Objects inherit prototype properties in the static state. d. An object doesnt inherit prototype properties in the static state.
Answer:- A: "Objects inherit prototype properties even in a dynamic state" is the correct answer.
Question:- If para1 is the DOM object for a paragraph, which of the following would be the correct syntax to change the text within the paragraph? a. para1="New Text" b. firstChild.nodeValue= "New Text"; c. value="New Text"; d. nodeValue="New Text";
Answer:- C: "para1.value="New Text";" is the correct syntax to change the text within the paragraph.
Question:- Which of the following is used to define the behavior of the instances present of a class inside a method? a. Method b. Classes c. Interfaces d. Classes and Interfaces
Answer:- B: "Classes" is the correct answer. The classs behavior is defined by the class and is shared by all instances.
Question:- Which of the following statement is true in the case of the property of the JSON() method? a. A JSON() method can be invoked manually as object.JSON() b. A JSON() method is invoked automatically by the JSON.stringify() method c. A JSON() method is automatically invoked by the compiler. d. A JSON() method cannot be invoked in any form.
Answer:- B is the correct option. The JSON() method is most commonly used to exchange data to/from a web server. When we send data to a web server, the data has to be a string. In this case, json.strigify() is used to convert a JavaScript object into a string.
Question:- Which of the following statement is true if class B can extend another class A? a. A is the superclass, and B is the subclass. b. B is the superclass, and A is the subclass. c. Both A and B are the superclass. d. Both A and B are subclass.
Answer:- A: "A is the superclass and B is the subclass" is the correct answer. A class is called a superclass if it can define a subclass. Subclasses are also called extensions of a superclass.
Question:- Which of the following is the correct syntax of the eval() function? a. [objectName.]eval(numeric) b. [EvalName.]eval(string) c. [EvalName.]eval(numeric) d. [objectName.]eval(string)
Answer:- D is the correct option. The eval() function is used to evaluate or execute an argument. If the argument is an expression, the eval() function evaluates the expression. If the argument is one or more JavaScript statements, the eval() function executes the statements.
Question:- What is AWS?
Answer:- AWS stands for Amazon Web Services. It is a service which is provided by the Amazon that uses distributed IT infrastructure to provide different IT resources on demand. It provides different services such as an infrastructure as a service, platform as a service, and software as a service.
