面向对象程序设计(山东联盟) 知到智慧树答案2024 z40614

第一章 单元测试

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?
面向对象程序设计(山东联盟) 知到智慧树答案2024  z40614第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)?
面向对象程序设计(山东联盟) 知到智慧树答案2024  z40614第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:错
答案: 错


下方是付费阅读内容:本平台商品均为虚拟商品,无法用作二次销售,不支持退换货,请在购买前确认您需要购买的资料准确无误后再购买,望知悉!

暂无优惠



完整答案需点击上方按钮支付5元购买,所有答案均为章节测试答案,无期末答案。购买后上方矩形框将出现已付费的隐藏内容。



不知道怎么购买?点此查看购买教程!


点关注,不迷路,微信扫一扫下方二维码

关注我们的公众号:阿布查查  随时查看答案,网课轻松过


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

电脑浏览器添加/查看书签方法

1.按键盘的ctrl键+D键,收藏本页面

2.下次如何查看收藏的网页?

点击浏览器右上角-【工具】或者【收藏夹】查看收藏的网页


手机浏览器添加/查看书签方法

一、百度APP添加/查看书签方法

1.点击底部五角星收藏本网页

2.下次如何查看收藏的网页?

点击右上角【┇】-再点击【收藏中心】查看

二、其他手机浏览器添加/查看书签方法

1.点击【设置】-【添加书签】收藏本网页

2.下次如何查看收藏的网页?

点击【设置】-【书签/历史】查看收藏的网页

阿布查查 » 面向对象程序设计(山东联盟) 知到智慧树答案2024 z40614
+
账户
更新
搜索
帮助
主页