C++ Institute CPA-21-02 Exam - Topic 2 Question 42 Discussion
What happens when you attempt to compile and run the following code?#include using namespace std;int main(){int *i;i = new int;*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;cout
C) It prints: 2
A) It prints: 0
B) It prints: 1
D) It prints: 0.5
C++ Institute CPA-21-02 Exam - Topic 2 Question 42 Discussion
Actual exam question for
C++ Institute's
CPA-21-02 exam
I remember something about integer division in C++. If I recall correctly, 1.0 / 2 would be treated as a double, but the result gets assigned to an int pointer.
Latia
9 months agoAltha
10 months agoAlana
10 months agoJamie
10 months agoBeckie
10 months agoMatilda
10 months agoJeffrey
11 months agoCory
11 months agoAlaine
11 months agoPhung
11 months agoOretha
12 months agoColby
12 months agoJesusa
12 months agoShantell
1 year agoKerrie
1 year agoBuddy
1 year agoMarylyn
1 year agoPearly
1 year agoLorriane
1 year agoWillodean
1 year agoDortha
1 year agoLorriane
1 year agoDortha
1 year ago