Manish JS 10 Quiz
Manish JS 10 Quiz
MCQs
1. Inside which HTML element do we put the JavaScript? a: <script>, b: <javascript>, c: <js> d: <scripting>
3. What is the correct syntax for referring to an external script called "x.js"? a: <script href="x.js">, b: <script src="x.js">
6. How does a WHILE loop start? a: while (i <= 10; i++), b: while i = 1 to 10, c: while (i <= 10)
7: How does a FOR loop start? a: for (i = 0; i <= 5; i++), b: for (i <= 5; i++), c: for i = 1 to 5, d: for (i = 0; i <= 5)
8: How do you round the number 7.25, to the nearest integer? a: Math.round(7.25), b: Math.rnd(7.25), c: round(7.25)
9: How do you find the number with the highest value of x and y? a: Math.ceil(x, y), b: Math.max(x, y), c: ceil(x, y)
1. map( ) : creates a new array with the results of calling a provided function on every element in this array.
2. filter( ) : creates a new array with only elements that passes the condition inside the provided function.
3. sort( ) : its used to arrange/sort array’s elements either in ascending or descending order.
4. forEach( ) : its helps to loop over array by executing a provided callback function for each element.
5. concat( ) : its used to merge two or more arrays and returns a new array, without changing the existing arrays.
6. every( ) : its checks every element in the array that passes the condition, returning true or false as appropriate.
7. some( ) : its checks if at least one element in the array that passes the condition, returning true or false.
8. includes( ) : its checks if an array includes the element that passes the condition, returning true or false
9. join( ) : it returns a new string by concatenating all of the array’s elements separated by the specified separator.
10. reduce( ) : it applie in a function against an accumulator and each element in the array to reduce it to a single value.
11. find( ) : it returns the value of the first element in an array that pass the test in a testing function.
12. findIndex( ) : it returns the index of the first element in an array that pass the test in a testing function.
13. indexOf( ) : it returns the index of the first occurrence of the specified element in the array, or -1 if it is not found.
14. fill( ) : it fills the elements in an array with a static value and returns the modified array.
15. slice( ) : it returns a new array with specified start to end elements.
16. reverse( ) : it reverses an array in place. Element at last index will be first and element at 0 index will be last.
17. push( ) : it adds one or more elements to the end of array and returns the new length of the array.
18: pop( ) : it removes the last element from the end of array and returns that element.
19: shift( ) : it removes the first element from an array and returns that element.
20: unshift( ) : it adds one or more elements to the beginning of an array and returns the new length of the array.
String Methods(Please Provide One Example For Every Methods)
1. charAt(x) : This function will return the character at the x position within the string.
2. charCodeAt(x) : This function will return the unicode value of the character at position ‘x’ within the string.
3. concat(v1,v2..) : This function combines one or more strings(argv1,v2 etc) into existing one.
5. indexOf(substr, [start]) : It searches and (if found) returns the index number of the searched character.
6. lastIndexOf(substr, [start]) : It searches and (if found) returns the index number of the searched character
7. match(regexp) : It executes a search for a match within a string based on a regular expression.
8. replace(regexp/substr, replacetext) : It searches and replaces the regular expression (or sub string) portion (match)
with the replaced text instead.
9. search(regexp) : this would tests for a match in a string. It returns the index of the match, or -1 if not found.
10. slice(start, [end]) : it returns a substring of the string based on the “start” and “end” index arguments
11. split(delimiter, [limit]) : it split a string into many according to the specified delimiter
12. substr(start, [length]) : it returns the characters in a string beginning at “start” and through the specified number.
13. substring(from, [to]) : It returns the characters in a string between “from” and “to” indexes.
14. toLowerCase() : This will return the string with all of its characters converted to lowercase.
15. toUpperCase() : This will return the string with all of its characters converted to uppercase
16. includes() : This is used to check whether a string contains the specified string or characters.
17. endsWith() : This function checks whether a string ends with specified string or characters
18. repeat() : This returns a new string with a specified number of copies of an existing string
20. trim() : This function removes whitespace from both ends of a string
Number Methods(Please Provide One Example For Every Methods)
2. parseInt() : .parseInt() very similar to the number() method, parseInt() formats a string into an integer.
3. parseFloat() : .parseFloat() method parses a string value and returns the number with its decimal value.
5. toExponential() : .toExponential() converts a number into a string and returns it in an exponential format.
6. toFixed() : .toFixed() method rounds up a number to the nearest highest or lowest fixed-point notation.
7. toPrecision() : .toPrecision() returns the numeric value with a specific length. It takes an argument that signifies the
length.
8. valueOf() : .valueOf() method is used to return the primitive value of the Number object you’re calling it on
9. isInteger() : .isInteger() checks whether the given value is an integer and returns a boolean value.
10: About isSafeInteger() : .isSafeInteger() checks whether the given value is a safe integer and returns a boolean
value. An integer is considered as safe integer when all integers are exactly between (2^53–1) to -(2^53–1)).
ENDS