Advertisement
There are 6 different answer option(s) of this question, please select the right option(s).
float values[5]={0.54f, 2.71828f, 3.14159f, 5.499999f, 10.0f};
for(auto f:values)
printf(“%i “,(int)(f+0.5f));
- 0.54 2.71828 3.14159 5.499999 10.0
- 1 3 4 6 11
- 0 2 3 5 10
- 1 3 3 5 10
or
#include <iostream>
int main(){
int x=10, y=20;
std::cout << “x = ” << x++ << ” and y = ” << –y << std::endl;
std::cout << “x = ” << x– << ” and y = ” << ++y << std::endl;
return(0);
}
- x = 10 and y = 20
x = 11 and y = 19 - x = 11 and y = 19
x = 10 and y = 20 - x = 10 and y = 19
x = 11 and y = 20 - x = 11 and y = 20
x = 10 and y = 19
or
int c=3; char d=’A’;
std::printf(“c is %d and d is %c”,c,d);
- c is d and d is c
- c is A and d is 3
- c is 3 and d is A
- c is c and d is d
or
printf(“1/2 = %f”,(float)(1/2));
- 1/2 = 0.499999
- 1/2 = 0
- 1/2 = 0.000000
- 1/2 = 0.5
or
#include <cstdio>
using namespace std;
int main(){
char c = 255;
if(c>10)
printf(“c = %i, which is greater than 10”, c);
else
printf(“c = %i, which is less than 10”, c);
return 0;
}
- c = -1, which is less than 10
- c = 255, which is greater than 10
- c = -1, which is greater than 10
- c = 255, which is less than 10
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.