Chapter 1 · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage
Azure Blob Storage – SDK, Properties and Metadata
20 practice questions · 5 marks weightage
Practice questions
- Question 1Q-8F69C3See the answer and solution
An ASP.NET Core application uploads a JPEG to Azure Blob Storage. The application must ensure that browsers and download clients recognize the blob as an image. Which configuration should be used during upload?
- A.new BlobUploadOptions { HttpHeaders = new BlobHttpHeaders { ContentType = "image/jpeg" } }
- B.new BlobUploadOptions { Metadata = new Dictionary<string, string> { ["ContentType"] = "image/jpeg" } }
- C.new BlobUploadOptions { Tags = new Dictionary<string, string> { ["ContentType"] = "image/jpeg" } }
- D.new BlobUploadOptions { Conditions = new BlobRequestConditions { IfNoneMatch = ETag.All } }
- Question 2Q-6ABE34See the answer and solution
A service needs to read a blob's custom metadata key named
departmentwithout downloading the blob contents. Which code correctly retrieves the metadata?- A.BlobProperties properties = await blob.GetPropertiesAsync(); string department = properties.Metadata["department"];
- B.BlobDownloadResult result = await blob.DownloadContentAsync(); string department = result.Value.Content.ToString();
- C.IReadOnlyDictionary<string, string> department = await blob.GetTagsAsync();
- D.string department = blob.Uri.Query["department"];
- Question 3Q-03CF7DSee the answer and solution
A blob already has metadata keys
departmentandretention. A job must add the metadata keyreviewedwhile preserving the existing keys. Which code performs this operation correctly?- A.await blob.SetMetadataAsync(new Dictionary<string, string> { ["reviewed"] = "true" });
- B.BlobProperties properties = await blob.GetPropertiesAsync(); var metadata = new Dictionary<string, string>(properties.Metadata); metadata["reviewed"] = "true"; await blob.SetMetadataAsync(metadata);
- C.await blob.SetTagsAsync(new Dictionary<string, string> { ["reviewed"] = "true" });
- D.await blob.SetHttpHeadersAsync(new BlobHttpHeaders { ContentType = "true" });
- Question 4Q-09643DSee the answer and solution
A catalog service needs to store an arbitrary business value named
departmenton each blob and also specify the blob's MIME type. Which classification is correct in the Azure Blob Storage .NET SDK?- A.
departmentis custom metadata, while the MIME type is set throughBlobHttpHeaders.ContentType. - B.Both
departmentand the MIME type must be stored as custom metadata. - C.
departmentis a blob tag, while the MIME type must be stored in the blob body. - D.
departmentis a system property, while the MIME type is stored as a blob tag.
- A.
- Question 5Q-356E9BSee the answer and solution
A .NET service uploads a JSON document and must set its content type and a custom metadata value during the upload. Which code correctly configures the upload?
- A.var options = new BlobUploadOptions { HttpHeaders = new BlobHttpHeaders { ContentType = "application/json" }, Metadata = new Dictionary<string, string> { ["source"] = "orders" } }; await blob.UploadAsync(stream, options);
- B.var options = new BlobUploadOptions { Tags = new Dictionary<string, string> { ["ContentType"] = "application/json", ["source"] = "orders" } }; await blob.UploadAsync(stream, options);
- C.await blob.SetMetadataAsync(new Dictionary<string, string> { ["ContentType"] = "application/json", ["source"] = "orders" }); await blob.UploadAsync(stream);
- D.await blob.UploadAsync(stream, new BlobUploadOptions { Metadata = new Dictionary<string, string> { ["ContentType"] = "application/json", ["source"] = "orders" } });
15 more questions on Azure Blob Storage – SDK, Properties and Metadata
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed