Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that you correct for minor compile-time errors. Given the following code, which statements correctly describe the output. #include using namespace std; int main() {

Assume that you correct for minor compile-time errors. Given the following code, which statements correctly describe the output.

  1. #include
  2. using namespace std;
  3. int main() {
  4. int b = 16, x = 10, y = 65536;
  5. float k = 10, j = 3.5;
  6. cout < (b / x) << endl;
  7. cout << (b / k) << endl;
  8. cout << (b / 10) << endl;
  9. cout << (int)((char)y) << endl;
  10. cout << (int)(j + 0.5) < endl;
  11. cout << (int)3.5 << end1;
  12. return 0;
  13. }

Select one or more:

a.On line 7 the output will be 2

b.On line 8 the output will be 1.6

c.On line 13 the output will be 3.5

d.On line 13 the output will be 3

e.On line 9 the output will be 3

f.On line 12 the output will be 4

g. On line 11 the output will be 0

Assume that you correct for minor compile-time errors. This program manipulates an array. Select the statements that are true

  1. #include
  2. using namespace std;
  3. int main() {
  4. const int SIZE = 4
  5. int mylist[SIZE]
  6. for(int b = 0; b < SIZE; b++) {
  7. mylist[b] = (b * 4) / 3 + 1
  8. cout < mylist[b] << " ";
  9. }
  10. cout < endl;
  11. for(int b = 0; b < SIZE; b++) {
  12. mylist[b] = b * mylist[b] + 2;
  13. cout < mylist[b] << " ";
  14. }
  15. cout << endl;
  16. return 0;
  17. }

Select one or more:

a. When the contents of the first array is printed, it will be 1 2 3 5.

b. When the contents of the second array is printed, it will be 2 4 8 17.

c. b on lines 15, 16 and 17 should be changed to i or a conflict will cause errors.

d. When the contents of the second array is printed, it will be 2 4 8 16.

e. The error on line 5 will cause line 6 to fail.

f. When the contents of the first array is printed, it will be 1 2 3 4.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions