COP1000 Study Guide for Final
Arrays cannot be used if you need to search for a range of values. T or F?
False
In addition to their attributes, classes have methods associated with them, and every object instantiated from a given class possesses different methods. T or F?
False
Many newer programming languages such as C++, Java, and C# use subscript 1 to access the first element of the array. T or F?
False
Parallel arrays must contain the same data type. T or F?
False
The characteristics that define an object as part of a class
attributes
Parallel arrays are most useful when value pairs have a(n) ____ relationship. a. direct b. indirect c. linked d. tiered
b. indirect
All methods require a this reference. T or F?
False
The accessor method is another name for the set method. T or F?
False
You use subscripts 1 through 10 to access the elements in a ten element array. T or F?
False
Class diagrams consists of a rectangle divided into three sections. T or F?
True
Declaring a class does not create actual objects. T or F?
True
Declaring a named constant makes code easier to modify and understand. T or F?
True
Many newer programming languages such as C++, Java, and C# use the square bracket notation for arrays. T or F?
True
Methods in object-oriented programs use sequence, selection, and looping structures and make use of arrays. T or F?
True
Object-oriented programmers usually specify that their data fields will have private access. T or F?
True
The for loop is a good tool when working with arrays because you frequently need to process every element of an array from beginning to end. T or F?
True
A subscript, also called a(n) ____________________, is a number that indicates the position of a particular item within an array.
index
The concept that other classes should not alter an object's attributes--only the methods of an object's own class should have that privilege
information hiding
Another important concept in object-oriented programming is ________, which is the process of acquiring the traits of one's predecessors.
inheritance
The process of acquiring the traits of one's predecessors
inheritance
The data components of a class that belong to every instantiated object
instance variables
A parallel array is an array that stores another array in each element. T or F?
False
When you have a five element array and use subscript 6, your subscript is said to be out of bounds. T or F?
True
Within any object-oriented program, you continuously make requests to an object's methods, often including arguments as part of those requests. T or F?
True
You can improve the efficiency of a program by leaving a loop as soon as a match is found in the array. T or F?
True
Which statement is true of arrays? a. Only whole numbers can be used as array b. Only whole numbers can be stored in arrays. c. Arrays cause more work for the programmer, but allow faster program execution. d. Array elements cannot be reset after the array is declared.
a. Only whole numbers can be used as array
A program contains an array that holds all the names of the days of the week. Which of the following is true? a. The highest subscript is 6. b. The highest subscript is 7. c. The lowest subscript is 1. d. The highest subscript is 12.
a. The highest subscript is 6.
When you think in an object-oriented manner, every object is a member of a more general ____. a. class b. struct c. method d. collection
a. class
Named ____ hold values that do not change during a program's execution. a. constants b. variables c. objects d. items
a. constants
The process of combining all of an object's attributes and methods into a single package is ____. a. encapsulation b. inheritance c. information hiding d. data hiding
a. encapsulation
The purpose of a(n) ____ is to return a value from the class to a client. a. get method b. set method c. pull method d. access method
a. get method
An array is a(n) ____ of values in computer memory. a. list b. accumulation c. set d. record
a. list
In older object-oriented programming languages, simple numbers and characters are said to be ____ data types. a. primitive b. simple c. complex d. higher-order
a. primitive
The concept of a class is useful because of its ____. a. reusability b. mapping to reality c. abstract nature d. portability
a. reusability
A ____ method is also known as a help method. a. work b. private c. public d. set
a. work
When methods have ____, other programs and methods may use the methods to get access to the private data. a. private access b. public access c. complete access d. all access
b. public access
One advantage to using a named constant is that the statement becomes ____. a. self-perpetuating b. self-documenting c. self-referencing d. self-mitigating
b. self-documenting
____ are the characteristics of an object. a. Instances b. Attributes c. Behaviors d. Methods
b. Attributes
Objects both in the real world and in object-oriented programming contain ____ and methods. a. behaviors b. attributes c. help d. primitive data types
b. attributes
A ____ search starts looking in the middle of a sorted list, and then determines whether it should continue higher or lower. a. linear b. binary c. quadratic d. divided
b. binary
A ____ is a set of program statements that lists the characteristics of each object and the methods each object can use. a. class interface b. class definition c. class reference d. class model
b. class definition
The number of bytes in an array is always a multiple of the number of ____ in an array. a. subscripts b. elements c. iterators d. indexes
b. elements
Every array has a(n) ____ size. a. infinite b. finite c. variable d. constant
b. finite
Object-oriented programmers sometimes say an object is one ____ of a class. a. enumeration b. instantiation c. member d. reference
b. instantiation
Methods that set values are called ____ methods. a. modifier b. mutator c. creator d. access
b. mutator
All array elements have the same group ____. a. subscript b. name c. memory location d. value
b. name
Besides making your code easier to modify, using a ____ makes the code easier to understand. a. standard constant b. named constant c. literal constant d. named variable
b. named constant
The number of elements in an array is called the ____ of the array. a. width b. size c. height d. depth
b. size
In every programming language, when you access data stored in an array, you must use a ____ containing a value that accesses memory occupied by the array. a. superscript b. subscript c. key d. condition
b. subscript
If you declare a variable to be Boolean, you can set its value to ____. a. any number b. true or false c. any integer d. 1 or -1
b. true or false
A(n) ____ is the adjective that defines the type of access (public or private) outside classes will have to the attribute or method. a. control specifier b. control modifier c. access specifier d. access controller
c. access specifier
A(n) ____ is a program or class that instantiates objects of another prewritten class. a. instantiation b. method c. class client d. class definition
c. class client
A(n) ____ consists of a rectangle divided into three sections. a. class tree b. dependency diagram c. class diagram d. entity-relationship diagram
c. class diagram
A(n) ____ is another name for a subscript. a. pointer b. sequence c. index d. place holder
c. index
The data components of a class that belong to every instantiated object are the class's ____. a. numeric variables b. string variables c. instance variables d. data variables
c. instance variables
62. Object-oriented programmers also use the term ____ when describing inheritance. a. has-a b. from-a c. is-a d. contains
c. is-a
An array can be used to replace ____. a. records b. methods c. nested decisions d. loops
c. nested decisions
When a subscript is not within the range of acceptable subscripts, it is said to be ____. a. a superscript b. flagged c. out of bounds d. indexed
c. out of bounds
A ____ relates parallel arrays. a. superscript b. key c. subscript d. postscript
c. subscript
Describes a group or collection of objects with common attributes
class
A program or class that instantiates objects of another prewritten class
class client
A program or class that instantiates objects of another prewritten class is a ____________________ .
class client
When working with arrays, you can use ____________________ in several ways: To hold the size of an array, as the array values, and as a subscript .
constants
____ is a programming model that focuses on an application's components and data and methods the components use. a. Classical programming b. Functional programming c. Procedural programming d. Object-oriented programming
d. Object-oriented programming -- not sure
A(n) ____ is a programmer-defined type, such as a class. a. inheritance b. numeric data type c. primitive data type d. abstract data type
d. abstract data type
Array elements all have the same ____ in common. a. pointer b. memory location c. value d. data type
d. data type
Instance variables are often called ____ to help distinguish them from other variables you might use. a. rows b. records c. columns d. fields
d. fields
In all languages, subscript values must be sequential ____. a. characters b. fractions c. real numbers d. integers
d. integers
Providing array values is sometimes called ____. a. creating the array b. declaring the array c. accumulating the array d. populating the array
d. populating the array
To search an array for a(n) ____ match, you can store either the highest or lowest value of each range for comparison. a. flag b. index c. subscript d. range
d. range
The purpose of ____ is to set or change the values of data fields defined within the class. a. get methods b. put methods c. make methods d. set methods
d. set methods
Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[5]. You know that ____. --- a. numbers[1] is smaller than numbers[5] b. there are exactly four elements between those two elements c. numbers[5] is the last element in the array d. there are exactly three elements between those two elements
d. there are exactly three elements between those two elements
The true benefit of using an array lies in your ability to use a ____ as a subscript to the array. a. constant b. loop c. command d. variable
d. variable
The process of combining all of an object's attributes and methods into a single package
encapsulation
____________________ is the process of combining all of an object's attributes and methods into a single package.
encapsulation
A(n) ____________________ is a variable set to indicate whether some event has occurred.
flag
All array elements have the same ____________________ name, but each individual element also has a unique subscript indicating how far away it is from the first element.
group
A(n) ____________________ is one instance of a class.
object
An instance of a class
object
When you think in an object-oriented manner, everything is a(n) ____________________.
object
Simple numbers and characters
primitive data types
The set of all the values or contents of a class object's instance variables
state
Use a(n) ____________________ to indicate the position of a particular item within an array.
subscript or index