Question 4
AQA Computer Science November 2020 Paper 2 (7517/2)A level10 marks
On the specification
- 4.1
- 3.9 Fundamentals of communication and networking
- 4.2
- 4.9 Fundamentals of communication and networking4.10 Fundamentals of databases
Question text
4 box An estate agency makes details of the properties that it has for sale available to potential customers through a website. The details of the properties and other data that are useful to the agency are stored in a relational database. The individual web pages about specific properties that a customer can view are generated dynamically by a program from the data in the database. A client-server system, which uses CRUD and REST, is used to provide details of properties in a web page that is being viewed in a web browser on a client computer. Figure 3 shows the structure of the relations in the database. Figure 3 Property(PropertyID, HouseNum, Street, Area, Postcode, Bedrooms, Bathrooms, AskingPrice, SellerID) Seller(SellerID, Title, Forename, Surname, Telephone) Buyer(BuyerID, Title, Forename, Surname, Telephone, DesiredArea, MinBedrooms, MaxPrice) Viewing(BuyerID, PropertyID, ViewingDate, ViewingTime) Sale(SaleID, PropertyID, BuyerID, SalePrice) • The Property relation stores details of the properties that are for sale. This includes the number of bedrooms and the number of bathrooms that a property has. • The Seller relation stores details of people who are selling the properties. • The Buyer relation stores details of the people who are looking to buy a property and information about the type of property they want, including the area that they want to live in, the minimum number of bedrooms that they need in a property and the maximum price that they are prepared to pay. • An entry is made in the Viewing relation whenever a buyer arranges to look at a property. • An entry is made in the Sale relation whenever a property is sold to a buyer. The SalePrice may be different to the AskingPrice for the property. 4.1 The list below contains four statements about the principles of CRUD and REST. One of these statements is false. Shade one lozenge to indicate which statement is false. [1 mark] A CRUD is an acronym for Create, Retrieve, Update, Delete. REST allows JavaScript to communicate with the server using the HTTP B protocol. C The database is connected to the web browser using REST. D The REST API will be created and run on the client computer. An SQL query is executed to retrieve some details about properties with at least four box bedrooms in a particular area. The following two records are found: PropertyID HouseNum Street Bedrooms 8026 12 Chester Drive 4 9034 23a Castle Street 5 These records could be sent from the server to the client using XML or JSON. Figure 4 shows the query results encoded using each of these methods. Figure 4 Representation 1 Representation 2 {"Properties":[ <Properties> { "PropertyID": 8026, <Property> "HouseNum": "12", <PropertyID>8026</PropertyID> "Street": "Chester Drive", <HouseNum>12</HouseNum> "Bedrooms": 4 }, <Street>Chester Drive</Street> { "PropertyID": 9034, <Bedrooms>4</Bedrooms> "HouseNum": "23a", </Property> "Street": "Castle Street", <Property> "Bedrooms": 5 } <PropertyID>9034</PropertyID> ]} <HouseNum>23a</HouseNum> <Street>Castle Street</Street> <Bedrooms>5</Bedrooms> </Property> </Properties> 4.2 Shade one lozenge to identify the method of encoding used by Representation 2. [1 mark] A JSON B XML 4.3 State two reasons why it could be argued that JSON is better than XML. [2 marks] Reason 1 Reason 2 4 4 box . A composite primary key has been selected for the Viewing relation. This consists of the attributes BuyerID, PropertyID and ViewingDate. In selecting these attributes to form the primary key, what assumption has the database designer made about the behaviour of the buyers? [1 mark] Figure 3 is repeated below so that you can answer Question 04.5 without having to turn back in the question paper. Figure 3 Property(PropertyID, HouseNum, Street, Area, Postcode, Bedrooms, Bathrooms, AskingPrice, SellerID) Seller(SellerID, Title, Forename, Surname, Telephone) Buyer(BuyerID, Title, Forename, Surname, Telephone, DesiredArea, MinBedrooms, MaxPrice) Viewing(BuyerID, PropertyID, ViewingDate, ViewingTime) Sale(SaleID, PropertyID, BuyerID, SalePrice) 4.5 Write an SQL query that will retrieve from the database the list of all properties that the buyer with BuyerID 23 might be interested in buying. The properties should: • be in the buyer’s desired area • have at least the minimum number of bedrooms the buyer requires • cost no more than the maximum price that the buyer is prepared to pay. The list of properties returned should only include, for each property, the following details: • the PropertyID • the street that the property is on • the number of bedrooms that the property has • the asking price for the property. The list should be ordered with the most expensive property at the top of the list and the least expensive at the bottom of the list. [5 marks]