0% found this document useful (0 votes)
90 views8 pages

Chapter 4 Worksheet - Quinton Porter

This document is a worksheet for a chapter 4 exposure Java assignment. It contains 42 multiple choice and short answer questions about object-oriented programming concepts like the four stages of program design, the three main OOP features of encapsulation, polymorphism and inheritance, and using various methods in the Java Math class. The worksheet is to be completed, used to study for a test on chapter 4, and turned in on the test date for a grade.

Uploaded by

Porterqw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views8 pages

Chapter 4 Worksheet - Quinton Porter

This document is a worksheet for a chapter 4 exposure Java assignment. It contains 42 multiple choice and short answer questions about object-oriented programming concepts like the four stages of program design, the three main OOP features of encapsulation, polymorphism and inheritance, and using various methods in the Java Math class. The worksheet is to be completed, used to study for a test on chapter 4, and turned in on the test date for a grade.

Uploaded by

Porterqw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Exposure Java

Worksheet CH. 4
Name: Quinton Porter

Date: 10/20/2014
Period: 3

Instructions:
1- Read Chapter 4 of your text book.
2- Fill out this work sheet
3- Use this work sheet for test on chapter 4.
4- Worksheet is due on the day of the test as an assignment grade.
1.

What are the four stages of program design?


Cryptic, Unstructured, Structured, Object Oriented

2.

What are the three features of Object Oriented Programming?


Encapsulation, Polymorphism, Inheritance

3.

What is the essence of encapsulation?

Putting similar objects in the same capsule


4.

What package must be imported to use the Math class?

Java.lang
5.

How are methods of the Math class called?

With abbreviations
6.

What are the names for the information that is passed to a method?

Parameters or arguments

7.

Fill in the value returned by the indicated Math method.


Math class method
Math.floor(3.1)
Math.floor(7.5)
Math.floor(8.9)
Math.ceil(2.1)
Math.ceil(7.5)
Math.ceil(8.9)
Math.round(3.1)
Math.round(6.5)
Math.round(3.9)
Math.max(200,-300)
Math.min(-200,100)
Math.abs(-35)
Math.pow(4,6)
Math.PI
Math.E

value returned
3
7
8
3
8
9
3
7
4
200
-200
35
45565
3.14
2.71

Describe Cryptic Programming Stage.

Programmers made up their own coding ways that no one else understood

Define polymorphism:

When one thing has multiple forms

10 Define inheritance:
Reusing old code

11 Define attributes:
2

Store data

12 Define methods:
Act on the data
13 Define arguments:
Variables that are acted upon
14 Define parameter:
An argument

15 Define Object:
A noun that simulates a real life object

16 Spaghetti Programming is categorized by the use of


gotos

10. Structured Programming is categorized by the use of.


System outputs

11. Object Oriented Programming is categorized by the use of


3

Objects

12. What are the three features of OOP?

Inheritance, Encapsulation, Polymorphism

13. Identify the programming features of Object Oriented Programming?


Inheritance, Encapsulation, Polymorphism

14. Define encapsulation:


Putting similar objects in the same module

15. The statement that a square is a rectangle is an example of


Inheritance

16. Describe Object Oriented Programming.

Uses nouns to simulate real life objects


4

17. The actions in a Java class are called


Methods

18. Identify the correct usage of Math.sqrt().


System.out.println(Math.sqrt(a));

19. Which Math class features alters real numbers with fractions to whole numbers?
Round, Ceil, Floor

20. Which Math class features do not use any parameters or arguments?

Round, Ceil, Floor, PI, E, Abs, Sqrt

21. What is the value of result in the following statement?


int result = Math.pow(3,4);
81
5

22. What is the value of result in the following statement?


int result = Math.max(2,5);
5

23. What is the value of result in the following statement?


int result = Math.floor(9.999999);
9

24. What is the value of result in the following statement?


int result = Math.sqrt(Math.sqrt(256);

16

25. System.out.println(Math.round(7.3) outputs__7________________

26. System.out.println(Math.floor(5.3) outputs_____5_____________

27. System.out.println(Math.max(-700,-300) outputs_______-300___________

28. System.out.println(Math.pow(-6,6) outputs_________45565_________

29. System.out.println(Math.PI) outputs_______3.14___________


For questions 30-36, identify the outputs of x, in the following Math Class Methods.
30.
31.
32.
33.
34.
35.
36.

sqrt(x) x is 64.
floor(x) x is 5.5
ceil(x) x is 6.5
round(x) x is 2.3
PI
E
abs(x) x is -25

8
5
7
2
3.14
2.71
25

For questions 37-39, identify the outputs of x, and y, in the following Math Class Methods.
37.
38.
39.

Max(x,y) x is 5, y is 10
Min(x,y) x is 3, y is 15
pow(x.y) x is 2, y is 3

10
3
8

40. List the comments that are required for each class in your labs:
__File Name_________________________
____Lab Description_______________________
____Name_______________________
_____Period______________________
_____Date______________________
41. You have been assigned to turn in a selfie report and its number is 15, what would you name the file.
Selfie 15 Quinton Porter
42. Your are getting ready to print a lab to turn in, what will happen if the 5 comments are not included in the
lab print out.
7

You will get a 0

You might also like