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

In the statement class Car: public Vehicle, which is the base class? Vehicle cla

ID: 3575105 • Letter: I

Question

In the statement class Car: public Vehicle, which is the base class? Vehicle class Car Public A binary search begins by examining the _ element of an array. first largest middle last the delete operator should only be used on pointers that _. have not yet been used have been correctly initialized are appropriately dereferenced point to storage allocated by the new operator in the statement class Car protected Vehicle, what us being protected? Derived class data Base class members Derived class functions Future inherited classes If employee is an array of objects with a public member function named setHoursWorked, which of the following statements correctly calls that function for the employee object in array element 5? employee.setHoursWorked[5] = 40; employee [5] .setHoursWorked(40); employee [5] .setHoursWorked = 40; setHoursWorked(employee [5], 40); When a relationship is established between two or more arrays by using the same subscript to relate entries between the arrays, the arrays are called _ arrays. indexed paired linked parallel A pointer may be initialized with _. the value of a floating-point variable the address of an existing object of any type the value of a floating-point constant the address of an existing object of the appropriate type When the less than (

Explanation / Answer

class Car : public Vehicle

This is the way we can perform Inheritance in C++.

It is not used as Identifier in C++.

So option “B” is wrong.

It is not used as Identifier in C++.

So option “D” is wrong.

class Vehicle

      ---

      ---

class Car : public Vehicle

      ---

      ---

According to the Inheritance a class which is deriving the properties from another class is called as Derived class or Sub class.

So Car is Derived or Sub class.

So option “C” is wrong.

So Vehicle class is called as Base class or Super Class.

So option “A” is Correct.

Binary search algorithm:

The point to remember is “the array elements are in sorted order”.

int binary_search(int a[],int l,int h,int k)

{

int m;

while(l<=h)

{

m=(l+h)/2;

if(a[m]==k)

return(m);

else if(a[m]<k)

l=m+1;

else

h=m-1;

}

return(-1);

}

So the answer is middle element that is option “C”.

We can create arrays to store homogeneous data.

The problem with arrays is that, we can create memory at the time of compiling program. That means the length of the array is fixed. The OPERATING SYSTEM will allocate the memory while the program is executing. After the completion of execution the memory will be released back to the operating.

But the problem in creating memory at compile time is the array is insufficient or wastage. To avoid this we create memory at runtime. This can be done by “new” operator.

            int* ptr;

            ptr = new int[size];

When the memory is created by “new” operator, it is not released back to the operating system. It causes system crash if the created memory is large. To avoid this “delete” operator is used.

            delete [ ] ptr;

The above statement will release the memory back to the operating system.

So in the given options “D” point to storage allocated by the new operator is correct.

Remaining options are false.

class Vehicle

{

      ---

      ---

}

class Car : protected Vehicle

{

      ---

      ---

}

When inheritance is protected

When a access specifier is used in Inheritance it won’t applied to derived classes. It will be applied to only Base class members.

So from the given options “B” Base class members is correct answer.

Derived class data is public by default. Super class access specifier is not applied to derived class data and to derived class member functions.

class Car : public Vehicle

This is the way we can perform Inheritance in C++.

It is not used as Identifier in C++.

So option “B” is wrong.

It is not used as Identifier in C++.

So option “D” is wrong.

class Vehicle

      ---

      ---

class Car : public Vehicle

      ---

      ---

According to the Inheritance a class which is deriving the properties from another class is called as Derived class or Sub class.

So Car is Derived or Sub class.

So option “C” is wrong.

So Vehicle class is called as Base class or Super Class.

So option “A” is Correct.

Binary search algorithm:

The point to remember is “the array elements are in sorted order”.

int binary_search(int a[],int l,int h,int k)

{

int m;

while(l<=h)

{

m=(l+h)/2;

if(a[m]==k)

return(m);

else if(a[m]<k)

l=m+1;

else

h=m-1;

}

return(-1);

}

So the answer is middle element that is option “C”.

We can create arrays to store homogeneous data.

The problem with arrays is that, we can create memory at the time of compiling program. That means the length of the array is fixed. The OPERATING SYSTEM will allocate the memory while the program is executing. After the completion of execution the memory will be released back to the operating.

But the problem in creating memory at compile time is the array is insufficient or wastage. To avoid this we create memory at runtime. This can be done by “new” operator.

            int* ptr;

            ptr = new int[size];

When the memory is created by “new” operator, it is not released back to the operating system. It causes system crash if the created memory is large. To avoid this “delete” operator is used.

            delete [ ] ptr;

The above statement will release the memory back to the operating system.

So in the given options “D” point to storage allocated by the new operator is correct.

Remaining options are false.

class Vehicle

{

      ---

      ---

}

class Car : protected Vehicle

{

      ---

      ---

}

When inheritance is protected

When a access specifier is used in Inheritance it won’t applied to derived classes. It will be applied to only Base class members.

So from the given options “B” Base class members is correct answer.

Derived class data is public by default. Super class access specifier is not applied to derived class data and to derived class member functions.

In the statement class Car : public Vehicle, which is the base class?

class Car : public Vehicle

This is the way we can perform Inheritance in C++.

class is the Keyword used to declare a class in C++.

It is not used as Identifier in C++.

So option “B” is wrong.

public is the Keyword used as access specifier in C++.

It is not used as Identifier in C++.

So option “D” is wrong.

class Vehicle

      ---

      ---

class Car : public Vehicle

      ---

      ---

Car is a class which is deriving properties from Vehicle class.

According to the Inheritance a class which is deriving the properties from another class is called as Derived class or Sub class.

So Car is Derived or Sub class.

So option “C” is wrong.

Vehicle is a class. Car class is deriving properties form Vehicle class.

So Vehicle class is called as Base class or Super Class.

So option “A” is Correct.

A Binary search begins by examining the ___________ element of an array.

Binary search algorithm:

Identify the index of first and last elements of the array.
Calculate the middle index value as mid=(first + last)/2.
Read the key value to search
Compare key value with array’s mid index.
If it is equal stop the search. If the array’s mid value is greater than the key value then make the last index as mid-1 and again calculate the mid value as specified in the second point.
If the array’s mid value is less than the key value then make the first index as mid+1 and again calculate the mid value as specified in the second point.

The point to remember is “the array elements are in sorted order”.

int binary_search(int a[],int l,int h,int k)

{

int m;

while(l<=h)

{

m=(l+h)/2;

if(a[m]==k)

return(m);

else if(a[m]<k)

l=m+1;

else

h=m-1;

}

return(-1);

}

So the answer is middle element that is option “C”.

The delete operator should only be used on pointers that ____________.

We can create arrays to store homogeneous data.

The problem with arrays is that, we can create memory at the time of compiling program. That means the length of the array is fixed. The OPERATING SYSTEM will allocate the memory while the program is executing. After the completion of execution the memory will be released back to the operating.

But the problem in creating memory at compile time is the array is insufficient or wastage. To avoid this we create memory at runtime. This can be done by “new” operator.

            int* ptr;

            ptr = new int[size];

When the memory is created by “new” operator, it is not released back to the operating system. It causes system crash if the created memory is large. To avoid this “delete” operator is used.

            delete [ ] ptr;

The above statement will release the memory back to the operating system.

So in the given options “D” point to storage allocated by the new operator is correct.

Remaining options are false.

In the statement class Car : protected Vehicle, what is being protected?

class Vehicle

{

      ---

      ---

}

class Car : protected Vehicle

{

      ---

      ---

}

When inheritance is protected

The private members of base class are not accessible to derived class. Which means private members of Vehicle class are not accessible to Car class.
The protected members of base class remain protected in derived class. Which means protected members of Vehicle class remain protected in Car class.
The public members of base class become protected in derived class. Which means public members of Vehicle class become protected in Car class.

When a access specifier is used in Inheritance it won’t applied to derived classes. It will be applied to only Base class members.

So from the given options “B” Base class members is correct answer.

Derived class data is public by default. Super class access specifier is not applied to derived class data and to derived class member functions.