Nanjing University of Posts and Telecommunications Java programming job on-line programming fifth time

Source: Internet
Author: User

Tags: data one stripped Phi digital RGS bubble sum bre

Wang Li "Java language programming 5th time Job (2018)" Detailed
    1. Home
    2. My list of jobs
    3. Job Result Details
Score: 100 Selection Score: 501. Which of the following tools is a Java compiler? ( )A.javac.exeb.java.exec.javap.exed.javadoc.exe the correct answer is: A2. Which of the following data types are not part of the basic Java data type? ( )A.booleanb.charc.intd.string the correct answer is: D3. Suppose there is a definition for the following class: public class test{public static void Main (string[] args) {int a= 3, b = 4; swap (b); System.out.println ("a=" +a + "b=" + b); public static void swap (int a,int b) {int tmp = A; a = b; b = tmp;}} After the program runs, the result is ()a.a=4 b=3b.a=3 b=4c.a=a b=bd. No result output the correct answer is: b4. After executing the following code, the value of B is () int a=0, b=0; do{--b; a = A-1;} while (a>0);a.0b.1c.-1d. The correct answer to the dead loop is: C5. The following statement about arrays in Java is wrong (). A. Elements in an array must be of the same type B. The elements in the array are sequential C. Array objects, which are of reference type D. The size of the array can be arbitrarily changed the correct answer is: D6. In the loop body, which statement can I use if I want to end this cycle? ( )。 A.breakb.continuec.finald.finally the correct answer is: B7. Which of the following identifiers is an illegal identifier? ()A.staticsb.static_10c.10staticd. $statics 10 The correct answer is: C8. With the definition of an array int[] a = new int[3], the following reference to the array element is wrong (). A.a[0]b.a[a.length-1]c.int i=0;a[i]d.a[a.length]-1 The correct answer is: D9. int a=new int[2][3], the array contains () the number of elements. a.2b.3c.6d. Not sure the correct answer is: C10. The following code snippet executes after the value of Count is what () int count = 1; for (int i = 1; I <= 5; i++) {count + = i;} System.out.println (count);a.5b.1c.15d.16 correct answer is: D Programming question score: 50Digital Encryption Score: 10/10
Import Java.util.Scanner;/** * @Author Liguo * @Description Enter a four-digit number to encrypt the output. * The method is to add 9 to each digit of the number, and then divide by 10 to take the remainder, as the new number on the bit, * Finally, the numbers on the thousand and 10 digits are exchanged, the hundred and the digits on the digit interchange, the new four digits of the encryption. * For example, input 1257, after adding 9 to obtain the new number 0146, and then two times after transposition to get 4601. * Input Description * Input gives a four-bit integer x in a row, which is the number required to be encrypted. * Output Description * The new number V obtained after encrypting the output of the format "the encrypted-number is V" in a row. * Sample Input 1: * 1257 * Sample Output 1: * The encrypted number is 4601 * @Data 2018-04-27 */PublicClassMain {PublicStatic StringJiami (int a) {int temp = string.valueof (a). Length ();int b[] =NewINT[TEMP];Integer into an array from high to lowfor (int i = temp-1; I >=0; i--) {b[i] = a%10; A = A/10; }for (int number:b)System.out.print (number + "");Add each number of digits to 9 and divide by 10 to take the remainder.for (int i =0; I <b.length;i++) {b[i] = ((B[i] +9)%10); }Swap thousand bits and very bit b[0] thousand points, b[2] very bit b[0] + = b[2]; b[2] = b[0]-b[2]; b[0]-= b[2];Swap percentile and sub-b[1] 百0, b[3] bit b[1] + = b[3]; b[3] = b[1]-b[3]; b[1]-= b[3];Convert an array to an integer of type string StringBuffer str =New StringBuffer ();for (int i=0;i<b.length;i++) { Str.append (B[i]); } return str.tostring (); //for (int number:b) //System.out.println (number); public static void main (String[] args) {Scanner Span class= "Hljs-keyword" >in = new Scanner (System. in); int temp = in.nextint (); String result = Jiami (temp); System. out.println ( "The encrypted number is" +result);}}    
Series Sort score: 10/10
Import Java.util.arrays;import Java.util.Scanner;/** * @Author Liguo * @Description 2. Sequence of Numbers The title describes the ordering of the middle 10 elements in an array with 20 elements in order from large to small, requiring the use of a bubbling method. Enter a description enter 20 integers less than 50 in a row, with only 1 space intervals between the data. The output describes the array of direct output changes, each of which occupies 4 columns of column width.   Sample Input 1:5 4 3 2 1 8 5 2 9 6 3 1 4 7 4 1 2 3 4 5 Sample Output 1:5 4 3 2 1 9 8 7 6 5 4 3 2 1 4 1 2 3 4 5 * @Data 2018-04-27 * *PublicClassMain {PublicStaticvoidMaopaosort (int n[]) {for (int i =1; I <=n.length-1; i++) {for (Int J =0; J <= N.length-1-i; J + +) {The value is exchanged after the big value.if (n[j]<=n[j+1]) {n[j]+=n[j+1]; n[j+1] = n[j]-n[j+1]; n[j]-=n[j+1]; } } } }PublicStaticvoidMainString[] args) {Scannerin =New Scanner (System.in);int []array1 =Newint[20];int []array2;for (int value:array1) {Value = In.nextint ();// }for (int i =0; I <array1.length; i++) {array1[i]=in.nextint (); Array2= Arrays.copyofrange (Array1,5,15); //copied array from 5-14. No 15//System.out.println (arrays.tostring ( Array2)); Maopaosort (array2); //System.out.println (arrays.tostring (array2)); //arraycopy (array2,0,array1,5,10); for (int i =0, j = 5; i < array2.length; i++,j++) {Array1[j] = array2[i];} for (int value:array1) System.< Span class= "Hljs-keyword" >out.printf ( "%4d", value);}}   
6-4-4 print Yang Hui triangle score: 10/10
Import Java.util.Scanner;/** * @Author Liguo * @Description Enter an integer representing the number of rows of the triangle the Yang Hui triangular type that describes the corresponding number of rows, each element of the triangle use the format string "5d" To print output sample input 1:5 sample output 1:11 11 2     11 3 3 11 4 6 4 1 Example Input 2:9 sample output 2:11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 11 7 21 35 35 21 7 11 8 28 56 70 56 28 8 1 * @ Data 2018-04-27 */PublicClassmain{PublicStaticvoidYanghui (int n) {int a [] =Newint [n][n]; a[1]:0] =1;for (int i =1; I < n; i++) {a[i][0]=1; a[i][i]=1;for (Int J =1; J < I; J + +) {A[i][j] = A[i-1][j-1]+a[i-1][J]; } }//prints a two-dimensional array. Show Yang Hui triangle for (int i = " Span class= "Hljs-number" >0; I < n; i++) {for (int j = 0; J <=i; J + +) {S Ystem. out.printf ( "%5d", A[i][j]);} System. out.println (); } public static void main (string[] args) {Scanner in = new Scanner (System. in); int n = in.nextint (); Yanghui (n);}}      
6-4-3 constructs the specified number of series scores: 10/10
Import Java.util.arraylist;import Java.util.Scanner;/** * @Author Liguo * @Description Title Description write function fun, find out that A to B can be divisible by 7 or 11, but not both 7 and 11 are divisible by all positive numbers, and put them in the array, the function returns the number of these numbers. Write the main function, enter a value of a, B, and call the function to perform the operation. Enter a value (1<=a<=b<1000) from the keyboard input A, B, enter the value of A/b with the following format string: used in the C language: scanf ("%d%d", &a,&b); In the Java language, use the Nextint () method of the scanner object to get the value of a, B.  The output describes the value of the element in the output array with the following format string: "%d" (note:%d followed by a space) sample input 1:1 < return &GT;II Sample output 1:7 11 14 Sample Input 2:50 < return > sample output 2:55 56 63 66 70 98 * @Data 2018-04-28 21:11 * *PublicClassMain {PublicStaticvoidFunint A,int b) {Boolean flag=Trueint count =0;int []arr = new INT[B-A]; ArrayList <Integer> arr =New ArrayList <> (B-A);for (int i = A; I <= b; i++) {flag = (i%7==0| | i%11==0);if (i%77==0) flag =Falseif (flag) {Arr.add (i);}} arr.trimtosize (); Arr.toarray (); 
                                 
                                  for (
                                  int value:arr) System.out.printf ( "%d", value);} public static void main (string[] args) {Scanner in = new Scanner (System. in); int a = in.nextint (); int B = in.nextint (); fun (b);}}     
                                  
6-4-1 averaging score: 10/10
Import Java.util.arrays;import Java.util.Scanner;/** * @Author Liguo * @Description * programmed to enter 20 integers from the keyboard, to remove the maximum and minimum values for those elements after the average input description of the continuous input 20 integers, with a space as a delimited output of the C language and the Java language, Output results in the following format string: "count=%d,average=%.2f\n" in the Python language, output results in the following format string: "count={},average={:.2f}" Sample input 1:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Sample output 1:count=18,average=10.50 sample input 2:90 80 70 100 50 60 70 100 75 85 85 90 80 70 65 50 60 70 80 90 Sample output 2:C ount=16,average=76.25 * @Data 2018-04-29 0:12 * *PublicClassMain {PublicStaticvoidMainString[] args) {Scannerin =New Scanner (System.in);int []arr =Newint[20];int count=20;int sum=0;Double average =0;Data entryfor (int i =0; I <20; i++) {arr[i]=In.nextint (); } arrays.sort (arr);Remove the maximum minimum value to remove both endsfor (int i = 1; i < 19; i++) {if (arr[i] = = Arr[0] | arr[i] = = Arr[19]) {Arr[i] = 0; count--;}} //remove two maximum minimum value arr[0] = 0; arr[< Span class= "Hljs-number" >19]=0; Count-=2; for (int value:arr) sum+= value; Average = (double) Sum/count; System. out.printf ( "count=%d,average=%.2f\n", Count,average);}}   

Nanjing University of Posts and Telecommunications Java programming job on-line programming fifth time

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.

Tags Index: