wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Battleship quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What data type is used to represent the game board?

a)

List of lists

b)

Dictionary

c)

Tuple

d)

Sets

2.

Which function is responsible for displaying the board on the screen?

a)

print_board()

b)

create_board()

c)

show_board()

d)

see_board()

3.

What does ["O"] * 5 create inside the create_board() function?

a)

A string of "OOOOO"

b)

A list with 5 elements, each "O"

c)

A list with 1 element "O"

d)

5 separate rows of "O"

4.

What will random.randint(0, 4) return?

a)

A random number between 0 and 5

b)

A random number between 0 and 4 inclusive

c)

A random number between 0 and 3

d)

A random number between 1 and 4

5.

What is the size of the game grid?

a)

5 x 5

b)

4 x 4

c)

5 x 4

d)

5 x 6

6.

Which loop is used for giving the player multiple chances?

a)

for

b)

while

c)

if else

d)

switch

7.

What happens if the player guesses the exact location of the ship?

a)

The player wins and the loop breaks

b)

The game continues with next loop

c)

The player loses

d)

None of these

8.

Which message is shown if the player inputs coordinates outside the range 0–4?

a)

"Oops, that’s not even in the ocean (out of range)!"

b)

"You already guessed that spot!"

c)

"Game Over!"

9.

What is the purpose of len(board) in random_row(board)?

a)

To count total rows in the board

b)

To create a random column

c)

To check if the board is empty

d)

To reset the board

10.

n the code, what does board[guess_row][guess_col] = "X" do?

a)

Marks the guessed location with "X"

b)

Removes the row

c)

Moves the ship

d)

Resets the board