面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案

尉逼夹层售攘刮奢弄临淡块窖

第一章 单元测试

1、 Which edition of Java is geared toward developing large-scale, distributed networking applications and web-based applications? ( )

A:Standard Edition.
B:Industrial Edition.
C:Enterprise Edition.
D:Micro Edition.
答案: Enterprise Edition.

2、 Java was originally developed for: ( )

A:Operating systems development.
B:Intelligent consumer devices.
C:Personal computers.
D:Distributed computing.
答案: Intelligent consumer devices.

3、 Which of the following statements about Java Class Libraries is false: ( )

A:Java class libraries consist of classes that consist of methods that perform tasks.
B:Java class libraries are also known as Java APIs (Application Programming Interfaces).
C:An advantage of using Java class libraries is saving the effort of designing, developing and testing new classes.
D:Java class libraries are not portable
答案: Java class libraries are not portable

4、 The .class extension on a file means that the file: ( )

A:Contains java source code
B:Contains HTML
C:is produced by the Java compiler (javac).
D:None of the above.
答案: is produced by the Java compiler (javac).

5、 The command __ executes a Java application. ( )

A:run
B:javac
C:java
D:None of the above
答案: java

第二章 单元测试

1、 End-of-line comments that should be ignored by the compiler are denoted using ( )

A:Two forward slashes ( // ).
B:Three forward slashes ( /// ).
C:A slash and a star ( / ).
D:A slash and two stars ( /
* ).
答案: Two forward slashes ( // ).

2、 Which of the following is not a valid Java identifier? ( )

A:my Value
B:$_AAA1
C:width
D:m_x
答案: my Value

3、 Which of the following cannot cause a syntax error to be reported by the Java compiler? ( )

A:Mismatched {}
B:Missing / in a comment that begins with /
C:Missing ;
D:An extra blank line.
答案: An extra blank line.

4、 Which of the following does not contain a syntax error? ( )

A:System.out.println( ‘Hello world!’ ):
B:System.out.println( “Hello 回车换行world!” );
C:System.out.println( “Hello world!” );
D:System.out.println( Hello world! );
答案: System.out.println( “Hello world!” );

5、 Which command compiles the Java source code file Welcome.java? ( )

A:cd Welcome.java
B:javac Welcome.java
C:java Welcome.java
D:compile Welcome.java
答案: javac Welcome.java

6、 Which command executes the Java class file Welcome.class? ( )

A:java welcome
B:java Welcome.class
C:java Welcome
D:run Welcome.class
答案: java Welcome

7、 Which is the output of the following statements?
面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第1张 ( )

A:Hello World
B:HelloWorld
C:HelloWorld
D:World Hello
答案: Hello World

8、 Which statement prints the floating-point value 123.456 right justified with a field width of 10? ( )

A:System.out.printf(“%d10.3”, 123.456);
B:System.out.printf(“%10.3d”, 123.456);
C:System.out.printf(“%f10.3”, 123.456);
D:System.out.printf(“%10.3f”, 123.456);
答案: System.out.printf(“%10.3f”, 123.456);

9、 What is the size in bits of an int? ( )

A:8
B:16
C:32
D:64
答案: 32

10、 Which of the following is the escape character? ( )

A:*
B:\
C:\n
D:”
答案: \

第三章 单元测试

1、 Which of the following can be used in a switch statement in the expression after keyword case?a.a constant integral expression.b.a character constant.c.a Stringd.an enumeration constant. ( )

A:a and b.
B:a and c
C:b and c
D:All.
答案: All.

2、 Optional parentheses in expressions are said to be ( )

A:redundant.
B:binary operators.
C:implied.
D:declared.
答案: redundant.

3、 Which of the following statements does not alter the value stored in a memory location? ( )

A:int a;
B:number = 12;
C:y = y + 2;
D:width = Integer.parseInt(input);
答案: int a;

4、 What is the value of result after the following Java statements execute (assume all variables are of type int)?
面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第2张 ( )

A:119
B:51
C:127
D:59
答案: 119

5、 Which of the following is not an arithmetic operator? ( )

A:+
B:-
C:.
D:%
答案: .

6、 Which of the following is not a compilation error? ( )

A:Neglecting to initialize a local variable in a method before it is used.
B:Placing a semicolon at the end of the first line of an if statement.
C:Omitting the left and right parenthesis for the condition of an if statement.
D:All are compilation errors.
答案: Placing a semicolon at the end of the first line of an if statement.

7、 Each of the following is a relational or equality operator except: ( )

A:<=
B:=!
C:==
D:>
答案: =!

8、 Which of the following is not a control structure: ( )

A:Sequence structure.
B:Selection structure.
C:Repetition structure.
D:Declaration structure.
答案: Declaration structure.

9、 Which statement is false? ( )

A:Unless directed otherwise, the computer executes Java statements one after the other in the order in which they’re written.
B:Activity diagrams normally show the Java code that implements the activity.
C:Like pseudocode, activity diagrams help programmers develop and represent algorithms.
D:The arrows in the activity diagram represent transitions, which indicate the order in which the actions represented by the action states occur.
答案: Activity diagrams normally show the Java code that implements the activity.

10、 Which of the following is a double-selection control statement? ( )

A:do…while
B:for
C:if…else
D:if
答案: if…else

第四章 单元测试

1、 The number of arguments in the method call must match the number of parameters in the method declaration’s parameter list. ( )

A:对
B:错
答案: 对

2、 Floating-point values that appear in source code are known as floating-point literals and are type float by default. ( )

A:对
B:错
答案: 错

3、 Each class you create becomes a new __ that can be used to declare variables and create objects. ( )

A:package
B:instance
C:library
D:type.
答案: type.

4、 Which of the following statements is false? ( )

A:Each class declaration that begins with the access modifier private must be stored in a file that has the same name as the class and ends with the .java filename extension.
B:Every class declaration contains keyword class followed immediately by the class’s name.
C:Class, method and variable names are identifiers.
D:An object has attributes that are implemented as instance variables and carried with it throughout its lifetime.
答案: Each class declaration that begins with the access modifier private must be stored in a file that has the same name as the class and ends with the .java filename extension.

5、 Which of the following statements is false? ( )

A:By convention class names begin with an uppercase letter, and method and variable names begin with a lowercase letter.
B:Instance variables exist before methods are called on an object, while the methods are executing and after the methods complete execution.
C:A class normally contains one or more methods that manipulate the instance variables that belong to particular objects of the class.
D:Instance variables can be declared anywhere inside a class.
答案: Instance variables can be declared anywhere inside a class.

6、 Which of the following statements is true? ( )

A:Each object (instance) of the class shares the class’s instance variables.
B:Most instance-variable declarations are preceded with the keyword public, which is an access modifier.
C:Variables or methods declared with access modifier private are accessible only to methods of the class in which they’re declared.
D:None of the above is true.
答案: Variables or methods declared with access modifier private are accessible only to methods of the class in which they’re declared.

7、 When a method terminates, the values of its local variables are __. ( )

A:saved
B:copied
C:restored
D:lost
答案: lost

8、 Which of the following statements is true? ( )

A:Local variables are automatically initialized.
B:Every instance variable has a default initial value—a value provided by Java when you do not specify the instance variable’s initial value.
C:The default value for an instance variable of type String is void.
D:The argument types in the method call must be identical to the types of the corresponding parameters in the method’s declaration.
答案: Every instance variable has a default initial value—a value provided by Java when you do not specify the instance variable’s initial value.

9、 Which of the following statements is false? ( )

A:The javac command can compile multiple classes at once; simply list the source-code filenames after the command with each filename separated by a comma from the next.
B:If the directory containing the app includes only one app’s files, you can compile all of its classes with the command javac .java.
C:The asterisk (
) in javac *.java indicates that all files in the current directory ending with the filename extension .java should be compiled.
D:All of the above are true.
答案: The javac command can compile multiple classes at once; simply list the source-code filenames after the command with each filename separated by a comma from the next.

10、 Which of the following statements is false? ( )

A:In the UML, each class is modeled in a class diagram as a rectangle with three compartments. The top one contains the class’s name centered horizontally in boldface. The middle one contains the class’s attributes, which correspond to instance variables in Java. The bottom one contains the class’s operations, which correspond to methods and constructors in Java.
B:UML represents instance variables as an attribute name, followed by a colon and the type.
C:Private attributes are preceded by the keyword private in the UML.
D:The UML models operations by listing the operation name followed by a set of parentheses. A plus sign (+) in front of the operation name indicates that the operation is a public.
答案: Private attributes are preceded by the keyword private in the UML.

11、 Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task. ( )

A:对
B:错
答案: 对

12、 A primitive-type variable can be used to invoke a method. ( )

A:对
B:错
答案: 错

13、 Variables declared in the body of a particular method are known as instance variables and can be used in all methods of the class. ( )

A:对
B:错
答案: 错


上方为免费预览版答案,如需购买完整答案,请点击下方红字

点击这里,购买完整版答案


为了方便下次阅读,建议在浏览器添加书签收藏本网页

添加书签方法:

1.电脑按键盘的Ctrl键+D键即可收藏本网页

2.手机浏览器可以添加书签收藏本网页

面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第3张

面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第4张


如需获取更多网课答案,可在浏览器访问我们的网站:http://www.mengmianren.com/

面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第5张

面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第6张

注:请切换至英文输入法输入域名,如果没有成功进入网站,请输入完整域名:http://www.mengmianren.com/


我们的公众号

打开手机微信,扫一扫下方二维码,关注微信公众号:萌面人APP

本公众号可查看各种网课答案,还可免费查看大学教材答案

点击这里,可查看公众号功能介绍

面向对象程序设计(山东联盟) 最新知到智慧树满分章节测试答案第7张


萌面人优惠券:一键领取淘宝,天猫,京东,拼多多无门槛优惠券,让您购物省省省,点击这里,了解详情


达搬韭翱屏继氦绍抠毕茎臼董