Question: -Which are true for a constructor ? (Select all that apply). It is declared outside of the class. The name of a constructor has the
-Which are true for a constructor? (Select all that apply).
| It is declared outside of the class. | ||
| The name of a constructor has the same name as its class. | ||
| It is private. | ||
| It is public. | ||
| It has no return value. | ||
| It has no variables. |
-Select the items that are PREFERRED.
| accurate naming over comments | ||
| struct over class | ||
| global over local | ||
| standard library routine over programmer written routine | ||
| vector over array |
-Select the items which are significant properties of sorting algorithms:
| which programming language it is written in | ||
| amount of storage space required | ||
| what kind of evaluation return is indicated | ||
| how many number of lines of code it is written in | ||
| whether is stable or unstable | ||
| number of processing steps required |
-What is the order O( ) of binary search?
| O(n ^ 2) Clarification: The meaning of n ^ 2 is n-squared, or n * n | ||
| O(1) | ||
| O(n log n) | ||
| O(log n) | ||
| O(n) |
-What code will initialize an array with even-numbered elements set to 4.99 and the odd-numbered elements set to 7.99? (Elements are numbered at offsets 0, 1, 2, ...)
| for (int i=1; i<=25; ++i) { if (i % 2) array[i] = 7.99; else array[i] = 4.99; } | ||
| array[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24] = 4.99; array[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25] = 7.99; | ||
| for (int i=0; i<25; ++i) { if (i % 2) array[i] = 4.99; else array[i] = 7.99; } | ||
| for (int i=0; i<25; ++i) { array[i] = 4.99; array[i+1] = 7.99; } | ||
| for (int i=0; i<25; ++i) { if (i % 2) array[i] = 7.99; else array[i] = 4.99; } |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
