Search⌘ K

Quiz

Evaluate your knowledge of C++ conditional statements through this quiz. It helps reinforce what you've learned and prepares you to progress confidently to loops.

We'll cover the following...
Technical Quiz
1.

What is the output of the code given below?

int main() {
  int cost_price = 1000;
  int sale_price = 5000;
  int profit;
  profit = sale_price - cost_price;
  if (profit > 0) {
    cout << "You have made a profit";
  } else {
    cout << "You have not made a profit";
  }
}
    
A.

You have made a profit

You have not made a profit

B.

You have not made a profit

You have made a profit

C.

You have not made a profit

D.

You have made a profit


1 / 7

šŸŽ‰Congratulations! You ...