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
5 months agoAltha
5 months agoAlana
6 months agoJamie
6 months agoBeckie
6 months agoMatilda
6 months agoJeffrey
7 months agoCory
7 months agoAlaine
7 months agoPhung
7 months agoOretha
7 months agoColby
8 months agoJesusa
8 months agoShantell
8 months agoKerrie
9 months agoBuddy
9 months agoMarylyn
10 months agoPearly
10 months agoLorriane
10 months agoWillodean
10 months agoDortha
10 months agoLorriane
10 months agoDortha
11 months ago