Question

PLEASE ANSWER ALL OF THEM, I REALLY APPRECIATE IT

PLEASE IGNORE THE SELECTED ANSWERS

Question 9 3 pts Which best describes the meaning of a 1 (true) being output? Assume v is a large array of ints. int i; bool

Question 7 3 pts The following program generates an error. Why? const int NUM_ELEMENTS = 5; int uservals [NUM_ELEMENTS); unsi

Question 2 3 pts Which XXX/YYY declare an array having MAX_SIZE elements and initializes all elements with -1? const int MAX_

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 9:

Answer: Option 4 (last value is negative)

Explanation: When the loop exits the value of s must be true. For achieving this the last digit must be negative no matter what the remaining elements are.

Question 10:

Answer: Option 2 (7,3,0,8,8)

Explanation: the loop runs only upto the 3rd index(or 4th element) and replaces the current element by the next element. Hence the last element remains in its place unaltered.

Question 7:

Answer: Option 4 (the for loop tries to access an index that is out of the array's valid range)

Explnation: There are 5 elements in the array and the index can range from 0 to 4 but the loop runs untill 5 and element does not exist at index 5. Hence an error will be generated.

Question 8:

Answer: Option 3 (min value in v)

Explanation: The loop checks all the elements with the current min value and replaces the min value if any element is lesser than the current min. Hence s contains the minimum value present in v

Question 2:

Answer: Option 1 (MAX_SIZE / MAX_SIZE)

Explanation: The array must hold MAX_SIZE number of elements and hence XXX must be MAX_SIZE. The loop must run index from 0 to MAX_SIZE-1. But "<" runs the loop untill MAX_SIZE-1 only if YYY=MAX_SIZE.

Please give a like

Add a comment
Know the answer?
Add Answer to:
PLEASE ANSWER ALL OF THEM, I REALLY APPRECIATE IT PLEASE IGNORE THE SELECTED ANSWERS Question 9...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi!, having trouble with this one, In this class we use visual studio, C++ language --------------------------------------------------------------...

    Hi!, having trouble with this one, In this class we use visual studio, C++ language -------------------------------------------------------------- Exercise #10 Pointers - Complete the missing 5 portions of part1 (2 additions) and part2 (3 additions) Part 1 - Using Pointers int largeArray (const int [], int); int largePointer(const int * , int); void fillArray (int * , int howMany); void printArray (const char *,ostream &, const int *, int howMany); const int low = 50; const int high = 90; void main()...

  • Please answer in C++, and Please consider ALL parts of the question, especially where it asks the...

    Please answer in C++, and Please consider ALL parts of the question, especially where it asks the user for V. So there should be a "cin >> V" somewhere. The last guy did not answer it correctly so please make sure you do! Thank You!! Question 1 Write the following two functions. The first function accepts as input a two-dimensional array of integers. It returns two results: the sum of the elements of the array and the average The second...

  • Who could write the array.cpp file ?   //main.cpp #include "array.hpp" #include <iostream> int main() { int...

    Who could write the array.cpp file ?   //main.cpp #include "array.hpp" #include <iostream> int main() { int n; std::cin >> n; array a(n); for (int i = 0; i < n; i++) { std::cin >> a.data()[i]; } std::cout << "array size:" << a.max_size() << std::endl; std::cout << "array front:" << a.front() << std::endl; std::cout << "array back:" << a.back() << std::endl; int* data = a.data(); std::cout << "array elements using data:" << std::endl; for (int i = 0; i < n;...

  • May i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #...

    may i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #include<iostream> #include<string> #include<sstream> #include<stack> using namespace std; int main() { string inputStr; stack <int> numberStack; cout<<"Enter your expression::"; getline(cin,inputStr); int len=inputStr.length(); stringstream inputStream(inputStr); string word; int val,num1,num2; while (inputStream >> word) { //cout << word << endl; if(word[0] != '+'&& word[0] != '-' && word[0] != '*') { val=stoi(word); numberStack.push(val); // cout<<"Val:"<<val<<endl; } else if(word[0]=='+') { num1=numberStack.top(); numberStack.pop(); num2=numberStack.top(); numberStack.pop();...

  • this is c code. please answer all questions on a piece of paper and show work....

    this is c code. please answer all questions on a piece of paper and show work. i need to prepare as i have a midterm i will have to be completing on paper 1) Bit Operators: This C program compiles and runs. What is its output? 1) #include <stdio.h> 2) void main (void) 3) unsigned char x =60; 4) 5) 6) 7) 8 ) 9) 10) 11) 12) 13) unsigned char a = x < 1; unsigned char b unsigned...

  • Here is the code I made, but the test case is not working, it goes wrong...

    Here is the code I made, but the test case is not working, it goes wrong when the binary string convert to decimal. please help. #include "stdafx.h" #include <iostream> #include <string> #include <math.h> #include <locale> using namespace std; // function for option 1 void decToBin(int number) {        int array[16];        int i = 0;        for (int counter = 0; counter < 16; counter++)        {               array[counter] = 0;        }        while (number > 0)        {...

  • Programming Assignment 7 Implement a function named fibo that will get a 20 element initialized an...

    Programming Assignment 7 Implement a function named fibo that will get a 20 element initialized an array of zeros from the main function. It will set the array to the Fibonacci sequence. This sequence starts with 1 and 2 as the first 2 elements and each element thereafter is the sum of the previous two elements. (1, 2, 3, 5, 8, 13…). Add another function named findNum that will get the newly created array by fibo from the main function....

  • I need help with this assignment. My answers are in bold but I am not getting...

    I need help with this assignment. My answers are in bold but I am not getting the correct output which is also below. Can you please take a look at it. #include   <stdlib.h> #include   <stdio.h> #include   <float.h> #include   <math.h> // PURPOSE: To define a nickname for type 'unsigned int'. typedef   unsigned int           uInt; //--          Sign related constants           --// // PURPOSE: To tell how many bits to shift the sign field from the //   least...

  • Hi, I have C++ programming problem here: Problem: Please modify your string type vector in for...

    Hi, I have C++ programming problem here: Problem: Please modify your string type vector in for push_back() function as below: void push_back(string str) { // increase vector size by one // initialize the new element with str } In addition, the standard library vector doesn't provide push_front(). Implement push_front() for your vector. Test your code with the main function below. int main() {    vector v1(3);    cout<<"v1: ";    v1.print(); // this should display -, -, -    for...

  • Write a program that supports the three phases (setup, voting and result-tallying) which sets up and...

    Write a program that supports the three phases (setup, voting and result-tallying) which sets up and executes a voting procedure as described above. In more details: You can start with the given skeleton (lab6_skeleton.cpp). There are two structures: Participant structure, which has the following members: id -- an integer variable storing a unique id of the participant (either a candidate or a voter). name -- a Cstring for storing the name of the participant.. hasVoted -- a boolean variable for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT