Software Development 1

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

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) { (B)</p> Signup and view all the answers

What does SCM stand for?

<p>Source Code Management (C)</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 (B)</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 (D)</p> Signup and view all the answers

What does GitLab provide as an alternative to Github?

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

What is the purpose of a while-loop?

<p>To execute a sequence of instructions multiple times (B)</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 (C)</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 (C)</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 (B)</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 (B)</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 (B)</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 (B)</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 (B)</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 (B)</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 (D)</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 (B)</p> Signup and view all the answers

Flashcards are hidden until you start studying

Related Documents

6-Consolidation.pptx

More Like This

Use Quizgecko on...
Browser
Browser