🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
}
  1. A.3.5 3.5
  2. B.3 3.5
  3. C.3 3
  4. 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 →