找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2466|回复: 1

《JAVA语言基础(本科)》19年12月作业考核A-JAVA语言基础(本科)

[复制链接]
发表于 2019-12-8 09:01:15 | 显示全部楼层 |阅读模式
四川农业大学网络教育专升本考试
JAVA语言基础  试卷(课程代码  252243)本试题一共四道大题,共6页,满分100分。考试时间90分钟。注意:1、答案必须填写在答题纸上,题号不清或无题号的以零分计;
2、答题前,请在答题纸上准确、清楚地填写各项目;
3、学号、考点名称、考室号、姓名、身份证号、课程代码、课程名称、培养层次等,不写、乱写及模糊不清者,答题纸作废;
4、开卷考试,若有雷同以零分计。一、简答题(每小题5分,共25分)
1、sleep() 和 wait() 有什么区别?
2、Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?
3、同步和异步有何异同,在什么情况下分别使用他们?举例说明。
4、Static Nested Class 和 Inner Class的不同。
5、启动一个线程是用run()还是start()?二、程序阅读题(每小题5分,共25分)
1、阅读下列代码段:
  Int x=10,y=12,r;
  If (y>x)
  {
  int t=y;
  Y=x;
  X=t;
  }
  While (y!=0)
  {
  R=x%y;
  X=y;
  Y=r;
  }
  System.out.println(x);
  程序运行结果为----------
2、阅读下面程序:
  Pulbic class Test extends TT
  {
  Public static void main ( String args[] )
  {
  Test t = new Test ( “ Tom” )
  }
  Public Tests ( String s )
  {
  super(s);
  System.out.println(“How do you do ?”);
  }
  Public Test()
  {
  this ( “ I am Jack” );
  }
  }
  class TT
  {
  public TT()
  {
  System.out.println(“What a pleasure!”);
  }
  public TT( Stirng s )
  {
  this();
  System.out.println(“I am”+s);
  }
  }
  给出程序结果
3、下列程序的功能是创建线程打印5行“HOW DO YOU DO!”,请阅读程序:
  Public class ThreadTest
  {
  Public static void main(String args[])
  {
  Xyz xyz = new Xyz ();
  ( );
  t.start();
  }
  }
  Class Xyz implements Runnable
  {
  Int i;
  Public void run()
  {
  While(i<5)
  {
  System.out.println(“How do you do!”+i++);
  }
  }
  }
  下列选择中能够填在下划线上使用程序正确运行的语句是什么?
                              
4、阅读下列代码:
  Public class Test5{
  Public static void main ( String args[] ) {
  String s1=new String (“hello”);
  String s2=new Stirng (“hello”);
  System.out.println(s1= =s2);
  System.out.pirntln(s1.equals (s2 ) );
  }
  }
  程序运行结果为                    
5、Public class Test4{
  Public static void mian ( String args[] ) {
  Int a=4,b=6,c=8;
  String s=”abc”;
  System.out.println( a+b+s+c );
  System.out.println();
  }
  }
  其运行结果是什么?三、程序修改题(每小题5分,共30分)
判断下面的程序片断是否正确。若有错,指出错在哪里并改正。
1、abstract class Name {
   private String name;
   public abstract boolean isStupidName(String name) {}
}
程序有错吗?错在哪里?
2、public class Something {
   void doSomething () {
       private String s = "";
       int l = s.length();
   }
}
程序有错吗?错在哪里?
3、abstract class Something {
   private abstract String doSomething ();
}
程序有错吗?错在哪里?
4、class IamAbstract
       {      final int f;
              double d;
              abstract void method();
       }
程序有错吗?错在哪里?
5、public class MyMain
       {     public static void main(String args[ ])
              { System.out.println(MyClass1.data);}
       }
       class MyClass1
       {  int data=10;
       }
程序有错吗?错在哪里?
6、public class MyClass
   {          int data;
              void MyClass(int d)
              {     data=d;}
       }
程序有错吗?错在哪里?四、程序编写题(每小题10分,共20分
1. 请编写一个完整的java程序,将source.txt中的“这是在源文件中的数据”读出来显示在屏幕上,并且写入到destination.txt文件中。
2. 请编写一个完整的JAVA程序,依次打印出命令行参数字符串数组各元素。(字符串数组)
转载注明 www.ap5u.com  q76 129 60 21
发表于 2020-5-24 20:25:19 | 显示全部楼层

QQ|手机版|小黑屋|网站地图|无忧答案网 ( 冀ICP备18010495号-1 )

GMT+8, 2024-5-3 15:33

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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