WorksheetsBattleship quiz
Total questions: 10
Worksheet time: 5mins
What data type is used to represent the game board?
List of lists
Dictionary
Tuple
Sets
Which function is responsible for displaying the board on the screen?
print_board()
create_board()
show_board()
see_board()
What does ["O"] * 5 create inside the create_board() function?
A string of "OOOOO"
A list with 5 elements, each "O"
A list with 1 element "O"
5 separate rows of "O"
What will random.randint(0, 4) return?
A random number between 0 and 5
A random number between 0 and 4 inclusive
A random number between 0 and 3
A random number between 1 and 4
What is the size of the game grid?
5 x 5
4 x 4
5 x 4
5 x 6
Which loop is used for giving the player multiple chances?
for
while
if else
switch
What happens if the player guesses the exact location of the ship?
The player wins and the loop breaks
The game continues with next loop
The player loses
None of these
Which message is shown if the player inputs coordinates outside the range 0–4?
"Oops, that’s not even in the ocean (out of range)!"
"You already guessed that spot!"
"Game Over!"
What is the purpose of len(board) in random_row(board)?
To count total rows in the board
To create a random column
To check if the board is empty
To reset the board
n the code, what does board[guess_row][guess_col] = "X" do?
Marks the guessed location with "X"
Removes the row
Moves the ship
Resets the board
