Answered You can hire a professional tutor to get the answer.
QUESTION 5 Which code correctly swaps the integer values stored in the array data at positions first and second?
QUESTION 5
- Which code correctly swaps the integer values stored in the array data at positions first and second?
- Which one of the following statements is valid for declaring a vector as a function parameter?
- A vector declared as a function parameter should be accompanied with its size.
- A vector declared as a function parameter is a reference parameter by default.
- An element of the vector cannot be modified in a function when the vector is declared as a parameter.
- An element of the vector can be modified if declared using the & sign as a function parameter.
- Consider the following code snippet:
What is the output of the code snippet?
- 1050
- 2030
- 3040
- 4050
- What is the output of the following code snippet?
- 1
- 3
- 4
- 5
- Consider the following line of code for calling a function named func1:
Which one of the following function signatures is valid for func1, where vectdata is an integer vector and vardata is an integer variable?
- void func1(vectdata, vardata)
- void func1(vector vectdata, int vardata)
- void func1(vector<int> vectdata, int vardata)
- void func1(vector<int>, int)
- Consider the following code snippet:
What is the value of the cnt variable after the execution of the given code snippet?
- 1
- 2
- 3
- unpredictable result
The binary search on an array requires that
- The array elements be in order
- The array elements be in random order
- The element that is being searched for must always be in the array
- The array be two dimensional
- In the following code fragment, the variables SIZE and count serve what roles?
- SIZE is the capacity of the array; count is the number of elements currently used
- SIZE is the number of elements used in the array; count is the array capacity
- SIZE is the capacity of the array; count is the number of elements that are equal to zero
- SIZE is the number of elements unused in the array; count is the number of inputs
Your program needs to store a sequence of integers of unknown length. Which of the following can you use?
- An array declared as int a[];
- A vector declared as vector<int> a;
- An array declared as int a[1000];
- All of the listed items.
- Consider the following code snippet:
Which one of the following statements is correct for the given code snippet?
- Line 2 declares and initializes an array of five elements with value 5.
- Line 2 causes a bounds error because 5 is an invalid index number.
- Line 2 initializes the fifth element of the array with value 5.
- Line 2 initializes all the elements of the array with value 5.
Which is true when a 2D array is used as a function parameter?
- Only the row size must be a constant provided as an argument to the function
- Only the column size must be a constant provided as an argument to the function
- Both the row and column size must be constants provided as arguments to the function
- Neither the row nor the column size are necessary
- 38.43. What does the following code segment do to the array a[], given that the current_size variable holds the number of valid elements currently in the array?
- It shrinks the size by 1.
- It changes the ordering of elements in the array.
- It removes the element at index pos.
- It does all of these things.
- Consider the following code snippet:
What is the output of the code snippet?
- 15
- 14
- 25
- 04
What is the valid range of index values for an array of size 10?
- 0 to 10
- 1 to 9
- 1 to 10
- 0 to 9
- Consider the following code snippet:
What is the output of the given code snippet?
- 8
- 8,7
- 87
- 08
The selection sort uses two primary operations to put the elements of an array in order:
- find the minimum; and insert
- find the minimum; and swap
- divide and conquer; and swap
- insert; and copy