2015桂电JAVA题库重点(含答案翻译)
- 格式:doc
- 大小:383.50 KB
- 文档页数:19
1、Which of the following is not a valid Java identifier?下列哪个不是一个有效的Java标识符()A. my ValueB. $_AAA1C. widthD. m_x2、发送消息,意味着一个对象()A. You call a method of the object.你对象的调用一个方法。
B. You access a variable of the object.C. Both (a) and (b).D. Neither (a) nor (b).3、Which of the following is a Scanner method?下列哪个是扫描仪的方法?()A. nextLine.B. nextText.C. nextWord.D. readNext.4、Which is a correct static method call of Math class method sqrt?这是一个正确的数学类的静态方法调用方法执行?()A. sqrt( 900 );.B. math.sqrt( 900 );.C. Math.sqrt( 900 );.D. Math math = new Math(); math.sqrt( 900 );.5、Declaring main as ________ allows the JVM to invoke main without creating an instance of theclass.宣布主要在允许JVM调用主要没有创建类的实例()A. public.B. void.C. static.D. final.6、Consider the array:()s[ 0 ] = 7s[ 1 ] = 0s[ 2 ] = -12s[ 3 ] = 9s[ 4 ] = 10s[ 5 ] = 3s[ 6 ] = 6The value of s[s[6]-s[5]] is:A. 0.B. 3.C. 9.D. 10.7、What do the following statements do?下面的语句做什么?( )double[] array;array = new double[ 14 ];A. Create a double array containing 13 elements.B. Create a double array containing 14 elements.创建一个数组包含14个元素的两倍。
C. Create a double ar ray containing 15 elements.D. Declare but do not create a double array.8、The _________ of a class are also called the public services or the public interface thatthe class provides to its clients. 类的_____也称为公共服务或类的公共接口提供给它的客户。
( )A. public constructors.B. public instance variables.C. public methods.D. All of the above.9、Using public set methods provides data integrity if:使用公共设置方法提供数据完整性,如果:( )A. The instance variables are public.实例变量是公开的。
B. The instance variables are private.C. The methods perform validity checking.执行有效性检查的方法D. Both b and c.10、Which of the following keywords allows a subclass to access a superclass method evenwhen the subclass has overridden the superclass method?下列哪个关键字允许子类访问一个超类方法即使子类覆盖父类的方法?()A. base.B. this.C. public.D. s uper.11、Which method changes the text the label displays?哪个方法改变了文本标签显示?()A. changeText.B. setText.C. changeLabel.D. setLabel.12、A(n) class cannot be instantiated.()类不能被实例化。
A. final.B. concrete.C. abstract.抽象的,D. polymorphic.13、Consider the abstract superclass below:()考虑下面的抽象超类public abstract class Foo{private int a;public int b;public Foo( int aVal, int bVal ){a = aVal;b = bVal;} // end Foo constructorpublic abstract int calculate();} // end class FooAny concrete subclass that extends class Foo:任何具体子类扩展类Foo:A. Must implement a method called calculate.必须实现一个名为计算的方法。
B. Will not be able to access the instance variable a.将无法访问实例变量。
C. Neither (a) nor (b).D. Both (a) and (b).14、When an exception occurs it is said to have been:()当异常发生时,据说:A. caught.B. thrown.C. declared.D. handled.15、An uncaught exception:()未捕获的异常:A. is a possible exception that never actu ally occurs during the execution of the program.B. is an exception that occurs for which the matching catch clause is empty.C. is an exception that occurs for which there are no matching catch clauses.是一个例外,因为没有匹配的条款D. is another term for a thrown exception.16、Which of the following statements is true? ()下列哪个陈述是正确的?A. [^Z] is the same as [A~Y];B. Both “A*” and “A+” will match “AAA”, but only “A*” will match an empty string.“*”和“+”将匹配“AAA”,但只有“*”将匹配一个空字符串C. Ranges of characters can be represented by placing a ~ between two characters;D. All of above;17、Which of the following classes is not used for file input? ()下列哪类不用于文件输入?A. FileInputStreamB. FileReaderC. ObjectInputStreamD. Formatter格式化程序18、Menus are attached to windows by calling method()菜单连接到窗口通过调用方法A. addMenuBar.B. setJMenuBar.C. setMenu.D. addJMenuBar.19、The ________ determines which thread runs next. ()规律决定了哪些线程运行下一个。
A. thread managerB. thread scheduler线程管理器C. thread queueD. None of the above.20、Which of the following is not a GUI component (control or widget)?()下列哪个不是一个GUI组件(控制或部件)?A. String.B. Button.C. Menu.D. Combo box.21、What is the value of result after the following Java statements execute? ()什么是价值以下Java语句执行后的结果吗?int a, b, c, d, result;a = 4;b = 12;c = 37;d = 51;result = d % a * c + a % b + a;E. 119F. 51G. 127H. 5922、What is the default value of a reference? ()一个参考的默认值是什么?A. 0.B. "".C. null.D. default.23、A default constructor has how many parameters? ()一个默认的构造函数参数有多少?A. 0.B. 1.C. 2.D. Variable.24、Information is passed to a method in: ()信息被传递给一个方法:A. the method name.B. that method's return.C. the method body.D. the arguments to the method.25、Any field declared with keyword ________ is constant. ()用关键字声明在任何领域都是常数A. static.B. const.C. constant.D. final.26、Which of the following initializer lists would correctly set the elements of arr ay n? ()下列哪个初始化器列表正确设置数组的元素n吗?A. int[] n = { 1, 2, 3, 4, 5 };.B. array n[ int ] = { 1, 2, 3, 4, 5 };.C. int n[ 5 ] = { 1; 2; 3; 4; 5 };.D. int n = new int( 1, 2, 3, 4, 5 );.27、Consider the program below: ()考虑下面的程序:public class Test{public static void main( String[] args ){int[] a;a = new int[ 10 ];for ( int i = 0; i < a.length; i++ )a[ i ] = i + 2;int result = 0;for ( int i = 0; i < a.length; i++ )result += a[ i ];System.out.printf( "Result is: %d\n", result );} // end main} // end class TestThe output of this program will be:这个程序的输出A. Result is: 62.B. Result is: 64.C. Result is: 65.D. Result is: 67.28、The static method ________ of class String returns a formatted String. ()静态方法在类的字符串返回一个格式化字符串A. printf.B. format.格式C. formatString.D. toFormatString.29、When implementing a method, use the class’s set and get methods to access the class’s________ data. ()当执行一个方法,使用类的设置和获取方法来访问类的数据了。