Answer the following statements true (T) or false (F)
1. The default copy constructor and default operator = provide deep copy.
2. In deep copy, pointers are followed and data and the pointer structure are duplicated.
3. A function can return an array.
4. An array name is a constant pointer to array base type.
1. False
The default copy constructor and operator = just copy the members. This is the definition of shallow copy.
2. True
This is the definition of deep copy: duplicating the pointer structure and data.
3. False
A function can return a pointer to a object whose lifetime is longer than the function’s lifetime, which can be a dynamic array, but arrays may not be returned by a function. Specifically, the object must not be a local variable,
4. True
Pointer arithmetic shows how array indexing works: If I declare
```
int a[10];
a[4] //is equal to
*(a + 4)
```
You might also like to view...
A school cafeteria is giving an electronic survey to its stu- dents to improve their lunch menu. Create an application that will use a two-dimensional array to hold counters for the survey (Fig. 17.31). You will also provide JRadioButtons for the students to select whether they like or dislike a particular food.
a) Copying the template to your working directory. Copy the C:Examples Tutorial17ExercisesFoodSurvey directory to your C:SimplyJava directory.
b) Opening the template file. Open the FoodSurvey.java file in your text editor.
c) Declaring a two-dimensional int array. On lines 29-30, insert code to declare a two- dimensional int array named display, with 4 rows and 2 columns.
d) Declaring local variables. On line 105, in method addJButtonActionPerformed, set the text of displayJTextArea to "Food Like Dislike" for the header. Cre- ate a local int variable index. This variable should contain the index of the selected item in foodJComboBox.
e) Using a for loop to display the data. Insert a for statement that will loop through each row in the foodChoices array (0–3). In the body of the loop, append the appro- priate food to displayJTextArea. The counter variable of the for statement will be used as the index of the foodChoices array. Add the "
" escape sequence to displayJText
What is true about how lists are indexed?
A. indices increase in both movement directions B. indices decrease to the left and increase to the right C. indices decrease in both movement directions D. indices decrease to the right and increase to the left
If policies are too restrictive or too hard to implement and comply with, they will either be ignored or people will find a way to circumvent the controls in the policies.
Answer the following statement true (T) or false (F)
The ____________________ Blur filter simulates taking a picture of an object in motion.
Fill in the blank(s) with the appropriate word(s).