Science
c++ questions

Question Description

Can you help me understand this Science question?

New Text Document (2).txt 

Unformatted Attachment Preview

What is the termination condition for the following While loop? while (beta > 0 && beta < 10) { cout << beta << endl; cin >> beta; } beta > 0 && beta < 10 beta >= 0 && beta <= 10 beta < 0 || beta > 10 beta <= 0 || beta >= 10 === Indicate where (if at all) the following loop needs a priming read. count = 1; while (count <= 10) { cin >> number; cout << number * 2; counter++; } // Line 1 // Line 2 // Line 3 // Line 4 // Line 5 // Line 6 // Line 7 between lines 1 and 2 between lines 3 and 4 between lines 5 and 6 between lines 6 and 7 No priming read is necessary. === Give the input data 25 10 6 -1 What is the output of the following code fragment? (All variables are of type int.) sum = 0; cin >> number; while (number != -1) { cin >> number; sum = sum + number; } cout << sum << endl; 15 41 40 16 no output--this is an infinite loop ==== After execution of the following code, what is the value of length? (count and length are of type int.) length = 5; count = 4; while (count <= { if (length length else length count++; } 6) >= 100) = length - 2; = count * length; 600 100 98 20 none of the above ==== What is the output of the following code fragment? (finished is a Boolean variable, and firstInt and secondInt are of type int.) finished = FALSE; firstInt = 3; secondInt = 20; while (firstInt <= secondInt && !finished) { if (secondInt / firstInt <= 2) // Reminder: integer division finished = TRUE; else firstInt++; } cout << firstInt << endl; 3 5 7 8 9 ==== In the following code fragment, a semicolon appears at the end of the line containing the While condition. cout << 'A'; loopCount = 1; while (loopCount <= 3); { cout << 'B'; loopCount++; } cout << 'C'; The result will be: the output AC the output ABC the output ABBBC a compile-time error an infinite loop ====== What is the output of the following code fragment? (All variables are of type int.) sum = 0; outerCount = 1; while (outerCount <= 3) { innerCount = 1; while (innerCount <= outerCount) { sum = sum + innerCount; innerCount++; } outerCount++; } cout << sum << endl; 1 4 10 20 35 ==== In the C++ program fragment count = 1; while (count < 10) count++; cout << "Hello"; the output statement that prints "Hello" is not part of the body of the loop. True False ==== In C++, an infinite loop results from using the assignment operator in the following way: while (gamma = 2) { . . . } True False ==== The body of a do...while loop is always executed (at least once), even if the while condition is not satisfied: True False ===== What is the out put of the following c++ code fragment? int count = 3; while (count-- > 3) cout << count<<" " ; 1 2 3 0 1 2 3 2 1 2 1 0 none of above.this code fragment returns a syntax error. ==== what is the out put of the following code fragment: int count = 3; while (-- count > 0) cout<< count<<" "< Purchase answer to see full attachment
Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

khakaan (1456)
University of Virginia

Anonymous
Top quality work from this tutor! I’ll be back!

Anonymous
Just what I needed… fantastic!

Anonymous
Use Studypool every time I am stuck with an assignment I need guidance.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors