Question 1
pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 2;
float a = 3;
bool f1 = i > a, f2 = a > i, f3 = a / i > i / a;
if(f3)
if(f2)
i+=1;
else
i+=2;
else
if(f1)
i+=3;
else
i+=4;
cout << i << endl;
return 0;
}
1
0
2
3
Question 2
, pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 10;
float a = 1000.0;
while(i > 0) {
i /= 2;
a /= 10;
}
cout << a << endl;
return 0;
}
10
1
0.01
0.1
Question 3
pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 10;
pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 2;
float a = 3;
bool f1 = i > a, f2 = a > i, f3 = a / i > i / a;
if(f3)
if(f2)
i+=1;
else
i+=2;
else
if(f1)
i+=3;
else
i+=4;
cout << i << endl;
return 0;
}
1
0
2
3
Question 2
, pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 10;
float a = 1000.0;
while(i > 0) {
i /= 2;
a /= 10;
}
cout << a << endl;
return 0;
}
10
1
0.01
0.1
Question 3
pts
What is the output of the following program?
#include <iostream>
using namespace std;
int main(void) {
int i = 10;