设为首页 收藏本站 English

当前位置: 裕能五金网 >> 制砂机

计算机等级考试二级JAVA模拟试题平垫圈

发布时间:2022-07-29 08:16:19

计算机等级考试二级JAVA模拟试题

计算机等级考试二级JAVA模拟试题 2011年12月10日 来源: 一、 选择题 1、下面哪些是java语言中的关键字? A sizeof B abstract C NULL D Native 答:B 2、下面语句哪个是正确的? A char='abc'; B long l=oxfff; C float f=0.23; D double=0.7E-3; 答:D 3、以下程序测试String 类的各种构造方法,试选出其运行效果。   class STR{    public static void main(String args[]){     String s1=new String();     String s2=new String("String 2");     char chars[]={'a',' ','s','t','r','i','n','g'};     String s3=new String(chars);     String s4=new String(chars,2,6);     byte bytes[]={0,1,2,3,4,5,6,7,8,9};     StringBuffer sb=new StringBuffer(s3);     String s5=new String(sb);     System.out.println("The String No.1 is "+s1);     System.out.println("The String No.2 is "+s2);     System.out.println("The String No.3 is "+s3);     System.out.println("The String No.4 is "+s4);     System.out.println("The String No.5 is "+s5);    }   } A The String No.1 is    The String No.2 is String 2    The String No.3 is a string    The String No.4 is string    The String No.5 is a string B The String No.1 is    The String No.2 is String 2    The String No.3 is a string    The String No.4 is tring    The String No.5 is a string C The String No.1 is    The String No.2 is String 2    The String No.3 is a string    The String No.4 is strin    The String No.5 is a string D 以上都不对 答:A 4、下面语句段的输出结果是什么?   int i = 9;   switch (i) {   default:   System.out.println("default");   case 0:   System.out.println("zero");   break;   case 1:   System.out.println("one");   case 2:   System.out.println("two"); } A default B default, zero C error default clause not defined D no output displayed 答:B 二、不定项选择题(在每小题的五个备选答案中选出正确答案,并将正确答案的序号填入题干后面的括号内,错选多选,漏选均不得分。) 1、给出如下代码: class Test{   private int m;   public static void fun() {     // some code...   } } 如何使成员变量m 被函数fun()直接访问? A、将private int m 改为protected int m B、将private int m 改为 public int m C、将private int m 改为 static int m D、将private int m 改为 int m 答: C 2、下面哪几个函数是public void example(){...}的重载函数? A、 public void example( int m){...} B、public int example(){...} C、public void example2(){...} D、 public int example ( int m, float f){...} 答: A,D 3、给出下面的代码段: public class Base{ int w, x, y ,z; public Base(int a,int b) { x=a; y=b; } public Base(int a, int b, int c, int d) { // assignment x=a, y=b w=d; z=c; } } 在代码说明// assignment x=a, y=b处写入如下哪几个代码是正确的? A、 Base(a,b); B、x=a, y=b; C、x=a; y=b; D、this(a,b); 答: C,D 4、已知如下定义:String s = "story"; 下面哪个表达式是合法的? A、 s += "books"; B、char c = s[1]; C、int len = s.length; D、String t = s.toLowerCase(); 答: A,D 5、Java中main()函数的值是什么? A、 String B、int C、char D、void 答:D 6、如下哪些字串是Java中的标识符? A、 fieldname B、super C、3number D、#number E、$number 答: A,E 7、如下哪些是Java中有效的关键字? A、 const B、NULL C、false D、this E、 native 答:A,C,D,E 8、如下哪些是Java中正确的整数表示? A、22 B、0x22 C、022 D、22H 答: A,B,C 9、下面的代码段中,执行之后i 和j 的值是什么? int i = 1; int j; j = i++; A、 1, 1 B、1, 2 C、2, 1 D、2, 2 答: C 10、下面句话是正确的? A、 >> 是算术右移操作符. B、>> 是逻辑右移操作符. C、>>> 是算术右移操作符 D、>>> 是逻辑右移操作符答:A,D 11、下面哪个赋值语句是合法的? A、float a = 2.0 B、double b = 2.0 C、int c = 2 D、long d = 2 答:B,C,D 12、下面哪个是main()函数的合法参数? A、char args[] B、char args[][] C、String arg要[] D、String args 答: C 13、下面哪个语句是创建数组的正确语句? A、 float f[][] = new float[6][6]; B、float []f[] = new float[6][6]; C、float f[][] = new float[][6]; D、float [][]f = new float[6][6]; E、float [][]f = new float[6][]; 答:A,B,C,D 14、已知表达式int m[] = {0, 1, 2, 3, 4, 5, 6 }; 下面哪个表达式的值与数组下标量总数相等? A、 m.length() B、m.length C、m.length()

兴平市试验机

微机控制电子万能拉力试验机WDW-200价格

液压万能试验机价格

冲击试验机的操作规程一定要了解

WDS-10M万能试验机厂家

友情链接