<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. 七年級優秀作文:有你真好

    時間:2025-08-31 07:12:09 初一作文 我要投稿

    七年級優秀作文:有你真好

      一、選擇題

    七年級優秀作文:有你真好

      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 類的各種構造方法,試選出其運行效果。

      public class abc {

      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、下面語句段的輸出結果是什么?

      inti = 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() { /pic/p>

      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(inta,int b) { x=a; y=b; } public Base(int a, int b, int c, int d) { /pic/pic/p>

      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、intlen = 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 的值是什么? inti = 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()+1 D、m.length+1 答:B

      15、已知如下的命令執行 java MyTest a b c 請問哪個語句是正確的? A、args[0] = "MyTest a b c" B、args[0] = "MyTest" C、args[0] = "a" D、args[1]= 'b' 答:C, D

      16、已知如下代碼: public class Test { long a[] = new long[10]; public static void main ( String arg[] ) { System.out.println ( a[6] ); } } 請問哪個語句是正確的? A、Output is null. B、Output is 0. C、When compile, some error will occur. D、When running, some error will occur. 答:B

      17、已知如下代碼:boolean m = true; if ( m == false ) System.out.println("False"); else System.out.println("True"); 執行結果是什么? A、False B、True C、None D、An error will occur when running. 答: B

      18、已知如下代碼: public class Test { public static void main(String arg[]) { inti = 5; do { System.out.println(i); } while (--i>5) System.out.println("finished"); } } 執行后的輸出是什么? A、 5 B、4 C、6 D、Finished E、None 答:A,D

      19、下面代碼執行后的輸出是什么? outer: for(inti=0;i<3; i++) inner: for(int j=0;j<2;j++) { if(j==1) continue outer; System.out.println(j+ "and "+i); } A、 0 and 0 B、0 and 1 C、0 and 2 D、1 and 0 E、1 and 1 F、1 and 2 G、2 and 0 H、 2 and 1 I、 2 and 2 答: A,B,C

      20、已知如下代碼: switch (m) { case 0: System.out.println("Condition 0"); case 1: System.out.println("Condition 1"); case 2: System.out.println("Condition 2"); case 3: System.out.println("Condition 3");break; default: System.out.println("Other Condition"); } 當m 的值為什么時輸出"Condition 2"? A、 0 B、1 C、2 D、3 E、4 F、None 答:A,B,C

      21、當瀏覽器返回到新URL的包含applet 的頁面時調用以下哪個函數? A、init() B、start() C、stop() D、destroy() 答:B

      22、以下哪個方法用于定義線程的執行體? A、 start() B、init() C、run() D、main() E、synchronized() 答:C

      23、Java中如下哪個約束符是正確的? A、 private B、public C、protected D、protect E、friend 答:A,B,C

      24如果類中的成員變量可以被同一包訪問,則使用如下哪個約束符? A、 private B、public C、protected D、no modifier E、final 答:D

      25、以下哪個約束符可用于定義成員常量? A、 static B、final C、abstract D、No modifier can be used 答:B

      26、如下哪個語句正確說明了native方法? A、 public native void test(); B、public native void test(){} C、public void native test(); D、public native test(){} 答:A

      27、已知如下類說明:public class Test { private float f = 1.0; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); /pic/p>

      28、已知如下代碼: 1: class Example{ 2: String str; 3: public Example(){ 4: str= "example"; 5: } 6: public Example(String s){ 7: str=s; 8: } 9:} } 10: class Demo extends Example{ 11: } 12: public class Test{ 13:public void f () { 14:Example ex = new Example("Good"); 15:Demo d = new Demo("Good"); 16:} } 哪句語句會導致錯誤? A、 line 3 B、line 6 C、line 10 D、line 14 E、line 15 答:E

      29、已知如下類定義: class Base { public Base (){ /pic/pic/pic/pic/pic/pic/pic/pic/p>

      30、如下哪個語句是正確的? A、 In Java single inheritance is allowed, which makes code more reliable. B、A subclass inherits all methods ( including the constructor ) from the superclass. C、 A class can implement as many interfaces as needed. D、When a class implements an interface, it can define as many methods of the interface as needed. 答:A,C

      31、在如下源代碼文件Test.java中, 哪個是正確的類定義? A、 public class test { public int x = 0; public test(int x) { this.x = x; } } B、public class Test{ public int x=0; public Test(int x) { this.x = x; } } C、public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } } D、 public class Test extends T1{ public int x=0; public Test(int x){ this.x = x; } } E、protected class Test extends T2{ public int x=0; public Test(int x){ this.x=x; } } 答:B,D

      32、Person, Student 和Teacher 都是類名。這些類有以下繼承關系。 Person | --------------- | | Student Teacher 并且在Java源代碼中有如下表達式: Person p = new Student(); 如下哪個語句是正確的? A、 The expression is legal. B、The expression is illegal. C、Some errors will occur when compile. D、Compile is correct but it will be wrong when running. 答:A

      33、當Frame改變大小時,放在其中的按鈕大小不變,則使用如下哪個layout? A、FlowLayout B、CardLayout C、North and South of BorderLayout D、East and West of BorderLayout E、GridLayout答:D

      34、當Frame改變大小時,放在其中的按鈕大小不變,則使用如下哪個layout? A、FlowLayout B、CardLayout C、North and South of BorderLayout D、East and West of BorderLayout E、GridLayout答:A

      35、如下哪個方法可以從WindowEvent獲取事件源? A、getFrame() B、getID() C、getSource() D、getWindow() 答:C,D

      36、以下哪個有關事件探聽器的語句是正確的? A、 Multiple listeners can be attached to one component. B、Only one listener can be attached to one component. C、One listener can receive and process the events from multiple components. D、One listener can receive and process the events from only one component. 答:A,C

      37、探聽器接口的方法返回值是什么? A、int B、String C、void D、Object E、AWTEvent答:C

      38、下面哪個事件探聽器在Java中有事件適配器? A、MouseListener B、KeyListener C、ActionListener D、ItemListener E、WindowListener答:A,B,E

      39、下面哪個方法與applet的顯示無關? A、 update() B、draw() C、repaint() D、paint() 答:B

      40、已知如下說明:TextArea ta = new TextArea ("Hello", 5, 5); 請問哪個語句是正確的? A、 The maximum number of characters in a line is 5. B、The displayed height is 5 lines otherwise constrain. C、The displayed string can use multiple fonts. D、The displayed strings are editable. 答:B,D

      41、請問如下哪個方法可以將MenuBar加入Frame中? A、setMenu() B、setMenuBar() C、add() D、addMenuBar() 答:B

      42、下面哪個不是Java中的容器? A、ScrollPane B、Canvas C、Scrollbar D、Applet E、Dialog 答:B,C

      43、下面哪個方法可用于定義新線程類? A、 implement the Runnable interface B、add a run() method in the class C、create an instance of Thread D、extend the Thread class 答:A,D

      44、下面哪個stream是node流? A、FileInputStream B、BufferedInputStream C、PushbackInputStream D、ByteArrayInputStream答:A,D

      45、哪個類可用于處理Unicode? A、InputStreamReader B、BufferedReader C、Writer D、PipedInputStream答:A,B

      46、下面哪些語句能夠正確地生成5個空字符串? A String a[]=new String[5]; for(inti=0;i<5;a[++]=""); B String a[]={"","","","",""}; C String a[5]; D String[5]a; E String[]a=new String[5]; for( inti=0;i<5;a[i++]=null); 答:A,B

      47、下面哪些選項將是下述程序的輸出? public class Outer{ public static void main(String args[]){ Outer: for(inti=0; i<3; i++) inner:for(int j=0;j<3;j++){ j="">1) break; System.out.println(j+"and"+i); } } } A 0 and 0 B 0 and 1 C 0 and 2 D 0 and 3 E 2 and 2 F 2 and 1 G 2 and 0 答:A,B,C

      48、下面哪個語句正確地聲明一個整型的二維數組? A int a[][] = new int[][]; B int a[10][10] = new int[][]; C int a[][] = new int[10][10]; D int [][]a = new int[10][10]; E int []a[] = new int[10][10]; 答:C,D,E

      三、編程題

      1、編寫一個程序,用選擇法對數組a[]={20,10,50,40,30,70,60,80,90,100}進行從大到小的排序。

      編程題答案 public class ArraySort{ public static void main(String args[]){ int array[]={20,10,50,40,30,70,60,80,90,100}; inti,j,k,t; int l=array.length; for(i=0;i { k=i; for(j=i+1;j if(array[j] t=array[k];array[k]=array;array=t; } for(i=0;i System.out.println("array["+i+"]="+array); } }

    【七年級優秀作文:有你真好】相關文章:

    有你真好優秀作文(精選67篇)06-21

    有你真好優秀作文寫朋友12-10

    同學有你真好優秀作文(精選25篇)12-18

    媽媽有你真好優秀作文(精選28篇)05-10

    有你真好初三優秀作文08-03

    媽媽有你真好優秀作文(精選18篇)05-10

    有你真好初中優秀作文(精選34篇)11-27

    有你真好初中作文02-06

    有你真好妹妹作文05-15

    媽媽,有你,真好02-19

    • 相關推薦
    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人