Java(Level1)期中考试题
(Total 25 marks. 1 mark for each question)
Part A - Vectors/Arrays
1. To use a vector you must import which of the following? Java.Vector.* java.util.Vector java.util.Collection java.io.* 2. A vector can be described as _______. A fixed length data structure A special type of stack A dynamic array A special type queue 3. Which of the following is false? A vector can be sorted. A vector is declared with an initial capacity. A vector can store mixed types of object. A vector exceeds its initial capacity by a factor of ten. 4. The ninth element of numArray is identified as follows,________ . numArray[8]; numArray[9]; numArray[] = 9; numArray[7] += 2; 5. Which of the following JAVA commands declares an array of 10 elements? int numbers[] = new int[10]; int numbers[10]; int numbers[] = 10; new int numbers[] = int[10];
Part B - Interface/AWT
6. Which of following is a device that unrelated objects use to interact with one another? an interface; a class; a method; a keyboard; 7. Which of the following in not an example of an AWT component? Canvas Scrollbar Table List 8. AWT stands for __________ . Automated Windowing Toolkit Automatic Workspace Toolkit Abstract Windowing Toolkit Absolutely Wacky Things 9. Which of the following is not part of using container? create the container choose a layout manager for the container add components to the container set the sound of the container 10. Which of the following statements is false? A layout is suggested ordering of UI components. Border, Card, Flow, Grid, and Gridbag are types of layout. The setModel(boolean b) method is a Dialog method. Not all containers have a layout.
Part C - File I/O
11. Which of the following options are available while working with sequential files? writing,reading,appending writing,reading reading,appending writing,appending 12. Which of the following methods will write a string to a sequential file? writeInt writeString writeSTR writeUTF 13. To open a random access file to add information to it use which attribute(s)? w r rw aw 14. To create a random access file you must create an object of which class? DataOutStream DataInputStream FileOutputStream RandomAccessFile 15. Which of the following is not true of random access files? The size of the files must be set when it is created. The size of records within the file can vary. The file should be initialized when it is created. You can not delete records in random access files.
Part D - Other Stuff
16. The class which enables us to break a string into separate components is the __________ class. StringSep StringTokenizer UnStrungString StrungOutString 17 The following code segment is an example of __________ . public void overload(String s){...} public void overload(int i){...} public void overload(int i, float f){...} multiple inheritance polymorphism overriding overloading 18 Three key words which are commonly used in exception handling routines are __________ . try, tryagain, catch try,throw,catch catch,rethrow,finally pitch,catch,strieout 19 When a sub-class method is used in preference to a supper-class method of the same name, this is an example of __________ . overloading instance overriding local scope 20 To convert data entered into an TextField into an integer, use which of the following? Integer.parseInt ParseInt.Integer String.parseInt (integer)(Textfield.getText 21. Which of the following defines a "Car" class, which it to behave just like a "Vehicle" class except that it has additional methods? Vehicle Car{...} class Vehicle extends Car{...} class Car extends Vehicle{...} class Car implements Vehicle{...} 22. Which of the following is true about abstract classes? You cannot derive a sub-class from it. You cannot instantiate the class. All methods must be abstract as well. The class definition contains the abstract keyword. 23. Which kind of data type are int, float, and double? wrapper boolean primitive user defined 24. An _______ is an action initiated by a user interaction with a GUL. event instance occurrence action 25. The keyword ________ specifies that an object or variable cannot be modified after it has been initialized. static final constant the end
您的成绩分数是:
正确答案:
*** 2001-04-05 ***