WorksheetsText Adventure Game Functions Quiz - Part 1
Total questions: 40
Worksheet time: 20mins
What happens when you try to move in a direction where CurrentPlace.Direction is equal to 0?
The CurrentLocation is updated to CurrentPlace.Direction
A message "The door is closed." is printed
A message "You are not able to go in that direction." is printed
The function DisplayContentsOfContainerItem is called
What does the function DisplayContentsOfContainerItem do if an item's location matches the ContainerID?
It prints the name of the item without a comma.
It prints "The door is open."
It prints the name of the item with a comma if it's not the first item.
It changes the value of Moved to False.
What will the function Examine(Items, Characters, ItemToExamine, CurrentLocation) return if ItemToExamine is "inventory"?
The description of the item to examine
The current location of the character
The inventory list
An error message
What does the function GetPositionOfCommand(CommandList, Command) do?
It returns the position of the command in the command list
It prints the command
It deletes the command from the command list
It executes the command
What will happen if the Examine function is called with an ItemToExamine that is neither "inventory" nor an item in the current location?
It will return the inventory list
It will print the item's description
It will return the description of a character
It will print "You cannot find
What does the function 'ChangeLocationOfItem' do?
It changes the name of an item in the Items list.
It changes the location of an item in the Items list.
It changes the status of an item in the Items list.
It generates a random number.
What is the purpose of the 'getRandomNumber' function?
It changes the status of an item.
It rolls a dice to get a number between 1 and 6.
It returns a random number between the LowerLimitValue and UpperLimitValue.
It changes the location of an item.
What is the return value of the function 'ChangeStatusOfDoor' when the current location is the same as the location of the 'IndexOfOtherSideItemToLockUnlock'?
The new status of the door.
The new location of the door.
The current location of the door.
True or False depending on whether the door's status was changed.
What will the 'rollDice' function do if the user inputs non-numeric values for Lower and Upper?
It will return a random number without any validation.
It will prompt the user to enter the minimum and maximum again until valid numbers are provided.
It will change the status of an item.
It will exit the program.
What is the purpose of the ChangeStatusOfItem function in the provided code snippet?
To update the game score
To change the status of an item from "locked" to "close" or vice versa
To print messages to the console
To stop the game
What happens when the UseItem function is called with an item that is not in the INVENTORY or at the CurrentLocation and marked as "usable"?
The item's status is changed to "locked"
The item's status is changed to "close"
A message is printed saying the item can't be used in this location
The game is stopped
What does the GetPositionOfCommand function likely return?
The index of the item to use
The current location of the player
The position of a command within an item's command list
The status of an item
What is the expected behavior when the SubCommand "roll" is executed within the UseItem function?
The game is stopped
The status of an item is changed
A message is printed with the result of a dice roll
The inventory is updated
What is the purpose of the GetIndexOfItem function in the provided code snippet?
To determine the current location of an item
To extract the result for a command
To find the index of an item in the Items list
To check if an item is in the inventory
What happens if the 'read' command is not in the Items[IndexofItem].Commands list?
The function will return the position of the command
The item will be added to the inventory
An error message "You can't read + ItemToRead + ." will be printed
The function will execute the 'say' subcommand
What condition must be met for the CanGet variable to be set to True in the GetItem function?
The item must be located at the MINIMUM_ID_FOR_ITEM
The item must not be in the inventory and must have the 'get' command
The item must be in the current location and not in the inventory
The item must have the 'win' subcommand
What does the function CheckIfDiceGamePossible return if both players are in the same room and the other character has a die?
(True, IndexOfPlayerDie, IndexOfOtherCharacter, IndexOfOtherCharacterDie)
(False, IndexOfPlayerDie, IndexOfOtherCharacter, IndexOfOtherCharacterDie)
(True, -1, -1, -1)
(False, -1, -1, -1)
What is the purpose of the function TakeItemFromOtherCharacter?
To print the items that the player has in their inventory
To check if a dice game is possible between characters
To allow a player to take an item from another character's inventory
To move an item from the player's inventory to another character
What happens when the 'gettable' status of an item is True in the function CheckForDiceGamePossible?
The item's location is changed to INVENTORY and a message is printed
The game is won by the player
The item is removed from the game
Nothing, the status is not checked in this function
What is the purpose of the function TakeRandomItemFromPlayer in the provided code snippet?
To add an item to the player's inventory
To remove a random item from the player's inventory and give it to another character
To check if a dice game is possible
To print the items in the player's inventory
What happens if the condition if DiceGamePossible: evaluates to False in the PlayDiceGame function?
The function returns the items list
The function prints "You can't play a dice game."
The function takes an item from the other character
The function rolls a die for the player
What does the RollDie function return based on its usage in the PlayDiceGame function?
The position of the command in the items list
The score of the dice roll
The name of the item taken from the player
The ID of the other character
What is the outcome if PlayerScore > OtherCharacterScore after both players have rolled their dice in the PlayDiceGame function?
The player loses an item
The player wins and takes an item from the other character
The game ends in a draw
The other character wins and takes an item from the player
What will the function DisplayInventory(Items) print if an item's location is INVENTORY?
The item's name
You can't move ItemToMove.
You can't find ItemToMove.
On the floor there is: Thing.Name
What happens when the MoveItem function is called with an item that has a location different from CurrentLocation?
It prints "You can't move " + ItemToMove + "."
It prints the item's name
It adds the item to the inventory
It prints "You can't find " + ItemToMove + "."
What does the function DisplayGettableItemsInLocation do if there are no gettable items in the current location?
It prints the names of all items in the location
You are currently carrying the following items:
It prints nothing
On the floor there is:
What condition must be met for an item to be included in the list created by the function DisplayGettableItemsInLocation?
The item's location must be INVENTORY
The item must have "gettable" in its status and be in the current location
The item must have "say" in its commands
The item must have more than 4 commands
What is the purpose of the DisplayOpenCloseMessage function in the provided code snippet?
To start or stop the game
To move the character to a different location
To display a message based on the result of an open or close action
To read an item's description
What will happen if the 'Command' variable is set to "get" within the PlayGame function?
The game will stop
An item will be used
The character will move to a different location
An item will be retrieved
Which command will result in the character's movement within the PlayGame function?
"use"
"go"
"read"
"examine"
If the ResultOfOpenClose variable is -1, what message will be displayed by the DisplayOpenCloseMessage function?
"You have opened it."
"You have closed it."
"You can't do that, it is locked."
"You can't open that."
What is the purpose of the 'LoadGame' function in the provided code snippet?
To save the current state of the game
To load the saved state of the game from a file
To start a new game
To update the game's graphics
Which Python module is used for serializing and deserializing objects in the given code?
json
csv
pickle
xml
What happens if an exception occurs during the execution of the 'LoadGame' function?
The game will restart
The function will return False
The exception will be printed to the console
The function will silently ignore the exception
What is the expected type of the 'Filename' parameter in the 'LoadGame' function?
Integer
List
String
Dictionary
Based on the code, what is the correct order of loading the game components in the 'LoadGame' function?
Characters, Items, Places
Places, Items, Characters
Items, Characters, Places
Characters, Places, Items
What is the correct file extension appended to the filename in the input prompt within the Main() function?
.txt
.exe
.gme
.py
What will be printed if the game fails to load?
Game loaded successfully.
Unable to load game.
Error in game loading.
Game not found.
Which function is called within the Main() function to start the game after it is successfully loaded?
StartGame
PlayGame
RunGame
InitGame
What is the purpose of the if __name__ == "__main__": statement?
To define a new function
To import a module
To check if the script is being run as the main program
To declare a class
