Java How to Program_第一章_计算机、互联网及Java简介——习题

2018年12月20日补记:修改了一些格式错误(单词间缺少空格等)

---------------------------------------------------------------------------------------------------------------------------------

Exercises

1.4Fill in the blanks in each of the following statements:

a) The logical unit that receives information from outside the computer for use by the computer is the input unit.

b) The process of instructing the computer to solve a problem is called programming.

c) High-level language is a type of computer language that uses English like abbreviations for machine-language instructions.

d) Output unit is a logical unit that sends information which has already been processed by the computer to various devices so that it may be used outside the computer.

e) Memory unit and are logical units of the computer that retain information.

f) ALU is a logical unit of the computer that performs calculations.

g) CPU is a logical unit of the computer that makes logical decisions.

h) High-Level languages are most convenient to the programmer for writing programs quickly and easily.

i) The only language a computer can directly understand is that computer’s machine language.

j) CPU is a logical unit of the computer that coordinates the activities of all the other logical units.

1.5 Fill in the blanks in each of the following statements:

a) The Java programming language is now used to develop large-scale enterprise applications, to enhance the functionality of webservers, to provide applications for consumer devices and for many other purposes.

b) C language initially became widely known as the development language of the UNIX operating system.

c) The router ensures that messages, consisting of sequentially numbered pieces called bytes, were properly routed from sender to receiver, arrived intact and were assembled in the correct order.

 

d) The C++ programming language was developed by Bjarne Stroustrup in the early 1980s at Bell Laboratories.

1.6Fill in the blanks in each of the following statements:

a) Java programs normally go through five phases—edit, compile, load, verify and execution.

b) A(n) IDE provides many tools that support the software development process, such as editors for writing and editing programs, debuggers for locating logic errors in programs, and many other features.

c) The command java invokes the JVM, which executes Java programs.

d) A(n) virtual machine is a software application that simulates a computer, but hides the underlying operating system and hardware from the programs that interact with it.

e) The JVM class loader takes the .class files containing the program’s bytecodes and transfers them to primary memory.

f) The bytecode verifier examines bytecodes to ensure that they’re valid.

1.7 Explain the two compilation phases of Java programs.

1.8 One of the world’s most common objects is a wrist watch. Discuss how each of the following terms and concepts applies to the notion of a watch: object, attributes, behaviors, class, inheritance (consider, for example, an alarm clock), modeling, messages, encapsulation, interface and information hiding.

Making a Difference

Throughout the book we’ve included Making a Difference exercises in which you’ll be asked to work on problems that really matter to individuals, communities, countries and the world. For more information about worldwide organizations working to make a difference, and for related programming project ideas, visit our Making a Difference Resource Center atwww.deitel.com/making a difference.

1.9(Test-Drive: Carbon Footprint Calculator) Some scientists believe that carbon emissions, especially from the burning of fossil fuels, contribute significantly to global warming and that this can be combatted if individuals take steps to limit their use of carbon-based fuels. Organizations and individuals are increasingly concerned about their “carbon footprints.” Websites such as TerraPasshttp://www.terrapass.com/carbon-footprint-calculator/ and Carbon Footprinthttp://www.carbonfootprint.com/calculator.aspx provide carbon-footprint calculators. Test-drive these calculators to determine your carbon footprint.

Exercises in later chapters will ask you to program your own carbon-footprint calculator. To prepare for this, use the web to research the formulas for calculating carbon footprints.

1.10(Test-Drive: Body Mass Index Calculator) Obesity causes significant increases in illnesses such as diabetes and heart disease. To determine whether a person is overweight or obese, you can use a measure called the body mass index (BMI). The United States Department of Health and Human Services provides a BMI calculator athttp://www.nhlbi.nih.gov/guidelines/obesity/BMI/bmicalc.htm. Use it to calculate your own BMI. A forthcoming gexercise will ask you to program your own BMI calculator. To prepare for this, use the web to research the formulas for calculating BMI.

1.11(Attributes of Hybrid Vehicles) In this chapter you learned some basics of classes. Now you’ll “flesh out” aspects of a class called “Hybrid Vehicle.” Hybrid vehicles are becoming increasingly popular, because they often get much better mileage than purely gasoline-powered vehicles. Browse the web and study the features of four or five of today’s popular hybrid cars, then list as many of their hybrid-related attributes as you can. Some common attributes include city-miles-per-gallon and highway-miles-per-gallon. Also list the attributes of the batteries (type, weight, etc.).

1.12(Gender Neutrality) Many people want to eliminate sexism in all forms of communication. You’ve been asked to create a program that can process a paragraph of text and replace gender-specific words with gender-neutral ones. Assuming that you’ve been given a list of gender-specific words and their gender-neutral replacements (e.g., replace both “wife” and “husband” with “spouse,” “man” and “woman” with “person,” “daughter” and “son” with “child”), explain the procedure you’d use to read through a paragraph of text and manually perform these replacements.

How might your procedure generate a strange term like “woperchild?”You’ll soon learn that a more formal term for “procedure” is “algorithm,” and that an algorithm specifies the steps to be performed and the order in which to perform them. We’ll show how to develop algorithms then convert them to Java programs which can be run on computers.

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值