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

 找回密码
 会员注册

微信登录,扫一扫

手机号码,快捷登录

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

[西南大学] 西南大学2019年3月课程名称 面向对象程序设计【0837】大作业

[复制链接]
发表于 2019-3-11 11:12:02 | 显示全部楼层 |阅读模式
谋学网

西南大学网络与继续教育学院课程考试试

类别:  网   教       专业:计算机科学与技术      2019年3月
课程名称【编号】:面向对象程序设计【0837】                A卷
大作业                                 满分:100 分
________________________________________
资料必须做在答题卷上,做在试卷上不予记分。

一、单项选择题(共10小题,3分/题,共30分)
1.        以下关于Java语言的叙述错误的是:(      )
A.        Java 是最纯粹的面向对象语言,对面向对象方法学的支持也最全面
B.        Java是解释执行的语言,由Java解释器负责将Java源文件解释为机器码执行
C.        Java是平台无关的,即Java程序不用修改就可以在不同类型的计算机平台上运行
D.        Java提供了大量功能丰富的可重用类库,有效减少了编程的工作量
2.        下列字符序列中不能作为Java语言标识符的是:(      )
A.        abc_123
B.        圆周率PI
C.        false
D.        _123abc
3.        下列不属于Java语言关键字的是:(      )
A.        repeat
B.        try
C.        break
D.        new
4.        设有定义 int i=80, j=7; double d=80.7;下列语句中正确的赋值语句是:(      )
A.        i = d;
B.        i  = (int)d + j;
C.        j = (int)i - d;
D.        i + j = (int)d;
5.        下列关于构造方法的说法中,不正确的是:(      )
A.        构造方法用于创建类的实例  
B.        构造方法不可以重载
C.        构造方法不具有返回值类型
D.        构造方法名必须和类名相同
6.        执行下列语句后,变量x的值是:(      )
    int x=7, y=10;
   switch( x/y ) {
case 0: x++;
case 7: x*=y;
case 14:x+=y; break;
default: x%=y;
        }
A.        8
B.        70
C.        80
D.        90
7.        下列语句序列给出了k,myArr和myMethod()的声明。当调用方法myMethod(myArr,k)之后,存储在k和myArr里的值分别是:(      )
int k = 7;
String myArr[] = {“love”,“peace”,”and”};
void myMethod(String a[], int m) {
     String temp = a[1];
     a[1] = a[2];
     a[2] = temp;
     m = a[2].length();
}
A.        {“peace”,“love”,”and”},4
B.        {“peace”,“love”,”and”},7
C.        {“love”,“and”,”peace”},5
D.        {“love”,“and”,”peace”},7
8.        下列语句序列执行之后,b1,b2,b3,b4的值分别是:(      )
String s1 = “peace”;
String s2 = new String(s1);
String s3 = s2;
String s4 = new String(“PEACE”);

boolean b1 = (s1 == s2);
boolean b2 = s1.equals(s2);
boolean b3 = (s3 == s2);
boolean b4 = s4.equals(s3);

A.        true,true,false,false
B.        false,true,true,true
C.        false,true,true,false
D.        false,true,false,false
9.        Swing的三个顶层容器分别是:(      )
A.        JApplet,JPanel,JWindow
B.        JDialog,JApplet,JFrame
C.        JApplet,JFrame, JMenu
D.        JFrame,JPanel,JTextArea
10.        下列关于Java小应用程序(Applet)的说法中,正确的是:(      )
A.        java.applet.Applet类是所有Java小应用程序的基类  
B.        Java小应用程序不需要编译
C.        Java小应用程序也需要main()方法
D.        Java小应用程序必须实现ActionListener接口


二、程序分析题(共4小题,每小题各10分,共40分)
1.        阅读下面的程序,写出程序运行的输出结果。
public class Test1 {
        public int method(int n){
                int result = 1;
                for(int i=1; i<=n; i++){
                        result *= n;
                }
                return result;
        }
    public  static  void   main( String  args[ ] ){
            Test1 test = new Test1( );
        int   sum = 0 ;
        for  ( int  i = 1 ;  i <= 3 ;  i++ )
             sum += test.method( i ) ;
        System.out.println( "sum = " + sum );
}
}
      
2.        阅读下面的程序,写出程序运行的输出结果。
public class Test2 {
        public String method( String s ) {
           StringBuffer result = new StringBuffer( );
           for (int k = s.length( )-1; k >= 0; k--) {
               result.append( s.charAt(k) );
           }
           return result.toString( );
       }
        public static void main( String  args[ ] ) {
                Test2 test = new Test2( );
String str = "peace";   
           System.out.println( test.method(str) );
        }
}

3.        阅读下面程序,并回答问题。
class SuperTest {
public int age ;
public SuperTest( String s ) {  
        System.out.println("Hi, I am " + s);
       age = 35;
  }
}

public class Test3 extends SuperTest{
public int age;
public Test3 ( String s ) {
            super( s );
            System.out.println("Nice to meet you!");
        age = 7;
}

        public void print() {
        System.out.println( "Age is " + age );
        System.out.println( "My age is " + this.age );
        System.out.println( "My parent's age is " + super.age );       
        }

public static void main( String args[ ] ){
            Test3 test = new Test3(“Olive”);
test.print();
}
}
问题(1):类Test3和类SuperTest之间是什么关系?
问题(2):关键字super和this分别是什么含义?
问题(3):这段程序的输出是什么?

4.        阅读下面程序,并回答问题。
import  java.io.* ;

public class Test4{
        public static void main( String args[ ]){   
                 try {
                     DataOutputStream  dout = new DataOutputStream(
new  FileOutputStream(“out.txt”));
                          for(int i=0; i<10; i++)
                    dout.writeInt( ‘0’ + i);
                dout.close( );

                DataInputStream  din = new DataInputStream(
new  FileInputStream(“out.txt”));
                          for(int i=0; i<10; i++)
                    System.out.print( din.readInt( )-‘0’ + ”, ” );
                din.close( );
                        } catch ( IOException  e ){
                                System.err.println( “发生异常:”  +  e );
                  e.printStackTrace( );
                        }
    }
}

问题(1):try块中包含的哪些语句或表达式可能抛出异常?
问题(2):流DataOutputStream和DataInputStream常被用于何种操作?
问题(3):假定文件out.txt中原本没有任何数据,这段程序执行完成后,文件out.txt的内容是什么?程序在控制台窗口输出什么?


三、程序设计题(共1小题,共30分)
编写一个程序,要求随机生成61个学生的成绩(从0到100的整数),在将成绩排序(由高到低)后保存到文件“score.txt”中。

























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

本版积分规则

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

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

GMT+8, 2024-5-13 01:41 , Processed in 0.094193 second(s), 19 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

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