Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The invariant of a class is a. objects of a class which are not allowed to chang

ID: 3856537 • Letter: T

Question

The invariant of a class is a. objects of a class which are not allowed to change b. the rules that dictate how the member variables of a class represent a value c. those parts of the class that never change d. the rules of programming that all programmers have been following these past 50 years. A linear search has a Big O performance of N (N3 - 2N)/2 N^2 Log_2 N When a member function is declared as const it means that a. The entire object cannot be changed by any of its functions b. Functions cannot be made const because only variables can be const c. This function cannot change any object of the class d. This function will not change the object of which it is a member

Explanation / Answer

21)

Ans: (A) Objects of a class which are not allowed to change.

generally invarient is a property which remains unchanged hen transformations of a certain type are applied to the objects. this is applicable to class also.

22)

Ans: N

Linear search means For instance, if you have a list with elements [1, 3, 5, 7, 9, 11] and you are looking for 11 you will start by the first element, then the second element, and so on, which in this case will take 6 iterations.

Generally, we could say that in the worst case you will have to traverse the whole list, so it will take n iterations, where n is the number of elements on the list. So we say that the linear search algorithm is O(n).

23)

Ans: A

a method which is declared ‘const’ cannot even make changes to the hidden parts of its object that would not make any changes that would be apparent from the outside.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote