Search Header Logo

Outcome3 Evidence1 PC3.1-PC3.3 A12[ASP]/51

Authored by Dima Zoaiter

Computers

12th Grade

Used 1+ times

Outcome3 Evidence1 PC3.1-PC3.3 A12[ASP]/51
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

PC3.1 Consider the following class, which uses the instance variable dollars to represent the money in a wallet in dollars.


The putMoneyInWallet method is intended to increase the dollars in the wallet by the parameter amount and then return the updated dollars in the wallet. Which of the following code segments should replace missing code so that the putMoneyInWallet method will work as intended?

amount += dollars;

return dollars;

dollars = amount;

return amount;

dollars += amount;

return dollars;

dollars = dollars + amount;

return amount;

amount = dollars + amount;

return dollars;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

PC3.1 Consider the Liquid class below.

The isBoiling() method is intended to return true if increasing the currentTemp by the parameter amount is greater than or equal to the boilingPoint, or otherwise return false.

Which of the following code segments can replace missing code to ensure that the isBoiling method works as intended?

if (currentTemp + amount > boilingPoint)

{

return true;

}

else

{

return false;

}

if (amount > currentTemp)

{

return false;

}

else

{

return currentTemp;

}

if (amount + currentTemp >= boilingPoint)

{

return true;

}

else

{

return false;

}

if (currentTemp + amount < boilingPoint)

{

return true;

}

else

{

return false;

}

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

PC3.1 Consider the following class definition. The calculatePizzaCostPerPerson method is intended to calculate the amount each person at the party must pay for pizza. The amount is equal to the total price of all the pizza boxes divided by the number of people at the party. Which of the following code segments should replace missing code so that the calculatePizzaCostPerPerson method will work as intended?

return numOfPeople * numOfBoxes * priceOfOnePizzaBox;

return (numOfBoxes * priceOfOnePizzaBox) / numOfPeople;

return (numOfBoxes + priceOfOnePizzaBox) / numOfPeople;

return numOfBoxes / priceOfOnePizzaBox / numOfPeople;

return numOfPeople / (numOfBoxes * priceOfOnePizzaBox);

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

PC3.2 Which of the following is considered a formal parameter; that is the identifier used in a method to stand for the value that is passed into the method by a caller?

balance

amount

bobsAccount

200

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

PC3.2 Which of the following is considered a actual parameter, that is the actual value that is passed into the method by a caller?

balance

amount

bobsAccount

200

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

PC3.2 Actual parameters in methods are often called __________________.

instance variables

arguments

local variables

global variables

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

PC3.3 Consider the following code segment:

public class Student

{

private static int lastAssignedStudentNum = 1500;

{ . . . }

}


Which of the following statements about this code is correct?

Each object created from this class will have its own lastAssignedStudentNum variable.

All objects created from this class will share the lastAssignedStudentNum variable.

The lastAssignedStudentNum variable's value cannot be changed.

You cannot assign a value to a static variable.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?