Question
3) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127
3)
What are the final values of a,
b, c in the following code fragment (1.5 point):
int a =
6
, b =
127
, c;
c =
(
++a
)
+ (
b
--
);
Answer:
4)
What are the final values of a,
b, c in
the following code fragment (1.5 point):
int a =
6
, b =
127
, c;
c = (a++) + (
--
b);
Answer:
5)
What is displayed by this poorly indented program fragment
(1 point)
int number =
128
,
alpha =
-
320
;
if (number > 0)
if (alpha > 0)
cout
<< One << endl;
else cout << Two << endl;
cout << Three << endl;
6)
Consider the following program fragment:
int x;
cout << "Enter an integer: ";
cin >> x;
if (x >
92
) {
cout << x +
4
<< endl;
}
else {
cout << x << endl;
if
(x <
48
) {
cout << x
-
10
<< endl;
}
else {
cout << x
+
10
<< endl;
}
cout << x << endl;
}
6.1)
Show all messages displayed by the program if the user enters
200
for x? (1 point)
Answer:
6.2)
Same question if the user enters
70
for x?
(1 point)
Answer:
6.3)
Same question if the user enters
0
for x?
(1 point)
Answer
(Please answer 3 - 6)
thanks)
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