HOTSPOT - A company develops a series of mobile games.
All games use a single leaderboard service.
You have the following requirements: -> Code must be scalable and allow for growth.
-> Each record must consist of a playerId, gameId, score, and time played.
-> When users reach a new high score, the system will save the new score using the SaveScore function below.
-> Each game is assigned an Id based on the series title.
You plan to store customer information in Azure Cosmos DB.
The following data already exists in the database:
You develop the following code to save scores in the data store.
(Line numbers are included for reference only.)
You develop the following code to query the database.
(Line numbers are included for reference only.)
For each of the following statements, select Yes if the statement is true.
Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:
Box 1: Yes - Create a table.
A CloudTableClient object lets you get reference objects for tables and entities.
The following code creates a CloudTableClient object and uses it to create a new CloudTable object, which represents a table // Retrieve storage account from connection-string.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); // Create the table client.
CloudTableClient tableClient = storageAccount.createCloudTableClient(); // Create the table if it doesn't exist.
String tableName = "people"; CloudTable cloudTable = tableClient.getTableReference(tableName); cloudTable.createIfNotExists(); Box 2: No - New records are inserted with TableOperation.insert.
Old records are not updated.
To update old records TableOperation.insertOrReplace should be used instead.
Box 3: No - Box 4: Yes - Reference: https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-java.