Loading
Home › Computer Science Help › C++ questions
Status: Completed

C++ questions

Date Posted: 18/12/2020
Category: Computer Science
Due Date: 18/12/2020
Instruction
Question 2: Assume that myList is a previously declared an initialized array. Assume that the variable length holds the total number of elements in the array. Complete the line to display each element of the array in the body of the loop. Fill in the blank only; do not type the entire line, just provide what is missing. for (int i = 0; i a >> b; if( b == 0 ) { cout instead of << Question 20: To use an array of strings in your code, which of the following do you need? Group of answer choices #include #include #include prefix string with std:: or include this statement: using namespace std; Question 21: What does this function do? int mystery(double employees[], double id, int size) { for (int i = 0; i < size; i++) { if (id == employees[i]) { return i; } } return -1; } Group of answer choices This is a function that performs a search. If the id is found in the employees array, its index location is returned, otherwise -1 is returned. This is a function that returns all index numbers in the employees array, one at a time. Once the entire array has been processed, -1 is returned. This is a function that swaps the value in the id variable with the value in the employees array at index i. If the swap cannot be performed, -1 is returned. This is a function that sorts the employees array Question 22: Which of the following function calls would successfully call this function? (Select all that apply) void swapShellsFirstInArray(int basket[]) { int temp = basket[0]; basket[0] = basket[1]; basket[1] = temp; } Group of answer choices int collection[5] = {3, 2, 1, 4, 6}; swapShellsFirstInArray(collection); int collection[10] = {3, 2, 1, 4, 6}; swapShellsFirstInArray(collection); int collection[] = {3, 2}; swapShellsFirstInArray(collection); int collection[]; swapShellsFirstInArray(collection); int collection[3] = {3, 2, 1}; swapShellsFirstInArray(collection); Question 23: The numbers to the left represent the line numbers, but are not part of the code. What is wrong with this function? 1 void swapShells(int &n1, int &n2) 2 { 3 int temp = n1; 4 n1 = n2; 5 n2 = temp; 6 return temp; 7 } Group of answer choices The return type is wrong in the function header The n1 and n2 variables are not defined. The parameter list causes a syntax error Question 24: Consider the following switch block which should only handle values 1, 2, 3 and 4. Any other value should trigger the error message. Provide the missing line: int input = 1; cin << input; switch ( input ) { case 1: cout << "Case 1\n"; break; case 2: cout << "Case 2\n"; break; case 3: cout << "Case 3\n"; break; case 4: cout << "Case 4\n"; break; _______________ //provide this missing line cout << "Error: bad input\n"; break; } Question 25: Which of the following switch block is error free? (select all that apply) Group of answer choices char a = '1'; char b = '1'; char c = '2'; switch ( a ) { case '1': // Code break; case '2': // Code break; default: // Code break; } int a = 1; int b = 1; int c = 2; switch ( a ) { case 1: // Code break; case 2: // Code break; default: // Code break; } int a = 1; int b = 1; int c = 2; switch ( a ) { case b: // Code break; case c: // Code break; default: // Code break; }
Attached
No File uploaded yet.
Bidders
Respectwriter 5 years, 9 months ago
Rated 9.03 earned 26253.25 around 814 assignments.
I am an expert in this subject, kindly consider my bid.Thank you
$120.00
  • wait it didn't get all of my questions
    User_30863 | Dec 18, 2020, 10:19 AM
  • what do you mean and are you able to upload it as a document?
    Respectwriter | Dec 18, 2020, 10:22 AM
  • will take couple of minutes
    User_30863 | Dec 18, 2020, 10:22 AM
  • that will be good
    Respectwriter | Dec 18, 2020, 10:24 AM
  • Instead of copy pasting I would love if you upload it as a document and well numbered.
    Respectwriter | Dec 18, 2020, 10:27 AM
  • Kindly let me know ounces you have uploaded it
    Respectwriter | Dec 18, 2020, 10:35 AM
  • https://docs.google.com/document/d/1yldyhFxTYf0_h8UK2K5i7VhqMna5Bpc6tzHT-x1tqm8/edit?usp=sharing
    User_30863 | Dec 18, 2020, 10:52 AM
  • Thank you
    Respectwriter | Dec 18, 2020, 10:58 AM
  • I have uploaded your work and you may now release the payment . Thank you
    Respectwriter | Dec 19, 2020, 02:14 AM
  • Hello, please be so kind to release the payment. thank
    Respectwriter | Dec 19, 2020, 13:40 PM
  • Hello, will you be so kind to release the payment
    Respectwriter | Dec 20, 2020, 07:51 AM
  • I uploaded your work a while ago and you haven't released the payment..please be so kind to release now.
    Respectwriter | Jan 02, 2021, 13:33 PM
  • Happy new year, I uploaded your work last month and u forgot to release the payment. Please be so kind to do so. Thank you
    Respectwriter | Jan 14, 2021, 05:52 AM
  • I uploaded your work a while ago and you haven't released the payment..please be so kind to release now.
    Respectwriter | Jan 15, 2021, 03:52 AM
  • Hey. I uploaded your work days ago and you never released the payment. Please be so kind to release now. Thank you.
    Respectwriter | Jan 25, 2021, 20:17 PM
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}