上海继续教育JAVA 作业1.doc_第1页
上海继续教育JAVA 作业1.doc_第2页
上海继续教育JAVA 作业1.doc_第3页
上海继续教育JAVA 作业1.doc_第4页
上海继续教育JAVA 作业1.doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、下面的程序经运行后,其输出结果是( )public class Yuedu1 public static void main(String args) int x,y; x=y=0; do y+; x*=x; while (x0)&(y5); System.out.println(y=+y+ x=+x);选择一项:a. y=1 x=0 b. y=0 x=1 c. y=1 x=1 d. y=0 x=0 题目2、Java application中的主类需包含main方法,main方法的返回类型是什么?( )选择一项:a. void b. double c. int d. float 题目3、不正确下列语句序列执行后,r 的值是( )。 char ch=8; int r=10; switch( ch+1 ) case 7: r=r+3; case 8: r=r+5; case 9: r=r+6; break; default: r=r+8; 选择一项:a. 15 b. 18 c. 16 d. 13 题目4、不正确编译、运行下面代码将发生什么?( )public class Test5 public static void main (String args ) /* This is the start of a commentSystem.out.println(Done the test);/* This is another comment */System.out.println (The end);选择一项:a. 输出“The end”。 b. 输出“Done the test”。 c. 程序运行出错。 d. 输出“Done the test”和“The end”。 题目5、下面的程序经运行后,其输出结果是( )public class Yuedu1 public static void main(String args) int i; for(i=1;i6&810 题目9不正确若a和b均是整型变量并已正确赋值,正确的switch语句是( )。选择一项:a. witch( a+b*3.0 ) . b. switch(a+b); . c. switch ( a%b ) . d. switch a . 题目10、Java源程序必须以( )作为其扩展名选择一项:a. html b. exe c. java d. class 题目11、不正确下面代码段的运行结果( )boolean flag = false;if (flag = true) System.out.println(true);else System.out.println(false);选择一项:a. 没有信息输出 b. true c. 出错 d. false 题目12、不正确下列方法定义中,正确的是( )选择一项:a. void x( int a,int b ); return (a-b); b. x( int a,int b) return a-b; c. int x( int a,int b) return a+b; d. double x return b; 题目13、不正确String s1=new String(Hello);String s2=new String(Hello);System.out.print(s1=s2);System.out.print(, +s1.equals(s2);选择一项:a. false, true b. Hello, Hello c. Hello, false d. Hello, true 题目14、不正确下面代码段的运行结果是( )int i = 3;int j = 0;double k = 3.2;if (i 0) if(a3) c = 2; else c = 3; else c = 4;选择一项:a. 3 b. 4 c. 1 d. 2 题目18、 在JAVA编程中,以下( )命令用来执行java类文件。选择一项:a. 以上所有选项都不正确 b. java c. javac d. appletviewer 题目19、请问下面哪些代码行编译时会出错?( )选择一项:a. int i = 10; b. String s = 1; c. float f = 1.3; d. double D=4096.0; 题目20、下面关于数组定义语句不正确的是( )选择一项:a. int a2 ; b. float f =new 2.4f, 3.5f, 5.7f, 7.9f; c. double d =new double10; d. int a1 =1,2,3,4,5 题目21、如果int a=3,b=2,则执行a*=b+8后a的值为:( )选择一项:a. 30 b. 14 c. 20 d. 16 题目22、MyProgram.Java被编译后,生成( )。选择一项:a. MyProgram.exe b. MyProgram. bat c. MyProgram. Obj d. MyProgram. class 题目23、不正确下面的java源文件代码片段是不正确的定义次序的是( )选择一项:a. package testpackage;public class Test /do something b. import java.io.*;class Person /do somethingpublic class Test /do something c. import java.io.*;package testpackage;public class Test /do something d. import java.io.*;import java.awt.*;public class Test /do something 题目24、不正确下面的程序经运行后,其输出结果是( )public class Yuedu4 public static void main(String args) System.out.print(fun(4); static int fun(int n) int t; if(n=0)|(n=1) t=3; else t=n*fun(n-1); return t; 选择一项:a. 24 b. 72 c. 36 d. 48 题目25、如果定义有double x;float y;int m,则表达式x*y-m的类型为( ):选择一项:a. double b. float c. short d. int 题目26、不正确在一个应用程序中定义了数组a: int a=1,2,3,4,5,6,7,8,9,10, 为了打印输出数组a的最后一个元素,下面正确的代码是( )选择一项:a. System.out.println(a9); b. System.out.println(a10); c. System.out.println(aa.length); d. System.out.println(a8); 题目27、不正确下面的说法错误的是( )选择一项:a. Java语言可以实现对内存垃圾自动收集 b. Java语言具有可移植性,是与平台无关的编程语言 c. Java语言编写的程序可以无须其运行环境便可“一次编译,到处运行” d. Java语言是面向对象的、解释执行的网络编程语言 题目28、不正确下列语句序列执行后,k 的值是( )。 int i=4,j=5,k=9,m=5; if(ij|mk) k+; else k-;选择一项:a. 9 b. 8 c. 10 d. 5 题目29、不正确下面的程序经运行后,其输出结果是( )public class Yuedu3 public static void main(String args) int x,y; System.out.print(x1=+add(4,6); System.out.print(x2=+add(3,add(1,2); static int

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论