Module 1 (Prelim) Flashcards
1.1 Overview 1.2 Comparing Procedural and Object Oriented Programming Concepts 1.3 Creating Java 1.4 Using Data 1.5 Arithmetic Operators 1.6 Understanding Type Conversion
Sets of operations executed in sequence
Procedural programming
Named computer memory locations that hold values
Variables
Two popular approaches to writing computer programs are
- procedural programming
- object-oriented programming
Individual operations grouped into logical units
Procedures
is an extension of procedural programming in which you take a slightly different approach to writing computer programs.
Object-Oriented Programming
Writing object-oriented programs involves: (3)
- Creating classes, which are blueprints for objects
- Creating objects, which are specific instances of those classes
- Creating applications that manipulate or use those objects
Understanding object-oriented programming requires grasping three basic concepts:
- Encapsulation as it applies to classes as objects
- Inheritance
- Polymorphism
- Abstraction (just in case)
a term that describes a group or collection of objects with common properties.
Class
describes what attributes its objects will have and what those objects will be able to do.
class definition
are the characteristics that define an object; they are PROPERTIES of the object.
Attributes
An ___________ is a specific, concrete INSTANCE of a class.
object
Creating an instance is called _______
instantiation
is a set of written instructions that tells the computer what to do
Computer Program
Machine language is a ___________ programming language
low-level
allows you to use a vocabulary of reasonable terms
high-level programming language
set of rules for the language
syntax
translates language statements into machine code
compiler/interpreter
misuse / misspelled programming language
syntax error
freeing program from errors
debugging
Understanding Classes, Objects, and Encapsulation:
Which stands for class, object, and properties for the example below?
Dog:
Breed:
Gender and age:
Dog: class
Breed: object
Gender and age: properties
The values of the properties of an object are referred to as the object’s ___________
state
Besides defining properties, classes define ___________ their objects can use.
methods
is a self-contained block of program code that carries out some action, similar to a procedure in a procedural program.
method
if objects are similar to nouns, then methods are similar to verbs. (True or False)
T
In object-oriented classes, attributes and methods are encapsulated into _________
A) class
B) objects
C) properties
B) objects
Encapsulation refers to two closely related object-oriented notions:
- Encapsulation is the enclosure of data and methods within an object.
- Encapsulation also refers to the concealment of an object’s data and methods from outside sources.
is the enclosure of data and methods within an object.
Encapsulation
allows you to treat all of an object’s methods and data as a single entity. Just as an actual dog contains all of its attributes and abilities, so would a program’s Dog object.
Encapsulation
also refers to the concealment of an object’s data and methods from outside sources.
Encapsulation
lets you hide specific object attributes and methods from outside sources and provides the security that keeps data and methods safe from inadvertent changes.
Encapsulation
Concealing data is sometimes called _________, and concealing how methods work is _________
- information hiding
- implementation hiding.
the ability to create classes that share the attributes and methods of existing classes, but with more specific features.
inheritance
means “many forms”—it describes the feature of languages that allows the same word or symbol to be interpreted correctly in different situations based on the context.
polymorphism
In a GUI application, it is convenient to remember one method name, such as _________or _________, and have it work correctly no matter what type of object you are modifying.
setColor
setHeight
Define a Java class using any name or _________
identifier
Requirements for identifiers: (5)
- Must begin with one of the following:
* Letter of the English alphabet
* Non-English letter (such as α or π)
* Underscore
* Dollar sign - Cannot begin with a digit
Identifiers can only contain: (4)
Letters
Digits
Underscores
Dollar signs
Single-line comments in Java ________
A) starts with //
B) starts with /* and ends with */
C) starts with #
D) starts with // and ends with //
A) starts with //
Multi-line comments in Java ________
A) starts with //
B) starts with /* and ends with */
C) starts with #
D) starts with // and ends with //
B) starts with /* and ends with */
Identifiers can be a Java reserved keyword
(True or False)
F
Cannot be a Java reserved keyword