Simple JavaScript pen questions

Source: Internet
Author: User
Tags spl javascript array java comparator
I. multiple choice questions
1. Which of the following statements will generate a running error? ()
A. var OBJ = ();
B. var OBJ = [];
C. var OBJ = {};
D. var OBJ = //;
2. Which of the following words does not belong to a reserved JavaScript word? (B)
A.
B. Parent
C. Class
D. Void
3. Select the true expression for the result: (c)
A. null instanceof object
B. null === undefined
C. null = undefined
D. Nan = Nan

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? (ACE)
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? (AB)
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. Too many locationtypes such as a.html#and zookeeper location.href?a.html=the front pages are replaced with a.html pages.
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 <span id = "outer"> <span id = "inner"> text </span> 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?
W3C standards
IV, Program Question:
1. Complete the content of the Foo () function. A dialog box is displayed, prompting which of the following single orders are selected.
<HTML>
<Body>
<SCRIPT>
Function Foo (){
// Add Code
VaR Rg = Document. getelementsbyname ("radiogroup ");
For (VAR I = 0; I <RG. length; I ++)
{
If (RG [I]. Checked)
{
Alert ("you have selected" + (I + 1) + "single region ");
}
}
Return false;
}

</SCRIPT>
<Body>
<Form name = "form1" onsubmit = "Return Foo ();">
<Input type = "radio" name = "radiogroup"/>
<Input type = "radio" name = "radiogroup"/>
<Input type = "radio" name = "radiogroup"/>
<Input type = "radio" name = "radiogroup"/>
<Input type = "radio" name = "radiogroup"/>
<Input type = "radio" name = "radiogroup"/>
<Input type = "Submit"/>
</Form>
</Body>
</Html>
2. Fill in the function body of the annotation part to bring up the "successful" dialog box for Foo () function call. The Code should be as short as possible.
<HTML>
<Body>
<SCRIPT>
Function Foo (){
VaR STR = reverse ('a, B, c, d, e, f, G ');
Alert (STR );
If (STR = 'G, F, E, D, C, B, A') Alert ('success ');
Else alert ('failed ');
}
Function reverse (STR)
{
// Add code here to complete the string flip Function
VaR SPL = Str. Split (',');
VaR newstr = "";
For (I = SPL. Length-1; I> = 0; I --)
{
Newstr + = SPL [I] + ',';
}
Newstr = newstr. substring (0, newstr. Length-1)
Return newstr;
}
</SCRIPT>
</Head>
<Body>
<Input type = "button" value = "str" onclick = "Foo ()"/>
</Body>
</Html>

Function reverse (STR ){
// Add code here to complete the string flip Function
Return Str. Split (","). Reverse (). Join (",");
}

Related Article

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.