A complete set of javascript interview questions (partial answers)

Source: Internet
Author: User
Tags javascript extension javascript array java comparator

I. multiple choice questions
1. Which of the following statements will generate a running error? ()
A. var obj = (); // syntax error
B. var obj = []; // create an array
C. var obj ={}; // create an object
D. var obj = //;
Cause: var obj = new Array (); yes; brackets in JavaScript indicate creating objects. Var obj = {id: 1, name: "jacky"}; alert (obj. name); in the preceding example, an object with the property id (value: 1) and property name (value: jacky) is created. Attribute names can be enclosed in quotation marks as "id" and "name.
Apart from attributes, you can also create methods.

Test code
/* Window. onload = function ()
{
// Var obj = ();
Var obj1 = []; // object
Var obj2 ={}; // object
Var obj3 = //; // undefine
Alert (typeof (obj1 ));
Alert (typeof (obj2 ));
Alert (typeof (obj3 ));
}*/

Function showName ()
{
Alert (this. name );
}
Var obj = {id: 1, name: "jacky", showName: showName };
Obj. showName ();

2. Which of the following words does not belong to a reserved javascript word? (B)
A.
B. parent
C. class
D. void
The following reserved words cannot be used as variables, function names, object names, etc. Some of them are used for future JAVASCRIPT extension.

· Abstract

· Boolean

· Break

· Byte

· Case

· Catch

· Char

· Class

· Const

· Continue

· Default

· Do

· Double

· Else

· Extends

· False

· Final

· Finally

· Float

·

· Function

· Goto

· If

· Implements

· Import

· In

· Instanceof

· Int

· Interface

· Long

· Native

· New

· Null

· Package

· Private

· Protected

· Public

· Return

· Short

· Static

· Super

· Switch

· Synchronized

· This

· Throw

· Throws

· Transient

· True

· Try

· Var

· Void

· While

·

3. Select the true expression for the result: (c)
A. null instanceof Object (if (! (Null instanceof Object) is true)
B. null === undefined
C. null = undefined
D. NaN = NaN
(1) null can indeed be understood as the original type and cannot be understood as an Object!
Null, int, float... and other types represented by keywords do not belong to the Object.
Null can be used as a parameter, but it is a special rule.
It can be understood as follows:
An object reference represents a memory value. null is an empty reference. It can be understood that the memory value is 0.
(2) function f1 (){
}
1. alert (f1 instanceof Function); // true
2. alert (f1 instanceof Object); // true
3. alert (Function instanceof Object); // true
4. alert (Object instanceof Function); // true
A Function is an instance of an Object, and an Object is an instance of a Function.
A Function is a Function constructor, while an Object is a Function, and a Function itself is a Function.
Object. prototype is the vertex of all prototype chains. instanceof searches for the entire prototype chain.
Alert (Function );
Alert (Function. prototype );
Alert (Function. _ proto __);
Alert (Object );
Alert (Object. prototype );
Alert (Object. _ proto __);
Alert (function () {}). prototype );
Alert (function () {}). _ proto __);
Alert (function () {}). _ proto _. prototype );
Alert (function () {}). prototype. _ proto __);
Alert (Array. _ proto __);
Alert (123). _ proto __);
Alert (Number). _ proto __);
Alert ("test"). _ proto __);
Alert (String). _ proto __);
Alert (true). _ proto __);
Alert (Boolean). _ proto __);
/* Window. onload = function ()
{
If (NaN = NaN)
{
Alert ("ddd ");
}
}
*/
Ii. multiple choice questions
4. incorrect understanding of javascript: (abcd)
A. JScript is short for javascript
B. javascript is a Java scripting language developed by Netscape. It aims to simplify Java development.
C. There are a lot of compatibility problems between FireFox and IE mainly because they have different support for javascript.
D. javascript must be used for AJAX technology
5. If the foo object has the att attribute, which of the following methods can be used to obtain the value of the att attribute :()
A. foo. att
B. foo ("att ")
C. foo ["att"]
D. foo {"att "}
E. foo ["a" + "t" + "t"]
6. Which HTML tags can manually enter text without specifying special attributes? (ace)
A. <TEXTAREA> </TEXTAREA>
B. <INPUT type = "text"/>
C. <INPUT type = "hidden"/>
D. <DIV> </DIV>
7. Which of the following are global functions of javascript? (abc)
A. escape
B. parseFloat
C. eval
D. setTimeout
E. alert
8. Which of the following statements about IFrame are true? (abcd)
A. Through IFrame, the webpage can embed other webpage content and can be changed dynamically
B. Embedded IFrame can be used to obtain the object of the outer webpage under the same domain name.
C. Under the same domain name, the outer webpage script can obtain the objects in the IFrame webpage.
D. You can use a script to adjust the IFrame size.
9. Which of the following statements about the table are true? (abcde)
A. the table can contain TBODY elements.
B. the table can contain the CAPTION element.
C. The table can contain multiple TBODY elements.
D. The table can contain COLGROUP elements.
E. The table can contain the COL element.
10. Which of the following statements about the window object of IE are true? (acd)
A. window. opener attributes itself point to window objects
B. The window. reload () method can be used to refresh the current page.
C.window.location”a.html#and zookeeper location.href?a.html=the front page is replaced with an a.html page.
D. defines the global variable g. You can use window. g to access this variable.
Iii. Q &:
1. about the use of the javascript array sorting method sort (), focusing on the use of the sort () parameter and its internal mechanism
The implementation function of sort is similar to the JAVA comparator. Data Sorting starts from the first dimension of the multi-dimensional array.
You can define the sorting method by yourself. There are not many functions.
2. Briefly describe the differences between DIV elements and SPAN elements.
DIV has carriage return, SPAN does not
3. Combine the text structure to discuss the differences between innerHTML outerHTML innerText.
You only need to make it clear.
The HTML in the innerHTML object, outerHTML includes the object and
Text in the innerText object
4. Description of several XHTML specifications (at least 3)
The attribute is enclosed in quotation marks and no unmatched tags are allowed. Add the definition.
5. What are the related knowledge about Web standardization (or website reconstruction) and how many Web standards do you know?
A webpage consists of three parts: Structure, Presentation, and Behavior ). The corresponding website standards are also divided into three aspects: standard structured language, mainly including XHTML and XML; standard expression language mainly includes CSS; behavior standard mainly includes Object Model (such as W3C DOM) and ECMAScript.
Iv. Program questions:
1. Complete the content of the foo () function. A dialog box is displayed, prompting which of the following single orders are selected.<Br/> <p>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.