Create server-side programming constructs in Azure Cosmos DB SQL API Microsoft Quiz Answers

Get Create server-side programming constructs in Azure Cosmos DB SQL API Microsoft Quiz Answers

Use JavaScript to author server-side stored procedures, user-defined functions, and triggers.

This learning path helps prepare you for Exam DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB.

Prerequisites:

Before starting this learning path, you should have experience of building cloud applications with Microsoft C# or a similar programming language.

Enroll on Microsoft

Module 1: Build multi-item transactions with the Azure Cosmos DB SQL API

Author stored procedures using JavaScript in Azure Cosmos DB SQL API.

Learning objectives:

After completing this module, you’ll be able to:

  • Author stored procedure
  • Rollback stored procedure transactions

Prerequisites:

Before starting this module, you should have experience of building cloud applications with Microsoft C# or a similar programming language.

Quiz 1: Knowledge check

Q1. At the end of your stored procedure, you would like to set the HTTP response to a static string of Test. Which line of JavaScript code should you use to accomplish this task?

  • context.getResponse().setBody('Test');
  • context.setBody('Test');
  • context.getCollection().setBody('Test');

Q2. You’re authoring a stored procedure in JavaScript and would like to manually roll back a transaction in your code for a certain condition. Which line of code should you use to roll back a transaction?

  • getContext().rollback();
  • throw new Error();
  • return;

Q3. Your code contains a variable of type Microsoft.Azure.Cosmos.Container named container and another variable of type Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties named props. Which code block below would asynchronously create a new stored procedure using the two variables?

  • await container.StoredProcedures.CreateStoredProcedureAsync(props);
  • await container.CreateStoredProcedureAsync(props);
  • await container.Scripts.CreateStoredProcedureAsync(props);

Q4. Your stored procedure creates three items with three distinct unique identifiers and logical partition key values. When running your stored procedure, you encounter an error. What is the cause for this error?

  • Stored procedures are scoped to only a single item
  • Stored procedures are scoped to only a single logical partition
  • Stored procedures are scoped to only a single unique identifier

Module 2: Expand query and transaction functionality in Azure Cosmos DB SQL API

Author user-defined functions and triggers using JavaScript in Azure Cosmos DB SQL API.

Learning objectives:

After completing this module, you’ll be able to:

  • Create user-defined functions
  • Create triggers

Prerequisites:

Before starting this module, you should have experience of building cloud applications with Microsoft C# or a similar programming language.

Quiz 1: Knowledge check

Q1. You have authored a user-defined function named addTax. You are writing a SQL query to return a flat array of scalar price values with the calculated tax value. Which valid SQL query should you use for this task?

  • SELECT VALUE addTax(p.price) FROM products p
  • SELECT VALUE udf.addTax(p.price) FROM products p
  • SELECT VALUE p.price.addTax() FROM products p

Q2. You are tasked with taking the date values that are stored in a container, and converting them to a company-specific date format in SQL query results. Which server-side programming construct should you use for this task?

  • User-defined function
  • Pre-trigger
  • Post-trigger

Q3. Your team has written validation logic in JavaScript to make sure items are in your required format before committing them to a container. Which server-side programming construct should you use for this task?

  • User-defined function
  • Pre-trigger
  • Post-trigger

Q4. Your team has created a set of aggregate metadata items that are required to be modified anytime you successfully create or update an item within your container. Which server-side programming construct should you use for this task?

  • User-defined function
  • Pre-trigger
  • Post-trigger
Conclusion:

I hope this Create server-side programming constructs in Azure Cosmos DB SQL API Microsoft Quiz Answers would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *