1. 2. For the following code, which statement is TRUE ? class Point { private: d
ID: 3546024 • Letter: 1
Question
1.
2.
For the following code, which statement is TRUE?
class Point
{
private:
double y;
double z;
public:
double x;
};
Given
const int SIZE = 50;
int numbers[SIZE];
int smallest;
write the code needed to find the smallest value in the array and output it using a cout statement.
4.
Define the following arrays
empNums
100-element array of ints
payRates
25-element array of floats
miles
14-element array of longs
cityName
26-element array of strings
lightYears
1000-element array of doubles
Given a partially filled array
int array[MAX_COUNT];
where MAX_COUNT = 100 and int arrayCount = 25 (number of actual elements added)
write the code to output only the populated elements in the array.
A. Exchanges values until they are all sorted B. Moves items immediately to their final position in the array C. Examines each element until a match is found D. Uses the same sort and search algorithms as arrays E. Starts in the middle of a sorted array
Explanation / Answer
1.)
----->a) vector<char> vecChar;
2.)
---->F) a, b, c and d are all false
3.)
const int SIZE = 50;
int numbers[SIZE];
int smallest;
/*****code is as follows**********/
int i;
smallest=numbers[0];
for(i=0;i<SIZE;i++)
if(smallest>numbers[i])
smallest=numbers[i];
cout<<"The smallest number is : "<<smallest;
4.)
A-------------->Bubble
B-------------->Selection sort
C-------------->Linear Search
D-------------->Vector
E-------------->Binary Search
5.)
suppose class name is A
method to be declared outside is : function
then syntax must be
void A::function(parameters)
{
}
i.e.
return_type class_name::method_name(parameters)
{
//body
}
6.)
int empNums[100];
float payRates[25];
long miles[14];
string cityName[26];
double lightYears[1000];
7.)
int i;
for(i=0;i<arrayCount;i++)
cout<<array[i];
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.