Practice C++ output basics with beginner-friendly questions on cout, variables, arithmetic expressions, and predicting console output in simple programs.
Task: Predict the output.
int x = 10;
if (x > 5)
cout << "Yes";
Task: Predict the output.
int x = 3;
if (x > 5)
cout << "A";
cout << "B";
Task: Predict the output.
int n = 8;
if (n % 2 == 0)
cout << "Even";
else
cout << "Odd";
Task: Predict the output.
int x = 12;
if (x >= 12)
cout << "Pass";
else
cout << "Fail";
Task: Predict the output.
int x = 5;
if (x != 5)
cout << "A";
else
cout << "B";
cout << "C";
Task: Predict the output.
int x = 10;
if (x > 5)
{
cout << "A";
cout << "B";
}
else
{
cout << "C";
}
cout << "D";
Task: Predict the output.
int marks = 45;
if (marks >= 50)
cout << "Pass";
else
cout << "Fail";
cout << "!";