JavaScript basic questions, exercises, exam questions, interview questions (b)

1. Known string "hello everybody" can be removed by the string which ends below the Blank
A TRIM ()
B Split ()
C Reverse ()
D the Join ()
correct Answer: A
Resolution:
Use exclusion: split divided character string; reverse inverting array; array translated into strings the Join

trim () remove the string ends spaces

2.var array = new Array (5) ; array.push (8); length of the array is the array
A 5
B. 6
C. 7
D. 8
correct answer: B
Analytical:
new new the Array (5); Create an empty length of 5 array, push method increases after an array, the result is 6

After 3.3 seconds, the picture disappears, you should use the following method which
A hide ()
B the setTimeout ()
C clearInterval
D clearTimeout ()
the correct answer: B
resolved:
the setTimeout delay

4. The following methods which can be called to find the element class "xm" of
A document.getElementsByClassName ( "xm")
B document.getElementsByName ( "xm")
C document.Class ( "xm")
D document.ByName ( "XM ")
the correct answer: a
parsing:
document.getElementsByClassName (" xm "); obtaining class of the element xm

Results 5.Math.ceil (-3.14) is ()
A -3.14
B -3
C -4
D 3.14
correct answer: B
Analytical:
Math.ceil () rounded up
Math.floor () rounded down

6. Which of the following is a window to change the window size triggered event
A onmouseover
B onResize
C onmouseout
D onclick
correct answer: B
onmouseover Mouse moved event
onmouseout mouse out event
onclick mouse click events

7. objects can be object attributes by which traverse a
A forEach
B for
C ... for in
D for ... of
the correct answer: C

8. The following is the code that runs y ARR = var [ "123", 123]; the console.log (typeof typeof ARR [. 1])
A 123
B Number
C String
D Object
correct answer: C

9.Math.round (Math.random () * 9) ; the maximum value can take is
A. 8
B. 9
C 9.999999
D. 11
correct answer: B

10. The method of acquiring the right by an element ID selector is
A document.getElementsById ()
B document.getElementById ()
C document.getElementsByIdName ()
D document.getElementById ()
the correct answer: D

11.Math.floor (-3.5) results:
A. 3
B. 4
C -3
D -4
correct answer: D

12. Which of the following objects are not subject bom
A Document
B LOCATION
C History
D offsetWidth
correct answer: D

13.var arr = [3,4,6], and finally remove an array
A arr.pop ()
B arr.pop (. 6)
C arr.shift ()
D arr.shift (. 6)
the correct Answer: A

14.var arr = [5,3,2,4]; var res = arr.splice (0); console.log (res) is the result of
A [5,3,2,4]
B [. 5]
C [. 5 ,. 3]
D [2,4]
correct answer: a
splice () method can remove zero or more elements from the beginning of the index, and replaced with one or more values of the parameters declared in the list of those elements are removed .

15.var arr = [3,6,8,9]; var res = arr.slice (1,3); console.log (res) is the result of
A [6,8,9]
B [6,8]
C [3,6, 8]
D [3,6]
correct answer: B
analytical:
Slice () method returns the selected elements from the existing array.

16. lowercase to uppercase method is
A charAt ()
B toLowerCase ()
C toUpperCase ()
D indexOf ()
the correct answer: C

17. Create a node
A parent node .createElement ()
B body.createElement ()
C document.createElement ()
D document.create ()
correct answer: C

18. Why nodeType node values, representing the element node is
A 3
B 1
C 9
D 8
correct answer: B
Analysis:
an element node, an attribute node 2, node 3 as text, comment nodes 8, 9 for the root element node

19. Array array of objects on the following statements is not correct is
A sort of array data may be the sort function, if the unintended effect sort, the sort function can be added to a sort function parameter
B reverse to reverse the data array arrangement of
C added to the last position in the array of a new element, can pop method
for deleting the first element of array D shift method of
the correct answer: C
analytical:
pop () method removes and returns the last element of the array.

20. The following method which is not a history object
A Go ()
B Back ()
C Forward ()
D reload ()
the correct answer: D

21. The following error is selected:
A document.getElementById ()
B document.getElementByTagName ()
C document.querySelector ()
D document.querySelectorAll ()
the correct answer: B
Analysis:
less a S
document.getElemenstByTagName ()

22. In the following, description JavaScript Date object on the right is
A getMonth () method to return the month Date object, a value of 12 is ~. 1
B getDay () method can Date object for each day of the month , a value of 31 is ~. 1
C the getTime () method to return a time (January 1, 1970) rely on the number of milliseconds
Year D getYear () method returns only four years, long Date object for acquiring
the right answer: C
parsing:
getTime () method can return a time (January 1, 1970) rely on the number of milliseconds

ARR = 23.var [1,2,3,4]; arr.splice (1,0, [1,2,3,4],. 5); Alert (arr.length);
A. 4
B. 5
C. 6
D 9
correct answer: C
Analysis:
remove 0 2 is inserted, the final length is 6, the insertion of a count array

24.var arr = [1,2,3,4]; alert (arr.concat (1,2, . 3, [l, 2,3],. 5) .length)
a. 4
B. 9
C. 11
D. 5
correct answer: C
Analysis:
new array concat returned immediately length, so that the latest output array length

ARR = 25.var [1,2,3,4]; arr.slice (2); the console.log (ARR);
A [1,2,3,4]
B 1,2
C 3,4-
D 2
correctly answer: A
parsing:
Slice method does not modify the original array

26. Gets a character string corresponding to the index
A indexOf ()
B charAt ()
C Split ()
D Slice ()
the correct answer: B
parsing:
charAt (IDX) Gets the index of the corresponding character

Score: 0
27. properties can be obtained which has a scroll bar to scroll the vertical distance
A document.scrollTop
B document.top
C document.body.scrollTop
D window.scrollTop
correct answer: C

ARR = 28.var [1,2,3,4]; arr.join ( "&"); the console.log (ARR);
A [1,2,3,4]
B &. 1 & 2. 4. 3 &
C [&. 1 & 2. 4. 3 &]
D. 1, 2,3,4
The correct answer: A
parsing:
the Join does not change the original array.

29.var arr = [3,4,5]; var res = arr.unshift (1,2); console.log (res); the result is output
A [1,2]
B [3,4, 5]
. 5 C
D [1,2,3,4,5]
correct answer: C
analytical:
the unshift () return value after execution length of the new array

30. A printed value below I = 0 var; [l, 2,3] .some (function (Item, IDX) = {I IDX; == 2 Item return;}) the console.log (I)
A 0
1 B
C 2
D 3
correct answer: B
Analysis:
find the condition is true, then stop searching

Second, multiple-choice (20 questions, 2 points each)
Score: 0
in 1.Javascript prompted methods are?
A Alert ()
B Confirm The ()
C prompt ()
D the Document
correct answer: A, B, C
Analysis:
three pop-up box method

2. Which of the following objects can be created through the constructor of
A a Date
B the Math
C Array
D String
correct answer: A, C, D
resolved:
the Math is a mathematical object that can be used directly, without creating

3. Change the input box (input) content, the following properties are error
A value
B the innerHTML
C the innerText
D the outerHTML
correct answer: B, C, D
Analysis:
by modifying value, other attributes not

4. The ways in which to find the page elements The following is a class array (dummy array)
A querySelectorAll ()
B the getElementsByName ()
C the getElementsByTagName ()
D getElementsByClassName ()
the correct answer: A, B, C, D
Analysis:
both

5. The following results are returned value of 4
A Number The ( "4")
B the parseInt ( "4aa11")
C Math.floor (3.5 of)
D Math.round (3.5 of)
the correct answer: A, B, D
resolved:
the ABD

6.JS provided timers What
A setInterval ()
B clearInterval ()
C the setTimeout ()
D clearTimeout ()
the correct answer: A, C
Resolution:
timer delay, all timers

Score: 2 points
7. In JavaScript, which of the following statements can be hidden id of the flower div
A document.getElementById ( "flower"). Style.display = "none";.
B document.getElementById ( "flower") style. = .display "hidden";
C document.getElementById ( "Flower") style.visibility = "none";.
D document.getElementById ( "Flower") style.visibility = "hidden."
correct answer: A, D
Analysis:
no hidden attribute value of the display;

none no visibility attribute value

Score: 2
8.var now = new Date (), 3 days after the set time is correct wording
A now.setDate (now.getDate () + 3)
B now.setTime (now.getTime () + 3)
C now .setTime (now.getTime () +. 3 1000 3600 24)
D now.setDate (now.getDate () +. 3
1000 3600 24)
correct answer: a, C
Analysis:
time stamp calculating the total number of milliseconds for 3 days, and then set to the time stamp

Score: 2 points
9. The following functions, which is after the call, the original array itself is changed
A Push ()
B POP ()
C Shift ()
D the unshift ()
the correct answer: A, B, C, D
parse :
the Push to add the last bit of the array, the last pop delete the array, shift delete the first array, unshift new array in the first place

10. The method of timer to clear
A Clear ()
B celarAll ()
C the clearTimeout ()
D the clearInterval ()
correct answer: C, D
Analysis:
timer into a timer and delay, so called two Clear Clear Timing device

11. Which of the following string methods
A Replace ()
B Split ()
C the Join ()
D the indexOf ()
the correct answer: A, B, D
resolved:
Replace replace, Split array is divided into the specified character string, indexOf returns the index is based on the specified character, join the array is converted to a string

12. Which of the following is an array of methods
A charAt ()
B the Sort ()
C the Push ()
D filter ()
the correct answer: B, C, D
resolved:
the Sort the array is sorted, push the last one in the array is added, while filtering data filter array can be traversed, the charAt can return the specified character index, not an array method

13. Which of these methods may be through the array
A for
B-in for
C do the while-
D for-by
the correct answer: A, B, C
parsing:
JS currently no method for-by

16. The following method can be taken string segment
A substr ()
B the substring ()
C Split ()
D Slice ()
the correct answer: A, B, D
parsing:
Split string is divided, the other can be taken

17. A method of creating an array which
A ARR var = [];
B var new new ARR = the Array (. 3)
C var new new ARR = the Array (3,4-)
D = {} var ARR
correct answer: A, B, C
analytical:
a literal mode to create an array, B create an empty array of length 3 way constructor, C is the constructor creates an array embodiment, D is an object to create

18. Which of the following options belong to the DOM Node
A property
B Text
C Notes
D label
the correct answer: A, B, C, D
parsing:
DOM node are: property, text, comment, tag, root

19. The following does not belong keywords or reserved words have
A class
B the let
C style
D Script
correct answer: C, D
Analysis:
keyword refers to the name he used otherwise, remain in grammar word refers to future plans to expand the use of Javascript , it can not be used as variable name, function name, and the tag; reference table found, class, and the key is let reserved words, style, and script are not.

20. Which of these methods belong to the Date object
A the setMonth ()
B the getFullYear ()
C setDate ()
D Random ()
the correct answer: A, B, C
parsing:
Random method of Math

Guess you like

Origin blog.csdn.net/ZHANGJIN9546/article/details/93708699