Podcast
Questions and Answers
What is the correct syntax for checking if the number of overtime hours exceeds 10?
What is the correct syntax for checking if the number of overtime hours exceeds 10?
- if (overtime = 10) {
- if (overtime > 10) { (correct)
- if (overtime < 10) {
- if (overtime => 10) {
What message will be printed if both users are not feeling great in the given scenario?
What message will be printed if both users are not feeling great in the given scenario?
- looks like neither of us is great (correct)
- both of us are great
- one of us is great
- Neither of the above
What is the correct way to calculate tax based on deposits according to the given scenario?
double balance = Console.getDouble(“Balance £ ”);
double deposits = Console.getDouble(“Deposits £ ”);
double withdrawals = Console.getDouble(“Withdrawals £ ”);
double tax = 0.0;
What is the correct way to calculate tax based on deposits according to the given scenario? double balance = Console.getDouble(“Balance £ ”); double deposits = Console.getDouble(“Deposits £ ”); double withdrawals = Console.getDouble(“Withdrawals £ ”); double tax = 0.0;
- tax = (deposits / 100) + 1000;
- tax = (deposits - 1000) / 100 * 1;
- tax = (deposits / 100) - 1000;
- tax = (deposits - 1000) / 100 * 0.5; (correct)
What is the correct syntax for checking the cost and calculating fees based on the given scenario?
What is the correct syntax for checking the cost and calculating fees based on the given scenario?
What does SCM stand for?
What does SCM stand for?
What is Github?
What is Github?
What loop variation is recommended when the number of loop executions is known in advance?
What loop variation is recommended when the number of loop executions is known in advance?
What does GitLab provide as an alternative to Github?
What does GitLab provide as an alternative to Github?
What is the purpose of a while-loop?
What is the purpose of a while-loop?
What is the correct way to calculate architect's fee based on the cost of the building?
What is the correct way to calculate architect's fee based on the cost of the building?
What is the purpose of the 'if' statement in programming?
What is the purpose of the 'if' statement in programming?
In the given code, what is the purpose of the 'if' statement?
int rentalDays = Console.getInt(“Number of rental days: ”);
// Calculate the cost when each day costs £55
double cost = rentalDays * 55.0;
// check if discount due
if (rentalDays >= 7) {
double discount = cost / 100 * 25;
cost = cost – discount;
}
System.out.println(“Rental Cost £ “ + String.format(”%.2f”,cost));
In the given code, what is the purpose of the 'if' statement?
int rentalDays = Console.getInt(“Number of rental days: ”);
// Calculate the cost when each day costs £55 double cost = rentalDays * 55.0; // check if discount due if (rentalDays >= 7) { double discount = cost / 100 * 25; cost = cost – discount; } System.out.println(“Rental Cost £ “ + String.format(”%.2f”,cost));
What does the 'if-else' statement allow in programming?
What does the 'if-else' statement allow in programming?
In the given code, what is the purpose of the 'if-else' statement? double SRATE = 10.0, ORATE = 15.0;
int standard = Console.getInt(“Number of standard hours: ”);
int overtime = Console.getInt(“Number of overtime hours: ”);
double wages = standard * SRATE; // calculate standard wages
// calculate overtime (only allowed up to 10 hours overtime)if (overtime > 10) {
wages = wages + (10 * ORATE);
} else {
wages = wages + (overtime * ORATE);
In the given code, what is the purpose of the 'if-else' statement? double SRATE = 10.0, ORATE = 15.0; int standard = Console.getInt(“Number of standard hours: ”); int overtime = Console.getInt(“Number of overtime hours: ”); double wages = standard * SRATE; // calculate standard wages // calculate overtime (only allowed up to 10 hours overtime)if (overtime > 10) { wages = wages + (10 * ORATE); } else { wages = wages + (overtime * ORATE);
What is the purpose of the 'discount' variable in the given code?
What is the purpose of the 'discount' variable in the given code?
What is the purpose of the 'else' block in the 'if-else' statement?
What is the purpose of the 'else' block in the 'if-else' statement?
What does the 'if' statement do if the boolean condition is false and there is no 'else' block?
What does the 'if' statement do if the boolean condition is false and there is no 'else' block?
What is the purpose of the 'cost' variable in the given code?
What is the purpose of the 'cost' variable in the given code?
What is the purpose of the 'wages' variable in the given code?
What is the purpose of the 'wages' variable in the given code?
Flashcards are hidden until you start studying