MCQs on Developing Azure Functions | Azure Functions MCQs Questions

Azure Functions is a serverless compute service offered by Microsoft Azure, enabling developers to execute code without provisioning servers. Chapter 3 focuses on creating and managing Azure Functions, understanding triggers, bindings, and durable functions, and exploring local development techniques. These Azure Functions MCQ questions and answers are designed to help IT professionals and students master the concepts and prepare for Azure certifications. Dive in to test your knowledge of HTTP triggers, bindings like Blob and Cosmos DB, state management with durable functions, and best practices for dependency injection and testing.


Multiple-Choice Questions (MCQs)

Creating Functions: HTTP Trigger, Timer Trigger, and Queue Trigger

  1. What is an HTTP trigger in Azure Functions?
    a) A trigger that runs on file changes
    b) A trigger that responds to HTTP requests
    c) A trigger that monitors Azure queues
    d) A trigger that executes based on time intervals
  2. Which Azure Function trigger is best for scheduling tasks?
    a) HTTP Trigger
    b) Timer Trigger
    c) Queue Trigger
    d) Event Hub Trigger
  3. What is required to configure a Queue Trigger in Azure Functions?
    a) Blob container name
    b) Queue name and storage account connection
    c) Service Bus connection string
    d) Cosmos DB account URI
  4. How does an Azure Timer Trigger define its schedule?
    a) Using a JSON file
    b) By specifying a CRON expression
    c) By setting environment variables
    d) Through the Azure portal UI only
  5. What is the default HTTP method supported by an HTTP-triggered function?
    a) POST
    b) GET
    c) Both GET and POST
    d) PUT

Input and Output Bindings: Blob, Cosmos DB, Service Bus, and Event Hubs

  1. What is the purpose of input bindings in Azure Functions?
    a) To trigger the function execution
    b) To fetch data from external sources
    c) To connect functions with Azure monitoring tools
    d) To enable cross-region deployments
  2. Which of these is NOT a valid output binding for Azure Functions?
    a) Blob Storage
    b) Cosmos DB
    c) SQL Server
    d) Redis Cache
  3. How do you connect an Azure Function to a Cosmos DB container?
    a) By specifying the database name in app settings
    b) Using a connection string in the bindings configuration
    c) By enabling Managed Identity
    d) Through manual endpoint configuration
  4. Which binding is commonly used for real-time streaming data?
    a) Blob Storage
    b) Service Bus
    c) Event Hubs
    d) Queue Storage
  5. What configuration file defines input and output bindings for an Azure Function?
    a) appsettings.json
    b) host.json
    c) local.settings.json
    d) function.json

Writing Durable Functions for State Management

  1. What is the main purpose of Durable Functions?
    a) To scale serverless functions automatically
    b) To provide long-running stateful workflows
    c) To optimize input/output bindings
    d) To integrate with Azure Logic Apps
  2. Which Durable Function pattern is used for managing a workflow with multiple steps?
    a) Fan-out/fan-in
    b) Async HTTP APIs
    c) Chaining
    d) Monitoring
  3. How is state preserved in a Durable Function?
    a) Using Azure Key Vault
    b) Through Azure Storage
    c) By enabling durable queues
    d) Using environment variables
  4. Which type of Durable Function is best for running parallel tasks?
    a) Orchestrator Function
    b) Activity Function
    c) Timer Function
    d) HTTP Trigger
  5. What language does the Durable Task Framework primarily use?
    a) Python
    b) C#
    c) JavaScript
    d) All supported Azure Functions languages

Dependency Injection in Azure Functions

  1. What is the benefit of dependency injection in Azure Functions?
    a) Reduces execution time
    b) Simplifies unit testing and promotes reusability
    c) Optimizes bindings performance
    d) Ensures cross-region deployment
  2. Which method registers services for dependency injection in Azure Functions?
    a) ConfigureAppSettings()
    b) ConfigureServices()
    c) AddFunctionsBindings()
    d) InitializeDependencies()
  3. Dependency injection is supported natively in which Azure Functions runtime version?
    a) Version 1.x
    b) Version 2.x and above
    c) Only in version 3.x
    d) All versions
  4. What is the correct lifecycle for injected dependencies in Azure Functions?
    a) Singleton
    b) Scoped
    c) Transient
    d) Per-function instance
  5. What library provides dependency injection support in Azure Functions?
    a) Azure.Functions.DependencyInjection
    b) Microsoft.Extensions.DependencyInjection
    c) Functions.DI.Core
    d) Azure.Services.Injector

Local Development and Testing Using Core Tools

  1. What tool is primarily used for local development of Azure Functions?
    a) Azure CLI
    b) Azure Functions Core Tools
    c) Visual Studio Code only
    d) Azure DevOps
  2. Which file stores local environment settings for Azure Functions?
    a) appsettings.json
    b) local.settings.json
    c) function.json
    d) host.json
  3. What command is used to start an Azure Function locally?
    a) az function start
    b) func start
    c) start-function-app
    d) run azure function
  4. How can you test Azure Functions locally using HTTP triggers?
    a) Using Azure Monitor
    b) By running the function and sending HTTP requests via Postman
    c) By deploying to a staging environment
    d) By using built-in Azure diagnostics
  5. What is required to debug Azure Functions locally?
    a) Azure subscription
    b) Local emulator
    c) IDE with debugging support and Core Tools
    d) Azure DevOps pipeline

Scenario-Based Questions

  1. An Azure Timer Trigger is failing to execute. What might be the cause?
    a) Incorrect CRON expression in configuration
    b) Unsupported runtime version
    c) Function not linked to an output binding
    d) Missing storage account
  2. A Blob Storage input binding fails to retrieve data. What should you check first?
    a) The size of the blob
    b) The storage account connection string
    c) The function runtime version
    d) The Azure portal logs
  3. You need to write a stateful workflow with retries. Which Azure Function type should you use?
    a) Durable Function
    b) Queue Trigger Function
    c) Timer Trigger Function
    d) HTTP Trigger Function
  4. You are developing an Azure Function locally. Which command ensures dependencies are installed?
    a) func init
    b) func install
    c) npm install or dotnet restore
    d) az function dependencies install
  5. How can you reduce the cold start time for Azure Functions?
    a) Use a premium plan or enable Always On
    b) Configure smaller function timeouts
    c) Minimize input bindings
    d) Increase the app service plan size

Answers

QNoAnswer
1b) A trigger that responds to HTTP requests
2b) Timer Trigger
3b) Queue name and storage account connection
4b) By specifying a CRON expression
5c) Both GET and POST
6b) To fetch data from external sources
7d) Redis Cache
8b) Using a connection string in the bindings configuration
9c) Event Hubs
10d) function.json
11b) To provide long-running stateful workflows
12c) Chaining
13b) Through Azure Storage
14a) Orchestrator Function
15d) All supported Azure Functions languages
16b) Simplifies unit testing and promotes reusability
17b) ConfigureServices()
18b) Version 2.x and above
19d) Per-function instance
20b) Microsoft.Extensions.DependencyInjection
21b) Azure Functions Core Tools
22b) local.settings.json
23b) func start
24b) By running the function and sending HTTP requests via Postman
25c) IDE with debugging support and Core Tools
26a) Incorrect CRON expression in configuration
27b) The storage account connection string
28a) Durable Function
29c) npm install or dotnet restore
30a) Use a premium plan or enable Always On

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top