js test questions and answers (7)

1. Multiple choice questions (30 questions in total, 2 points for each question)
1. Those that cannot be forced to type conversion are
A parseInt
B parseFloat
C Number
D Math.floor
Correct answer: D
Analysis:

2. Keywords that cannot be inherited in ES5

A prototype
B call
C apply
D extends

Correct answer: D
Resolution:
None

3.alert(username);var username="leson"; the result is

A undefined
B leson
C null
D error

Correct answer: A
analysis:
variable promotion, pre-analysis

4. There is code function Foo(){}; var foo = new Foo(); The option for the following expression to be true is

A Foo.prototype == Foo.proto
B foo.prototype == Foo.proto
C foo.proto == Foo.prototype
D foo.proto == Foo.proto

The correct answer: C
resolved:
. Foo proto == Foo.prototype

The __proto__ attribute of the instance points to the prototype of the constructor

5. There is code var obj1={ a:[1], b:1 }; var obj2={ a:[2], c:2 }; var obj = Object.assign(obj1,obj2); obj after running The result is

A {a:[1],b:1}
B {a:[1,2],b:1,c:2}
C {a:[2],b:1,c:2}
D {a:[2],c:2}

Correct answer: C
analysis:
Object.assign is a newly added interface in ES6. The main purpose is to merge multiple JavaScript objects.

var target = (a: 1); //target object

var source1 = {b: 2}; //source object 1

var source2 = {c: 3}; //Source object 2

var source3 = {c: 4}; //Source object 3, which has the same name attribute c as the object in source2

Object.assign(target,source1,source2,source3);

6. Which of the following operators or methods can be used to determine that an instance belongs to a certain class

A typeof
B instanceof
C isPrototypeOf
D hasOwnProperty

Correct answer: B
analysis:
instanceof can determine that an instance belongs to a certain class

7. The following statement about the prototype object is wrong

A Every function has a prototype object
B Every constructor has a prototype object
C The properties and methods on the prototype object can be accessed by instances
D The properties and methods on the prototype object can be accessed by subclasses (in the code)
Correct answer: D
analysis:
the properties and methods on the prototype object can be accessed by the instance

8. Which of the following is not a common design pattern

A Singleton mode
B Agent mode
C Flight mode
D Observer mode

Correct answer: C
analysis:
airplane mode, a mode only available in mobile phones! !

9. The commit command in the version management tool svn is

A push
B add
C commit
D update

Correct answer: C
analysis:
The commit command in svn is commit

10. The following this points to that which is not window

A this in the global
B general function, this is obtained in the directly called function
C the this in the event function listened to by the button
D When the function is called by call, the first parameter is filled with null, the this in the function

Correct answer: C
analysis:
this points to the object being listened to in the mouse event

11. The result of the following function execution is function fun1(x) {if(x>2){ return (fun1(x-1)+fun1(x-2)); }else{ return 1;}} console.log( fun1(10));

A 50
B 52
C 55
D 60

Correct answer: C
analysis:
This is the use of a callback function

12. The length property of the function is

The number of rows of A function, the number
of parameters of function B, the number
of return functions, and
D is always 0

Correct answer: B
analysis:
the length of the function is the number of parameters

13. The result of executing the following program will be var obj1=(function(){ return {a:1, b:2, fun2:function(){ console.log(this.a+this.b);}} }) (); obj1.fun2();
A 3
B 4
C 1
D 2
Correct answer: A
analysis:

14. The following statement is wrong

A Closure refers to a function that has access to variables in the scope of another function.
B The most common way of closure is to create another function within a function.
C Closures can be cleaned up by the garbage collection mechanism.
D Functions can be referenced inside. External parameters and variables

Correct answer: C
analysis:
Closures cannot be cleaned up by the garbage collection mechanism

15. In ES6 (2015), which are the nouns that did not exist before?

A function

Type B

C recursion

D process

Correct answer: B
Analysis:
None

16. Object-oriented, which steps do you need to go through? The wrong statement is
A OOA Object-oriented analysis
B OOD Object-oriented design
C OOC Object-oriented acquisition
D OOP Object-oriented programming
Correct answer: C
analysis:

17. What is the data type of the $ variable in jQuery?
A object
B array
C number
D function
Correct answer: A
analysis:

18. The function to be executed when the DOM is loaded, which of the following is correct

A jQuery(expression, [context])
B jQuery(html, [ownerDocument])
C jQuery(callback)
D jQuery(elements)

Correct answer: C
analysis:
jQuery (callback) is shorthand for jQuery (document).ready()

19. The function of the delay method in jQuery is

A Stop animation execution
B Pause animation execution
C Delay animation execution
D Start animation execution

Correct answer: C
analysis:
memorization question

20. The way to find the minimum value of the array, the correct one is

A Math.apply(arr)
B Math.call(arr)
C Math.min.apply(null,arr)
D Math.min(arr)

Correct answer: C
analysis:
Math.min() is to find the minimum value of a set of numbers, but the parameter is not an array

apply() allows Math.min to run and the second parameter is an array

Combine it together to find the minimum value in an array

$What is the function of jQuery's dollar sign
A dollar sign $is just an alias of
jQuery B jQuery is just $an alias of
C dollar sign $, no
D dollar sign $can be used with jQuery, but the effect is different

Correct answer: A
analysis:
$ is an alias of jQuery, for ease of use

22. The method to initiate adding a class name in jq is

A ajax
B addClass
C getClass
D setClass

Correct answer: B
analysis:
memorization question

23. The way to set the style in jq is

A $().style
B $().css
C $.css
D $.style

Correct answer: B
analysis:
example of memorizing questions $("div").css("color","red");

24.php defines the variable correctly is

A var a = 5;
B $a = 10;
C int b = 6
D var $a = 12;

Correct answer: B
Analysis:
None

25. The possible cause of a 404 error when viewing a webpage with a browser is () means that the webpage does not exist and the file is not found

A Error in the source code of the page
B File does not exist
C Error in connection with the database
D Insufficient permissions

Correct answer: B
Analysis:
None

The source code of 26.php is () open source language

A Open
B Closed
C Need to be purchased
D Completely invisible

Correct answer: A
Resolution:
None

27. What is the default port number of the HTTP protocol? ()
A 8080
B 8888
C 80
D 3306
Correct answer: C
analysis:

28. When the readyState property value of the XMLHttpRequest object is (), it means that the request is successful and the data is received.

A 1
B 2
C 3
D 4

Correct answer: D
analysis:
request completion for 4 representatives

29. The result of executing the following program is function fn3() {arguments.callee.play();} fn3.play=function () {console.log("aaa"); }; fn3()
A error
B is empty value
C play
D "aaa"

Correct answer: D
analysis:
use of callee

30. The result of the following operation is false is function Box(){this.name='zhang';} function Desk(){this.age=100;} function Table(){this.lever=1000} Desk.prototype =new Box();//Inherited through the prototype chain var desk=new Desk(); var table=new Table();

A alert(table instanceof Object)
B alert(desk instanceof Box);
C alert(Desk instanceof Box);
D alert(desk instanceof Desk );

Correct answer: C
analysis:
A. Everything is an object

B. Dest inherits Box, so it is correct

C. Desk is an instance of Function and has nothing to do with Box

D. desk is an instance of Desk

2. Multiple-choice questions (indeterminate choice) (20 questions in total, 2 points for each question) 1.
What are the following
ways to create objects in js: A can create objects in json mode, object
B can be created by new keywords, and object
C can be created by Function call method to create object
D Object cannot be created by function call method
Correct answer: A, B, C
analysis:

2. Which of the following keywords cannot be used to delete instance attributes
A delete
B has
C instanceof
D add
Correct answer: B, C, D
analysis:

3. When svn is performing version management, the functions that can be achieved are:

A Update to a specified version
B Lock a file
C Create multiple branches
D Release version control of a file

Correct answer: A, B, C, D
analysis: all
four options are achievable by svn

4. The methods to remove the jquery object in jquery are

A remove
B detach
C empty
D clear

Correct answer: A, B, C
analysis: the
first three are all OK, clear is not

5. The following statement is correct

A class is an abstraction of an
object B an object is a concreteization of
a class C an object is an instantiation of a class
D an object is a class

Correct answer: A, B, C
analysis:
in js, the class is the constructor

6. Which of the following are design patterns
A singleton pattern
B observer pattern
C factory pattern
D prototype pattern

Correct answer: A, B, C, D
Resolution:
None

7. The following statement is wrong

A objects are generally stored in the stack.
B objects are instantiations of
classes . C classes are instantiations of objects.
D classes cannot be inherited.

Correct answer: A, C, D
Resolution:
None

8. Which of the following belongs to design pattern
A, singleton pattern
B, observer pattern
C mvc
D mvvm,
correct answer: A, B
analysis:

9. The case code is as follows: <form> <div class="big">大字体</div> <div class="small">小字体</div> </form>Please select the div object whose text is "big font"

A $(“div.big”);

B $(“div .big”)

C $("div:contains('big font')");

D $(“form > div.big”);

Correct answer: A, C, D
Analysis:
This question examines the usage of different selectors

The B option is to select a collection of jquery objects with the big class name (descendants) in the div

10. Features of closures

A function nested function
B function can refer to external parameters and variables
C function can only refer to internal parameters and variables
D function must have a return value

Correct answer: A, B
analysis:
conceptual problem

11. Why use jQuery? What are the benefits of jquery

A It has a powerful selector, excellent DOM operation encapsulation
B Excellent browser compatibility
C Perfect ajax
D It has a reliable event handling mechanism

Correct answer: A, B, C, D
Analysis: The
biggest feature of jquery is query, and it encapsulates a large number of methods for DOM operations, event processing and ajax requests, etc.

12. What are the jq selectors

A type
B id
C label
D All of the above

Correct answer: A, B, C, D
Analysis: All
selectors in css can be used in jq

13. In php, which of the following are output (print) functions. ()

A print
B echo
C print_r
D write

Correct answer: A, B, C
Analysis:
None

14. In the front-end and back-end development process, what are the methods to solve cross-domain. ()

A backend proxy
B jsonp
C xhr2
D ajax

Correct answer: A, B, C
Analysis:
None

15. SQL language data manipulation statements include which of the following ()

A SELECT
B INSERT
C UPDATE
D DELETE

Correct answer: A, B, C, D
analysis:
query, insert, update, delete

16. The operations of adding, deleting and modifying dom in Jq are

A append
B appendTo
C remove
D detach

Correct answer: A, B, C, D
analysis:
several are the methods of dom operation

17. The following can achieve inheritance

A Constructor inherits
B Object.create()
C Prototype chain inherits
D es6 extends

Correct answer: A, B, C, D
analysis: the
first three are inherited in es5, the last one is inherited in es6

18. What are the request methods of Ajax? ()

A post
B get
C method
D putx

Correct answer: A, B

19. Which of the following descriptions of ajax are correct ()

A refers to a web development technology for creating interactive web applications.
B AJAX can make web pages update asynchronously.
C can call external data such as xml, json, and php.
D has no platform restrictions.

Correct answer: A, B, C, D
Resolution:
None

20. The result printed after executing this program forEach=function (arr,fn) {for(var i=0,l=arr.length;i<l;i++){ var c=arr[i]; if(fn. call(c,i,c)===false){ return false;}} }; function box1(index,num) {console.log(index,num);} var arr=[10,9,8,7 ,6,5,4]; forEach(arr,box1)

A 0 10
B 3 7
C 2 4
D 5 5

Correct answer: A, B, D

Guess you like

Origin blog.csdn.net/weixin_49299412/article/details/109306148