0% found this document useful (0 votes)
8 views

Air and Environment

The document outlines the structure of a database table named Contract for a television subscription service, detailing its fields and their appropriate data types. It also includes SQL statements for querying the database and describes a one-player game using a 2D array to locate a secret cell. The document requires the completion of SQL statements and the writing of a program to meet specified game requirements.

Uploaded by

FahadImranXhiekh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Air and Environment

The document outlines the structure of a database table named Contract for a television subscription service, detailing its fields and their appropriate data types. It also includes SQL statements for querying the database and describes a one-player game using a 2D array to locate a secret cell. The document requires the completion of SQL statements and the writing of a program to meet specified game requirements.

Uploaded by

FahadImranXhiekh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

1.

2.
3

4.
5.
6.
7.

8.
9.

10.
11.

12.
13.

14.
15.

16
17.
18.

19
20.
1 A television subscription service has a new database table named Contract to store details of
their subscribers’ contracts. The table contains these fields:

• ContractNumber – the contract number, for example CT567


• Months – the length of the contract in months, for example 6
• EndDate – the date the contract finishes, for example 30 November 2024
• News – the news service, yes or no
• Movie – the movie service, yes or no
• Sport – the sports service, yes or no
• Junior – the children’s service, yes or no.

(a) Identify the field that will be the most appropriate primary key for this table.

............................................................................................................................................. [1]

(b) Complete the table to identify the most appropriate data type for these fields in Contract

Field Data type

ContractNumber

Months

EndDate

Sport

[2]

(c) Explain the purpose of these structured query language (SQL) statements.

Statement 1: SELECT SUM (Months) FROM Contract;

Statement 2: SELECT COUNT (News) FROM Contract WHERE News;

Statement 1 ..............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Statement 2 ..............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]
(d) Complete this SQL statement to find the contract numbers of the subscribers that take both
the news and sports services.

SELECT .....................................................................................................................................

FROM Contract

WHERE .......................................................... AND ................................................................. ;


[2]
2 A one-player game uses the two-dimensional (2D) array Grid[] to store the location of a secret
cell to be found by the player in 10 moves. Each row and column has 5 cells.

Start
Grid[1,1]

At the start of the game:

• The program places an ‘X’ in a random cell (not in Grid[1,1]) and empties all the other
cells in the grid.
• The player starts at the top left of the grid.
• The player has 10 moves.

During the game:

• The player can move left, right, up or down by one cell and the move must be within the grid.
• “You Win” is displayed if the player moves to the cell with ‘X’ and has played 10 moves or
less.
• “You Lose” is displayed if the player has made 10 moves without finding the ‘X’.

Write a program that meets these requirements.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays or variables; you may assume that this has already been
done.

All inputs and outputs must contain suitable messages.

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

.................................................................................................................................................. [15]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy