Skip to content

Course home

Data structures

Data structures

EasyMedium
12345678910111213
Question 8

The incomplete C# program in Figure 1 is designed to write random terrain values to a 3-by-3 two-dimensional array representing a game map grid.

Complete the program by identifying the code that should be written in the five blank gaps.

Figure 1

1  string[,] mapGrid = new string[,] {{"", "", ""},
2                                     {"", "", ""},
3                                     {"", "", ""}};
4
5  int row = 0;
6  while (row < 3) {
7
8      int col = [ 1 ] ;
9      while (col < 3) {
10
11         mapGrid[ [ 2 ] , [ 3 ] ] = generateTerrain();
12
13         [ 4 ] ;
14     }
15
16     [ 5 ] ;
17 }
[5]
Markscheme

Data structures Questions

  1. GCSE
  2. /Computer Science
  3. /Data structures

36 exam-style questions on AQA GCSE Computer Science Data structures. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank