Question
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.
- #include
- using namespace std;
- int main() {
- int b = 16, x = 10, y = 65536;
- float k = 10, j = 3.5;
- cout < (b / x) << endl;
- cout << (b / k) << endl;
- cout << (b / 10) << endl;
- cout << (int)((char)y) << endl;
- cout << (int)(j + 0.5) < endl;
- cout << (int)3.5 << end1;
- return 0;
- }
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
- #include
- using namespace std;
- int main() {
- const int SIZE = 4
- int mylist[SIZE]
- for(int b = 0; b < SIZE; b++) {
- mylist[b] = (b * 4) / 3 + 1
- cout < mylist[b] << " ";
- }
- cout < endl;
- for(int b = 0; b < SIZE; b++) {
- mylist[b] = b * mylist[b] + 2;
- cout < mylist[b] << " ";
- }
- cout << endl;
- return 0;
- }
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started