Computers and Technology, 07.04.2020 19:07 vickye146
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, and player2Move.
PROCEDURE playGame()
{
cards = []
REPEAT_UNTIL ( countFives(cards) >= 5 )
{
card1 = player1Move()
APPEND (cards, card1)
card2 = player2Move()
APPEND (cards, card2)
}
}
The procedure above simulates a certain card game called "fives" - played with two decks of cards - in which each player takes a turn playing a card, until 5 fives have been played in total, at which point it's "Game Over." The procedure uses a list called cards which is initially empty. Each round of play, two cards are appended to the list.
Here is the countFives procedure.
PROCEDURE countFives(cards)
{
count = 0
FOR EACH card IN cards
{
IF( card = 5 )
{
count = count+1
}
}
}
Which of the following should replace the at line 12 to make the procedure work as designed?
A. DISPLAY (count)
B. DISPLAY ("game over")
C. RETURN (count)
D. RETURN ("game over")
E. Nothing. Procedure works as is.
Answers: 3
Computers and Technology, 22.06.2019 07:30
By refraining from constructing a building until they are certain that it will not cause harm to the environment, an organization is adhering to the
Answers: 2
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
Computers and Technology, 24.06.2019 01:10
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates.json” file), in order of closest-to-farthest from the origin.
Answers: 1
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, an...
History, 15.03.2022 08:20
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
History, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Mathematics, 15.03.2022 08:30
Medicine, 15.03.2022 08:30