How is your Java skills tested on your own?

Source: Internet
Author: User

How is your Java skills tested on your own?

========================================================== ======================================

Note:

The following are Java questions I designed for 2008 students at the School of Computer Science and Technology of Beijing University of Technology. If you are interested, you may wish to test yourself to see how many points you can score.

At present, I am correcting the student's examination paper. After this work is completed, I will post the examination comments and analyze the examination results in a few days. There will be something worth noting.

Jin xuliang

========================================================== ======================================



School of Computer Science and Technology, Beijing University of Technology, 2010-2011 first semester

Java technology and application test questions ()

Class student ID name score _

Note:

(1) This exam is an open-book exam. Students are allowed to carry relevant books and other paper materials, but not

Computers, smartphones, and other electronic devices must be used.

(2) The examination time is 2 hours.

(3) Short answer and programming questions are written on the answer sheet attached to the examination paper, marking the question number.

(4) If the volume is not neat, and the code and text are hard to be identified, the score is deducted from 5 points.

(5) If there is no standard answer to some questions, scores can be given as long as they are justified.

**************************************** ***************************************

I. Answer questions (correct descriptions are checked and incorrect forks are scored. Each question has 1 point, with a total of 10 points)

1. Only one public class can be defined in a Java source file, and the class name must be consistent with the file name. ()

2. By introducing the "import javax. swing. *;" statement in the program, you can use all classes in the javax. swing package (including the classes in its nested sub-packages ). ()

3. J2SE is a subset of J2SE. ()

4. Java bytecode can be executed only after it is loaded into the memory. ()

5. Swing is a set of GUI components. It adopts a new idea to design the Java application interface, and completely replaces the original AWT. ()

6. Writing too many comments during programming will increase the program file generated after compilation. ()

7. Java Applet can run in a browser, which means that the browser itself can directly execute the Applet. ()

8. The Enumeration type (enum) added to JDK 5.0 is a raw data type. ()

9. Java requires that all methods must be put into a class, and there is no method independent from the class. ()

10. object-oriented software system designers often use UML as a programming language. ()

 


Ii. Short answer (please write the answer on the answer sheet and enter the question number. 4 points per question, 40 points in total)

1. Modern Programming Languages have many classification methods. Below is a common classification method:

(1) "compiled" programming language: for example, C, the program source code must be compiled before running;

(2) "interpreted" programming language: This type of language (such as the early Basic) usually has an interactive environment, the user enters a code and the computer executes a code.

Which type does Java belong? If you think Java does not belong to any of the above types, does it belong to another programming language type?

2. There are two keywords in Java: void and null. What are their differences?

3. Briefly describe the relationship between the four concepts of "class", "class library", "package", and "jar File.

4. an Object-Oriented Program will create multiple objects at runtime. These objects can usually "send messages" to each other and talk about your understanding of the sentence "send messages between objects, write a few Java sample codes to show the specific programming methods for sending messages between objects.

5. The addition operator "+" can be applied to variables of the original numeric type (such as int), but we find that some variables of the object type (such as Integer) also support the "+" Operation:

Integer v1 = 100;

Integer v2 = 200;

System. out. println (v1 + v2); // output: 300

It seems that the Integer type is overloaded with the "+" operator. Some programming languages such as C ++ can overload the operator, but Java itself does not support this feature. Based on your understanding or speculation, what method does Java use to process the "+" statements of Two Integer objects?

6. in a large loop (such as a loop of 100000 times), if a large number of String connection operations are required, people usually use StringBuffer (or StringBuilder) instead of the String type, please explain the reason for doing so.

7. There are two arrays with different lengths:

Int [] arr1 = new int [10];

Int [] arr2 = new int [100];

Can the following statements be compiled?

Arr1 = arr2;

If you think it is possible to get this conclusion through compilation, what is the basis? If it cannot be compiled, what do you think is the reason?

8. See the following code:

Double d1 = 100.1;

Double d2 = 1001/10;

System. out. println (d1 = d2); // output: false

Obviously, d1 and d2 are equal. Why is an unexpected result output during the program running: false?

9. When multiple catch statements are used to catch multiple exceptions, Java requires that the catch statements for capturing exceptions must be placed at the end, as shown below:

Try {...... }

Catch (ClassCastException ex ){...... }

Catch (NumberFormatException ex ){...... }

Catch (Exception ex ){...... } // This sentence must be placed at the end!

Why is there this restriction? Let's talk about your understanding.

10. See the following sample code:

String s1 = "Hello ";

String s2 = "Hello ";

System. out. println (s1 = s2); // output: true

String s3 = new String ("Hello ");

String s4 = new String ("Hello ");

System. out. println (s3 = s4); // output: false

& N

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.