Software Development 1
19 Questions
2 Views

Software Development 1

Created by
@IndulgentPelican

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

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?

  • 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;

  • 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?

    <p>if (cost &gt; 12000) {</p> Signup and view all the answers

    What does SCM stand for?

    <p>Source Code Management</p> Signup and view all the answers

    What is Github?

    <p>A cloud-based web application for storing Git repositories and sharing with other developers</p> Signup and view all the answers

    What loop variation is recommended when the number of loop executions is known in advance?

    <p>Counter controlled variation</p> Signup and view all the answers

    What does GitLab provide as an alternative to Github?

    <p>A platform for collaboration and version control</p> Signup and view all the answers

    What is the purpose of a while-loop?

    <p>To execute a sequence of instructions multiple times</p> Signup and view all the answers

    What is the correct way to calculate architect's fee based on the cost of the building?

    <p>Both a and b</p> Signup and view all the answers

    What is the purpose of the 'if' statement in programming?

    <p>To execute code only when a boolean condition is true</p> Signup and view all the answers

    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));

    <p>To check if a discount is due based on the number of rental days</p> Signup and view all the answers

    What does the 'if-else' statement allow in programming?

    <p>Execution of one of two code blocks depending on a boolean condition</p> Signup and view all the answers

    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);

    <p>To calculate the wages based on standard and overtime hours</p> Signup and view all the answers

    What is the purpose of the 'discount' variable in the given code?

    <p>To store the amount of discount applied to the rental cost</p> Signup and view all the answers

    What is the purpose of the 'else' block in the 'if-else' statement?

    <p>To execute code when the boolean condition is false</p> Signup and view all the answers

    What does the 'if' statement do if the boolean condition is false and there is no 'else' block?

    <p>It does nothing and the program continues to the next statement</p> Signup and view all the answers

    What is the purpose of the 'cost' variable in the given code?

    <p>To store the total rental cost</p> Signup and view all the answers

    What is the purpose of the 'wages' variable in the given code?

    <p>To store the hourly wages</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser