JAVA数据结构习题及解答(英)

  • 格式:pdf
  • 大小:106.79 KB
  • 文档页数:20

下载文档原格式

  / 20
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Questions

These questions are intended as a self-test for readers.Answers to the questions may be found in Appendix C.

1.In many data structures you can________a single record,_________it,and

_______it.

2.Rearranging the contents of a data structure into a certain order is called

_________.

30CHAPTER1Overview

3.In a database,a field is

a.a specific data item.

b.a specific object.

c.part of a recor

d.

d.part of an algorithm.

4.The field used when searching for a particular record is the______________.

5.In object-oriented programming,an object

a.is a class.

b.may contain data and methods.

c.is a program.

d.may contain classes.

6.A class

a.is a blueprint for many objects.

b.represents a specific real-world object.

c.will hold specific values in its fields.

d.specifies the type of a method.

7.In Java,a class specification

a.creates objects.

b.requires the keyword new.

c.creates references.

d.none of the abov

e.

8.When an object wants to do something,it uses a________.

9.In Java,accessing an object’s methods requires the_____operator.

10.In Java,boolean and byte are_____________.

(There are no experiments or programming projects for Chapter1.)

Questions31

Chapter1,Overview

Answers to Questions

1.insert,search for,delete

2.sorting

3.c

4.search key

5.b

6.a

7.d

8.method

9.dot

10.data types

Questions

These questions are intended as a self-test for readers.Answers may be found in Appendix C.

1.Inserting an item into an unordered array

a.takes time proportional to the size of the array.

b.requires multiple comparisons.

c.requires shifting other items to make room.

d.takes the same time no matter how many items there ar

e.

2.True or False:When you delete an item from an unordered array,in most cases you shift other items to fill in the gap.

3.In an unordered array,allowing duplicates

a.increases times for all operations.

b.increases search times in some situations.

c.always increases insertion times.

d.sometimes decreases insertion times.

4.True or False:In an unordered array,it’s generally faster to find out an item is not in the array than to find out it is.

5.Creating an array in Java requires using the keyword________.

6.If class A is going to use class B for something,then

a.class A’s methods should be easy to understand.

b.it’s preferable if class B communicates with the program’s user.

c.the more complex operations should be placed in class A.

d.the more work that class B can do,the better.

7.When class A is using class B for something,the methods and fields class A can access in class B are called class B’s__________.

74CHAPTER2Arrays

8.Ordered arrays,compared with unordered arrays,are

a.much quicker at deletion.

b.quicker at insertion.

c.quicker to create.

d.quicker at searching.

9.A logarithm is the inverse of_____________.

10.The base10logarithm of1,000is_____.

11.The maximum number of elements that must be examined to complete a binary search in an array of200elements is

a.200.

b.8.

c.1.

d.13.

12.The base2logarithm of64is______.

13.True or False:The base2logarithm of100is2.

14.Big O notation tells