One, the Java part of the test
Question 1: (5 points)
Write a program that connects each element of an array of integers with commas to a string, for example, a string of "1,2,3" based on an array of [1][2][3] content.
Question 2: (6 points)
Write a method in a class that searches for the presence of a character in an array of characters and, if it exists, returns the first occurrence of the character in the character array (the ordinal number starts at 0), otherwise, returns-1. The array of characters and characters to search for are passed to the method as arguments, and illegalargumentexception exceptions should be thrown if the passed-in array is null. In the main method of the class, test to verify that the method is written correctly, for example, if the character does not exist, the character exists, and the passed-in array is null, in a variety of possible scenarios.
Question 3: (8 points)
Write a program that converts a string entered on the keyboard to a decimal integer, and then prints out the binary form corresponding to the decimal integer. This program should consider the case in which the input string cannot be converted to a decimal integer, and whether the reason for the conversion failure is whether the number is too large, or if it contains a non-numeric character.
tip: decimal number to binary number of the way is divided by 2, the remainder is the lowest bit of binary number, and then use the resulting quotient as a dividend to remove the 2, this time the remainder is the secondary low, so loop until the divisor is 0. In fact, as long as you understand how to print out a decimal number of each bit of the way (constantly divided by 10, the remainder is a single, 10 bits, hundreds), it is easy to understand the decimal number to binary number of this way.
Question 4: (10 points)
Please print out a decimal integer of 16 in the form of a shift. Tip: Shift and go high on every 4 bits, the resulting result is one of the hexadecimal numbers, and then one of the three ways (required for each method) is computed for a hexadecimal value corresponding to the 16 form: (1) 0-9 the numeric value directly plus the character ' 0 ', More than 9 of the value minus 10 plus the character ' a ' (2) defines an array that contains 0-f these characters, and then uses the value to be computed as the index number of the array to obtain its corresponding hexadecimal data. (3) The Character.fordigit static method converts a hexadecimal number to its corresponding character representation, for example, returning the character ' F ' according to the value 15.
Question 5: (7 points)
Write a program that implements the backup of the file, and the command syntax when the program runs is:
Java mycopy (sourcefile) (DestFile)
Question 6: (8 points)
Please refer to the eighth chapter of the Java Employment Training Tutorial to write a window program that closes the window when the user clicks the "X" button on the window.
Question 7: (15 points)
The programming of connection-oriented communication using socket sockets. The client reads the local file and sends it, and the server receives the file and saves it to the local file system.
Question 8: (15 points)
In the first episode of the seventh lecture on JavaScript video, when you import a text file that holds an IP address to a locale-control relationship, you should replace some of the spaces with commas (,), that is, the contents of a text file in the following format:
Start IP End IP Region
61.54.231.245 61.54.231.245 Henan Province Anyang New Century Internet café
61.54.231.246 61.54.231.246 Henan province Anyang unknown area
61.54.231.9 61.54.231.247 Henan Province Anyang Red Sun Internet café
61.54.231.248 61.54.231.248 Henan Province Anyang Anyang Teachers ' College
61.54.231.249 61.54.231.249 Henan Province Anyang black spider web Bar (near Teachers ' College)
This format should be converted to the following:
61.54.231.245,61.54.231.245, Anyang New Century Internet café, Henan Province
61.54.231.246,61.54.231.246, Anyang unknown area, Henan province
61.54.231.9,61.54.231.247, Red Sun Internet Café, Anyang, Henan Province
61.54.231.248,61.54.231.248, Anyang Teachers ' College, Anyang, Henan Province
61.54.231.249,61.54.231.249, Anyang black spider web in Henan Province (near Teachers ' College)
In the video tutorial, you can use the regular expression substitution feature of UltraEdit to complete the transformation above. Starting with jdk1.4, the Java language provides relevant API classes and methods for handling regular expressions, and in the JDK Help documentation, see the ReplaceAll method of the String class, which supports regular expression substitution functions similar to ultraedit.
Task 1:
Read the Help for the String.replaceall method and the relevant hyperlinks it provides, and after you know how to use the method, write a Java program that automatically implements the above regular expression substitution anda.txt (Download)After the number of spaces in the IP address numbers is replaced with the "," number, the replacement result is saved to the B.txt file.
Task 2:
When we implement the IP region query system in the www.it315.org Web site, we use SQL syntax similar to the following:
Select region from IP table where user ip> start IP and user ip< end IP
This SQL statement allows you to query the local results of the user's IP. Because the comparison of user IP to start IP and end IP is a string comparison, if the user IP is 9.1.1.1, the result of comparison with 61.54.231.245 is that the former is greater than the latter because the first character of the user's IP "9" is greater than the first character in 61.54.231.245 "6". Now, please come up with a solution that allows the above SQL statements to return the correct results. Tip: Change 9.1.1.1 to 009.001.001.001 and compare it to 061.054.231.245.
Please use the regular expression to improve your program, that is, the program in the A.txt file in the conversion of IP address to the B.txt file, can be in each of the less than 3 bits of IP address before 0 to fill 3 bits. For example 61.5.23.115, this IP address should be saved in the B.txt file in the form of 061.005.023.115.
In the source program, you want to annotate the function of the program code, and submit the program you wrote to us, please attach the instructions for the use of the program.
Question 9: (choose to do)
Write a wrapper class for the character input stream that wraps the underlying character input stream through the wrapper class, allowing the program to read a text file (for example, a Java source file) with the line number and colon in front of each line read.
Question 10: (choose to do)
Please combine the regular expression and the string.split approach, described in our book JavaScript Web development, from "http://www.it315.org/get.jsp?user=zxx&pass=123" The name and value of each parameter are extracted from such a URL address. Notice here that you want to escape processing in the regular expression.
Second, the Javasript question part
Question 1: (8 points)
Please write a form page similar to the following form:
Question 2: (8 points)
Please click on the following content to write a page, click on the "Select All" in the page, you can select or clear all the fruit above.
Choose the fruit you like:
-Apples-oranges-bananas-grapes-peaches-All selected
Question 3: (10 points)
Please visit the bbs.csdn.net page, this page to the left-hand side of the navigation bar section can shrink, display, please refer to this page to write a navigation bar can also shrink, display the page.