奥鹏作业答案-谋学网-专业的奥鹏在线作业答案辅导网【官网】

 找回密码
 会员注册

微信登录,扫一扫

手机号码,快捷登录

VIP会员,3年作业免费下 !奥鹏作业,奥鹏毕业论文检测新手作业下载教程,充值问题没有找到答案,请在此处留言!
2022年5月最新全国统考资料投诉建议,加盟合作!点击这里给我发消息 点击这里给我发消息
奥鹏课程积分软件(2021年最新)
查看: 955|回复: 0

东北大学14秋学期《JAVA语言程序设计Ⅰ》在线作业2资料辅导资料

[复制链接]
发表于 2014-12-17 20:19:55 | 显示全部楼层 |阅读模式
谋学网
谋学网(www.mouxue.com)是国内最专业的奥鹏作业资料,奥鹏离线作业资料及奥鹏毕业论文辅导型网站,主要提供奥鹏中医大、大工、东财、北语、北航、川大、南开等奥鹏作业资料辅导,致力打造中国最专业的远程教育辅导社区。
4 ~- |* [' w  _" @& X
0 z& f9 ]/ t4 K' V, b2 Y
! T: }" B; v$ \( \4 o( g. b一、单选(共 20 道试题,共 60 分。)V 1.  下面程序的输出结果是什么? class Happy { public static void main(String args[]) { int i =1; int j = 10; do { if ( i++ < j--) continue; } while ( i <5 ); System.out.println ( i+" "+j ); } }- k# W0 \- @" H* x( @. |# ?7 ?
A. 5 5
' k* s' f: D% {0 rB. 5 4' Q% Z( s; v; \+ A
C. 6 4
: E; w2 x7 Y* @2 `D. 5 6
; ?8 T* x5 U; `9 ~* t9 O/ f3 {* G      满分:3  分9 P( V; \. G- ], w, B
2.  有下面的类:  public class Example{   public static void main(String args[]){   static int x[] = new int[15];   System.out.println(x[5]);   }   } 下面的那些说法是正确的。  O) d  y' j" y
A. 编译时出错% u  _( L# X% K2 J
B. 运行时出错
8 q8 {5 z( I  j0 OC. 输出0
, d+ h5 B4 D5 _1 \/ k/ v: UD. 输出null
) H( n' {* `# L0 s      满分:3  分
, ?0 m4 c: \# Q1 E1 ?( J5 A- a3.  以下代码的输出结果是什么? class Foo{ public static void main(String args[]){ int x=4,j=0; switch(x){ case 1:j++; case 2:j++; case 3:j++; case 4:j++; case 5:j++; break; default:j++; } System.out.println(j); } }
9 \  e' |" D2 E) ^/ x1 {  MA. 1
( u7 ]! }, Y5 [( v  Z. K! dB. 24 `2 o% c( e# K' }4 a2 D) ~
C. 38 |$ D: Y& f" s* S" Y! q$ H0 _
D. 编译错误
, V) g1 @0 C; _/ U: u$ a6 j. b2 i      满分:3  分
/ Y- ^' T/ |# J. ?' J4.  如果你有下面的类定义 abstract class Shape{ abstract void draw(); } 请问,在试图编译下面的类定义时会发生什么情况? class Square extends Shape{ }
( J/ S* m% m2 h* F$ [+ m4 k2 j# iA. 都可以成功编译" L/ _0 t/ `" r2 O" y
B. Shpe可以编译,而Square不能
3 Z1 [- x! H) M" Z6 k& `2 AC. Square可以编译,而Shape不能7 Y! m( o& u* y# j2 R6 d' k5 g
D. Shape和Square都不能编译  Q1 ?; D) g& r  [: ]" D1 u
      满分:3  分
/ n8 `, V4 H2 v; e+ g5.  给定下面的类:  public class Example{   String str=new String(“good”);   char ch[]={'a','b','c'};   public static void main(String args[]){   Example ex=new Example();   ex.change(ex.str,ex.ch);   System.out.println(ex.str+”and”+ex.ch);   }   public void
6 m! o; n/ `. L6 j3 G- b9 [A. good and abc
. ^$ p: f5 i& L& l9 i+ y& K" ^9 VB. good and gbc. _3 F5 \& K. h0 T0 H! h( \# {6 t/ t
C. test ok and abc9 Y/ {0 u0 r2 p) M/ o
D. test ok and gbc7 R! I3 t2 i% j2 E8 T$ u
      满分:3  分
; H# h* {" g$ p  L, z: l6.  若a的值为3时,下列程序段被执行后,c的值是多少?( ) c = 1; if ( a>0 ) if ( a>3 ) c = 2; else c = 3; else c = 4;
8 q( B1 F' m0 a2 V, K8 MA. 1
7 ^2 s2 {# w' G' W, J/ ~% dB. 2: A" E% o, z. S( [  x
C. 3, H5 z! o& P3 B/ O1 G5 t  c4 ~
D. 4; c% v" I+ ?, x! ?, {
      满分:3  分0 A7 ]% w# }; |- X# J; Z
7.  阅读下列代码后 public class Person{ int arr[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是3 o2 d) l1 u1 V& u, Z: q
A. 编译时将产生错误
3 Z; [/ s' h3 w8 [B. 编译时正确,运行时将产生错误  d% s$ i- `) n, h  S* O
C. 输出零
/ q) t- i8 l* H9 `* X9 {' n" J% kD. 输出空
  H! [1 G# ]9 q% G' a      满分:3  分
0 A6 m) R. k3 `5 m/ o$ w* a8.  下面的哪些程序段可以正确地获得从命令行传递的参数的个数?
! R/ L4 v" j/ B# r( d  ?A. int count = args.length;
' d1 P- s3 o9 l) M: fB. int count = args.length-1;8 {% r. t+ u& ?: O) \
C. int count=0; while(args[count]!=null) count++;4 G, b9 V& y( \8 X! W
D. int count=0;while (!(args[count].equals(“”))) count++;
3 y8 |9 ^% m! \) {      满分:3  分
* d% a% x7 e8 [1 Q4 u( {% _  {9.  下面程序的输出结果是什么? class Foo{ static void change(String s){ s=s.replace('j','l'); } public static void main(String args[]){ String s="java"; change(s); System.out.println(s); } }, m. `) l2 i% r5 K; p3 m
A. lava
$ k/ X/ v! {6 }! U+ Q7 hB. java
' R6 S7 t" E( @7 UC. 编译错误! h  z- n; y. x. _0 v2 X
D. 运行时出现异常
& i5 r8 B, [  B/ U0 Z! n      满分:3  分5 h7 h$ I3 `9 W4 r" F) j
10.  下列程序段执行后t5的结果是( )。int t1 = 9, t2 = 11, t3=8;int t4,t5;t4 = t1 > t2 ? t1 : t2+ t1;t5 = t4 > t3 ? t4 : t3;) o+ H7 D9 a7 \. A" T( h
A. 8
, h: V' q, h; h3 t! m; {9 TB. 20: m5 s) @! Z0 ~5 s& l6 b) x0 l
C. 114 m, ?6 S, x" x# t$ w8 a
D. 9' ^$ l; I0 E; m
      满分:3  分/ i! _4 |3 T. R( \9 m
11.  给出下列代码,则数组初始化中哪项是不正确的? byte[] array1,array2[]; byte array3[][]; byte [][] array4;
+ k, g  I: [6 P$ Z; ]A. array2 = array1- B  F- }8 |* o: E' I! v8 q
B. array2=array3
1 x7 A$ @: A2 }4 G; }3 LC. array2=array4
: g5 H/ l8 }  N( D  qD. array3=array4; Z& O' _& r& p7 t4 a; u
      满分:3  分
* @0 Q+ r* m0 R12.  下面哪一个类可以访问foo包中的所有变量? package foo; class a{int c} class b{private int d} class c{public int e}
3 K" c: c9 v6 C9 GA. class a
* \0 i4 k; A- ~9 v0 p4 w( tB. class b" V* C' m  G; Y: Z% K( c* a
C. class c
4 ~) Q5 ?  S0 TD. 都不能
8 \- I# O9 _; Z      满分:3  分# o1 P" ?& R. n" V
13.  下面的语句的作用是:( )。 Vector MyVector = new Vector(100,50);
% w+ R6 w7 b4 @; {4 U! V" m* o4 k- KA. 创建一个数组类对象MyVector,有100个元素的空间,每个元素的初值为50。
5 x& `3 `" b  w' v& N- N0 h9 u+ ~  PB. 创建一个向量类对象MyVector,有100个元素的空间,每个元素的初值为50。
7 l# q) G- x+ T/ A! {C. 创建一个数组类对象MyVector,有100个元素的空间,若空间使用完时,以50个元素空间单位递增。7 s$ M+ r) D5 s* i* R! [
D. 创建一个向量类对象MyVector,有100个元素的空间,若空间使用完时,以50个元素空间单位递增。( A9 o( `4 Z- e  Z% T
      满分:3  分" O% v5 V& C5 d, _! j
14.  下列语句序列执行后,a的值是( )。 int a=13; a%=a/5;2 y2 r% }- Q* v+ I- O
A. 3
/ M! Y0 H# H) j4 @, w) g5 ZB. 13
  Q- G9 {4 |2 ^9 ]% TC. 13 I& N8 |3 ?0 _
D. 1693 M  G! n( {' S- t7 ~6 L+ o
      满分:3  分$ \3 x; D" f: A/ S& V
15.  下列语句序列执行后,k的值是( )。 int j=8, k=15; for( int i=2; i!=j; i++ ) { j-=2; k++; }) ~* ]! I2 }& I' u/ d! h: e7 D
A. 15
! ^$ v1 `9 R, t! b: [& ~B. 166 d; y( W' L& d' X% [9 E1 x
C. 17
& {% {7 @) B/ _: s: }: x0 t3 ?- c( ID. 18! {0 S  K2 [4 C. v. B) z
      满分:3  分$ m% [. U* h2 a) v3 S: s
16.  下列程序的功能是在监控台上每隔一秒钟显示一个字符串“Hello”,能够填写在程序中下划线位置,使程序完整并能正确运行的语句是 public class Test implements Runnable{ public static void main(String args[]){ Test t=new Test(); Thread tt=new Thread(t); tt.start(); } public void run(){ for(;;){ try{
2 C# o2 j7 a& k5 X' j- HA. sleep(1000) InterruptedException
! t9 T( Y1 |) V9 Q1 q9 \1 a, @& v( HB. sleep(1000) RuntimeException+ y# e" I3 o9 _9 b: `0 y; \
C. Thread.sleep(1000) RuntimeException6 i4 D+ T6 N* \& Y1 D* z' x
D. Thread.sleep(1000) InterruptedException; H. @: L) C, u' _% g0 I
      满分:3  分
# Z% _2 @) \* t: i( s17.  设有下面两个赋值语句: a = Integer.parseInt("1024"); b = Integer.valueOf("1024").intValue(); 下述说法正确的是( )。
5 Q) R, Z% x6 e$ P; YA. a是整数类型变量,b是整数类对象。) P& G" W& ?2 s2 R+ G! R0 \! ?
B. a是整数类对象,b是整数类型变量。# [% m/ ?9 ]- f$ ^" u
C. a和b都是整数类对象并且它们的值相等。
( W. Z4 i  h( B8 ~" \D. a和b都是整数类型变量并且它们的值相等。1 z! n- \, {. {5 l6 w' v6 C
      满分:3  分* k2 I& q$ S! J: P- Q* }/ `2 e
18.  Person, Student 和Teacher 都是类名。这些类有以下继承关系。 Person | -------------------- | | Student Teacher 并且在Java源代码中有如下表达式: Person p = new Student(); 如下哪个语句是正确的?
$ z& f/ B( B4 l. d+ Y) @$ E  PA. 这条语句是合法的
% t7 \3 A/ V; @5 m* v; kB. 这条语句是不合法的
2 l0 j( @5 q) ]& S# j4 k( zC. 编译时出错
5 C' C/ K. @  M2 cD. 编译正确但运行时出错
) H; k: ?7 j& v4 D7 B5 x# a      满分:3  分4 n) J: P1 j1 r# \) Z' Q& F
19.  已知表达式int m[] = {0, 1, 2, 3, 4, 5, 6 }; 下面哪个表达式的值与数组下标量总数相等?+ _3 L7 o, c, J1 a: P+ U
A. m.length()
. r6 }' M7 p) m. m5 N3 L% ^B. m.length7 B( i* A- n  p8 C6 U7 V
C. m.length()+1; e; {% i5 i& U# J- ?
D. m.length+1! P" v4 g6 F& [' B
      满分:3  分
  X: ]) x: l+ {) `0 H5 _7 j5 _20.  在oneMethod()方法运行正常的情况下,程序段将输出什么? public void test() { try { oneMethod(); System.out.println("condition 1"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("condition 2"); } catch(Exception e) { System.out.println("condition 3");
9 H# J% L0 C' S$ h8 S2 ^( RA. condition 18 }& Y8 u& Y6 u- R0 U
B. condition 2
9 u5 E8 Z. P/ w' e" eC. condition 3# }/ [( D7 ~" ?0 i1 ]7 R
D. condition 1 finally
" A5 x, V' G4 S9 v      满分:3  分 ' X! a4 l/ |" }& w/ a

( m. F* V$ Z. X二、多选题(共 10 道试题,共 40 分。)V 1.  已知如下定义: String s = "story"; 下面哪些表达式是合法的?; O6 p+ D: J7 W2 Q2 C
A. s += "books";' s' P' x% h% a! B' N: j' V
B. char c = s[1];  d* T& a/ `  z0 a  r
C. int len = s.length;
' e5 S5 G7 I' q6 J) d$ fD. String t = s.toLowerCase();' u; z' k# {3 f; r1 P6 e+ p+ S/ w, r
      满分:4  分; \# a) Y) Z# i; v; |
2.  String s=”Example String”; 下面哪些语句是正确的?+ R# Q9 H, |# c% o
A. s>>>=3;1 F: p6 [# m( v9 Y, B2 f  Y* t
B. int i=s.length();
5 J4 t7 z" M+ R7 ^& y# Q- H$ qC. s[3]=”x”;
$ g( o+ D! N) k' x2 H: _4 H; XD. String short_s=s.trim();: {5 g9 \. {1 \
E. String t=”root”+s;: ?. K9 t# }/ ~. A1 Z3 [% {
      满分:4  分
( G& H' j; B+ @2 F* s3.  下面代码执行后的输出是什么? outer: for(int i=0;i<3; i++) inner: for(int j=0;j<2;j++) { if(j==1) continue outer; System.out.println(j+ “ and “+i); }% e" H8 L  j8 K
A. 0 and 0
0 ^( ]" \  a! k: B# yB. 0 and 1
+ L) s2 G! r# wC. 0 and 25 n/ u7 H7 E2 G9 a  k, d
D. 1 and 06 I) I% z& H. I
E. 1 and 14 {' N9 T- G3 h1 u! C; I
F. 1 and 2& `) m1 p# P& R6 M% }& a
G. 2 and 07 n. S, K/ K' s$ O
H. 2 and 1
( |  J3 S6 U$ i" l# Q- WI. 2 and 28 k% O5 _( ]: x$ I
      满分:4  分  B, e: D7 ?! R: r3 b  J
4.  已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?
/ t! J& _2 L5 _A. t.f4 R7 X1 Q7 ?2 m7 P% Y) @
B. this.n
$ z6 h0 [( h' \' X7 l- E4 |- ~; ~9 VC. Test.m8 e  H+ x$ D" y9 N
D. Test.n2 Y) J0 N7 X. M0 `  f+ z) b
      满分:4  分; Z$ o6 g$ R% m4 R; K& G( K, }$ f
5.  针对下面的程序,那些表达式的值是true?  Class Aclass{   private long val;   public Aclass(long v){val=v;}   public static void main(String args[]){   Aclass x=new Aclass(10L);   Aclass y=new Aclass(10L);   Aclass z=y;   long a=10L;   int b=10;   }   }
% P" {2 C' V  l" {' z' V. kA. a==b;2 f- L  t6 d: W1 c+ G/ C
B. a==x;
5 D& g! y0 ~7 b; R) \1 OC. y==z;2 J+ C& \$ \% z( L" w% [7 U( ~
D. x==y;
% W& }% T( ^5 n% ^/ [- N' N) iE. a==10.0;
( t6 A+ g9 g3 g: G& i      满分:4  分
9 B. [5 _* U2 z$ C9 o6.  在如下源代码文件Test.java中, 哪个是正确的类定义?
3 P7 J7 ?& s: i' q( [A. public class test { public int x = 0; public test(int x) { this.x = x; } }) ]2 N0 x0 A/ C, Q4 T
B. public class Test{ public int x=0; public Test(int x) { this.x = x; } }
7 M7 F1 X% [9 n6 FC. public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
* a9 ?5 G; g' C, N3 @( J+ |4 ID. public class
6 W( c$ J1 ~+ Y( M9 p1 H& o      满分:4  分; z6 l" T( K% M
7.  假定文件名是“Fred.java”,下面哪个是正确的类声明。
& P# e0 M% i: \; c+ m3 Z, e9 W+ ^5 uA. public class Fred{   public int x = 0;   public Fred (int x){   this.x=x;   }   }; L0 I& s7 ~( ?+ U7 _
B. public class fred{   public int x = 0;   public Fred (int x){   this.x=x;   }   }: w7 d6 E+ b8 r4 Z) o% ~
C. public class Fred extends MyBaseClass{   public int x = 0; }
# y" y4 D2 `; v6 P      满分:4  分6 q/ E/ v+ m% r, i7 P
8.  已知如下类定义: class Base { public Base (){ //... } public Base ( int m ){ //... } protected void fun( int n ){ //... } } public class Child extends Base{ // member methods } 如下哪句可以正确地加入子类中?- M3 J% d# W( ~7 A' e. d' i: r: J7 }
A. private void fun( int n ){ //...}& `" ^0 _' p. v/ t3 |0 K1 d
B. void fun ( int n ){ //... }
0 D" w2 i2 O- s& c+ LC. protected void fun ( int n ) { //... }
$ j" a, x2 g6 U  J* {4 fD. public void fun ( int n ) { //... }1 H- h1 J' c* [% M0 x! W+ R" ?: f
      满分:4  分8 n) @  c5 `0 I$ i" D7 z% }
9.  已知如下代码: public class Test { public static void main(String arg[]) { int i = 5; do { System.out.println(i); } while (--i>5) System.out.println("finished"); } } 执行后的输出结果包括什么?% g2 ^$ C0 G; Y* ?3 n8 d( h
A. 5
% b; W/ j* ?8 o! N; d: ]B. 4  W' i3 N, Z7 Z6 A3 N' J  x0 N
C. 6: w$ U6 K4 U; m; v4 T
D. finished; r- R% N% D3 @2 W7 d- s
E. 什么都不输出
9 f3 e; G2 W0 z- I, \      满分:4  分
* W" t" y+ v! ^, U; _7 O10.  选择所有有效的构造函数。 class Happy { } }
2 m/ Y7 P  M! c& f2 KA. public void Happy(){}7 Y1 n. P- {+ O1 q
B. public Happy(int c){}0 M. J; F# M+ Y4 W
C. protected Happy(){}
% @7 E! M. v+ E8 s4 I, ND. public int Happy(){}
0 C* w9 w4 }9 t" y' S  [7 o& T0 kE. void Happy(){}5 ~% k& v( M! i, ^5 D0 d
      满分:4  分 : v& Q5 h: F( D# T9 z. |
( b& P4 b( ]0 S, n' p4 h7 I
谋学网(www.mouxue.com)是国内最专业的奥鹏作业资料,奥鹏离线作业资料及奥鹏毕业论文辅导型网站,主要提供奥鹏中医大、大工、东财、北语、北航、川大、南开等奥鹏作业资料辅导,致力打造中国最专业的远程教育辅导社区。
% ?7 o# y0 k9 k) Q  M

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?会员注册

×
奥鹏作业答案,奥鹏在线作业答案
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

 
 
客服一
客服二
客服三
客服四
点这里给我发消息
点这里给我发消息
谋学网奥鹏同学群2
微信客服扫一扫

QQ|关于我们|联系方式|网站特点|加入VIP|加盟合作|投诉建议|法律申明|Archiver|小黑屋|奥鹏作业答案-谋学网 ( 湘ICP备2021015247号 )

GMT+8, 2024-4-27 02:33 , Processed in 0.127212 second(s), 24 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表