← Quiz: C++ Introduction: all 10 questions
Quiz: C++ Introduction · Question 1 of 10
What does this print? (code)
What does this print?
#include <iostream>
using namespace std;
int main() {
cout << 7 / 2 << " " << 7 / 2.0;
return 0;
}
- A.3.5 3.5
- B.3 3.5
- C.3 3
- D.4 3.5
Answer & explanation
Correct answer: 3 3.5
int / int is integer division (3); 7 / 2.0 is 3.5.
Can you get the rest right without peeking?
Take the timed Quiz: C++ Introduction quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →