Industry 4.0 / IIoT Software Engineer — Interview Questions
In short: The fourth industrial revolution: connecting machines, products, people and IT systems through IIoT, cloud/edge computing, data analytics and AI so factories become transparent, flexible and self-optimising.
- It builds on the automation of Industry 3.0 (PLCs, IT) by adding connectivity and data-driven decisions — e.g. real-time OEE, predictive maintenance, full traceability and digital twins.
In short: Industrial IoT connects industrial equipment — sensors, PLCs, machines — to collect and use data.
- Compared with consumer IoT it demands higher reliability, determinism and safety, works with industrial protocols (OPC UA, Modbus, PROFINET), runs in harsh environments with long equipment lifetimes (20+ years, brownfield machines), and has stricter security and uptime requirements.
In short: Overall Equipment Effectiveness = Availability × Performance × Quality.
- Availability = run time ÷ planned time; Performance = (ideal cycle time × total count) ÷ run time; Quality = good count ÷ total count.
- Example: 87.5 % × 90.5 % × 95 % ≈ 75 %.
- It shows how much of planned time is truly productive and which loss to attack first.
In short: MES executes and tracks production on the shop floor in real time — orders dispatched to lines, data collection, quality, traceability, OEE, work instructions.
- ERP manages the business — finance, purchasing, inventory, sales, planning over days/weeks.
- ISA-95 defines the integration: ERP sends orders and receives production confirmations and consumption from MES.
In short: A lightweight publish/subscribe protocol over TCP with a broker.
- Small overhead, works on unreliable networks, decouples producers from consumers, supports QoS levels, retained messages, last will (detect offline devices) and persistent sessions;
- easy to secure with TLS and certificates;
- all clouds support it.
- Sparkplug B adds a standard namespace, payload format and state management for industrial use.
In short: QoS 0 — at most once, fire-and-forget, may be lost.
- QoS 1 — at least once, acknowledged, may be duplicated (consumers must be idempotent).
- QoS 2 — exactly once via a four-step handshake, slower.
- Telemetry usually uses 0 or 1; commands and important events use 1 with idempotency or 2.
In short: OPC UA is a full industrial interoperability standard — rich information models, browse/read/write/subscribe/methods, built-in security — ideal for connecting to machines and controllers.
- MQTT is a lightweight transport for pub/sub distribution of data to many consumers and to the cloud.
- Common pattern: OPC UA at the machine/edge, MQTT (or OPC UA PubSub over MQTT) from the edge to the enterprise/cloud.
In short: Processing data close to the machines on gateways or industrial PCs.
- Needed for low-latency decisions, operation when the network or cloud is down (store-and-forward), reducing bandwidth by filtering/aggregating high-frequency data, protocol translation, and keeping sensitive OT networks closed while sending only outbound data.
In short: Collect condition data (vibration, temperature, current, pressure, cycles) plus maintenance and failure history, engineer features (RMS, spectral peaks, trends), train anomaly-detection or remaining-useful-life models, deploy them at the edge or cloud, and turn predictions into alerts and CMMS work orders.
- Success needs domain experts, enough failure examples (or anomaly detection when rare), and a feedback loop measuring avoided downtime and false alarms.
In short: Edge per line reads machine state, counts and reject signals via OPC UA/Modbus, timestamps in UTC and publishes state changes to MQTT/IoT Hub.
- A stream processor or .NET consumer maintains current state per line, accumulates run/down time by reason and counts, stores events in a time-series/SQL store and shift summaries in SQL.
- An ASP.NET Core API + SignalR pushes live updates to an Angular/React dashboard (andon view, OEE gauges, downtime Pareto).
- Operators enter downtime reasons on a tablet.
- Handle shift calendars, planned stops, ideal cycle times per product, and offline buffering.
In short: Retrofit: add sensors (current clamps for run/stop, vibration sensors, photo-eyes or counters for parts), read existing PLC I/O through gateways or protocol converters (serial Modbus → TCP), or use IO-Link and small edge devices.
- Start with simple, high-value signals (running/stopped, count, reject) to get OEE and downtime, then add condition monitoring.
- Keep the machine's safety and control untouched; document and secure the new connections.
In short: Performance above 100 % means the ideal cycle time is wrong (too slow) or counts are inflated — wrong ideal cycle time for the running product, product not switched in the system at changeover, double counting from sensor bounce (needs debounce/edge detection), counting rejects twice, or run time understated (downtime recorded incorrectly).
- Validate the master data per product and the signal logic at the edge.
In short: A PLC is a rugged industrial controller that reads inputs, runs a control program in a deterministic scan cycle and drives outputs.
- Compared to a PC it is built for harsh environments, real-time deterministic timing, direct industrial I/O and decades of 24/7 operation, programmed in IEC 61131-3 languages.
- A microcontroller is a chip that needs custom boards, protection and certification to do the same job.
In short: Read all inputs into the input image table → execute the program top to bottom using that image → write the output image to the physical outputs → do communication and diagnostics → repeat.
- Scan time is usually milliseconds.
- Because inputs are sampled once per scan, very short pulses need high-speed inputs or interrupts.
In short: Ladder Diagram (relay-style graphics), Function Block Diagram (blocks connected by signals), Structured Text (high-level text like Pascal), Sequential Function Chart (steps and transitions for sequences), and Instruction List (assembly-like, deprecated since the 2013 edition).
- Ladder for discrete logic, ST for maths and data, SFC for sequences, FBD for process control.
In short: HMI is the operator interface for a machine or line.
- SCADA supervises many controllers over a plant or wide area — data acquisition, control, alarms, trends and reporting.
- A DCS is an integrated control system (controllers + HMI + engineering) for continuous processes like refineries and power plants, where control is distributed across controllers on a common platform.
In short: Current signals are not affected by voltage drop over long cables and are less sensitive to electrical noise.
- The "live zero" at 4 mA lets you detect a broken wire (current near 0 mA) as a fault rather than reading it as 0 %, and the 4 mA can power two-wire loop-powered transmitters.
In short: Start (NO) in parallel with a contact of the motor output, in series with Stop (NC in the field) and overload.
- Pressing Start energises the motor coil; the motor's own contact keeps the rung true after Start is released (seal-in); pressing Stop or an overload breaks the rung.
- In ST:
Motor := (Start OR Motor) AND NOT Stop AND NOT Overload;.
In short: TON (on-delay): output becomes true when the input has stayed true for the preset — e.g. start a conveyor 5 s after a horn.
- TOF (off-delay): output stays true for the preset after the input turns false — e.g. keep a cooling fan running 2 minutes after the motor stops.
- CTU counts rising edges to a preset — e.g. 100 parts fill a box, then reset.
In short: A simple open request/response protocol (RTU over RS-485 serial, TCP over Ethernet on port 502).
- Data tables: coils (read/write bits — FC01/05/15), discrete inputs (read-only bits — FC02), input registers (read-only 16-bit — FC04) and holding registers (read/write 16-bit — FC03/06/16).
- 32-bit values span two registers with device-specific word order.
- It has no security, so it belongs on segmented networks.
In short: A vendor- and platform-independent standard (IEC 62541) for secure industrial data exchange.
- It provides a rich information model (typed objects, not just addresses), services for read/write/subscribe/methods/history/alarms, built-in security with certificates and encryption, and transports from client/server to PubSub over MQTT.
- It lets MES, cloud and analytics systems read machine data the same way from any vendor.
In short: Use a gateway/OPC UA layer to normalise protocols (built-in OPC UA servers, or Kepware/Ignition for S7, EtherNet/IP, Modbus), then a .NET edge service (Worker Service) that subscribes to OPC UA monitored items or polls Modbus, adds source timestamps and quality, buffers locally (store-and-forward) and publishes to MQTT/Azure IoT Hub or writes to a time-series/SQL database.
- Use a tag configuration table, a consistent naming model (ISA-95 hierarchy), and keep OT and IT networks separated by a DMZ.
Defence in depth per IEC 62443: asset inventory, segmentation into zones and conduits with firewalls and an industrial DMZ, no direct internet access to controllers, secure protocols (OPC UA with signing/encryption), strict remote access (jump host, MFA, recording), least-privilege accounts, change control and backups of PLC programs, patching in maintenance windows, OT-aware monitoring, and incident response plans that consider safety.
In short: Check the PLC online: is the HMI command bit reaching the PLC (HMI write and tag address), is the command a momentary pulse shorter than the scan or overwritten elsewhere (duplicate coil, another rung/routine), are permissives/interlocks true (stop, overload, guard, upstream conditions), any faults on the drive/VFD, the output module and contactor (output LED, fuse, wiring).
- Use cross-references and a trend of the involved bits; check the alarm log for the time of failure.
In short: Wrong register address (0- vs 1-based offset: 40001 is register 0), wrong function code (holding vs input registers), wrong data type or word/byte order for 32-bit floats, missing scaling factor (value ×10), wrong slave/unit id, or reading stale data after a communication error without checking quality.
- Compare with a tool like Modbus Poll and the device manual.
In short: REST is an architectural style for networked APIs (Roy Fielding, 2000).
- Constraints: client–server separation, statelessness (each request carries everything needed, e.g. a token), cacheability, a uniform interface (resources identified by URIs, standard methods, self-descriptive messages, optionally hypermedia), a layered system, and optional code-on-demand.
- In practice: resource-oriented URLs, HTTP verbs, status codes, and JSON representations.
In short: POST creates a resource (server assigns the ID) or triggers a process; not idempotent; returns 201 + Location.
- PUT replaces the whole resource at a known URI; idempotent (sending it twice gives the same state).
- PATCH partially updates (JSON Patch or JSON Merge Patch); not necessarily idempotent.
- Missing fields in PUT usually mean "set to default/null", in PATCH they mean "leave unchanged".
In short: 401 Unauthorized really means unauthenticated: no valid credentials, so the client should log in or refresh its token (the response includes WWW-Authenticate).
- 403 Forbidden means the identity is known but lacks permission, and re-authenticating won't help.
- In ASP.NET Core,
Challenge()produces 401 andForbid()produces 403.
[ApiController] attribute do?In short: It enables API conventions: attribute routing is required, invalid ModelState automatically returns 400 with ValidationProblemDetails (no if (!ModelState.IsValid) needed), binding sources are inferred ([FromBody] for complex types, route/query for simple ones, IFormFile from the form), and error status codes get ProblemDetails bodies.
- Apply it to the class or the whole assembly.
In short: Middleware are components in the request pipeline.
- Each receives
HttpContext, can do work, callnextto pass the request on, and do more work on the way back, or short-circuit. - Write a class with a constructor taking
RequestDelegate nextand anInvokeAsync(HttpContext)method, then register it withapp.UseMiddleware<T>(); - or use inline
app.Use(async (ctx, next) => ...). Runis terminal;Mapbranches.- Order defines behaviour.
IActionResult and ActionResult<T>?In short: IActionResult can return any result but carries no type information.
ActionResult<T>(2.1+) lets you return either aT(implicitly wrapped in a 200 OK) or anyActionResult(NotFound()), and lets OpenAPI tools infer the response type.- Minimal APIs use
TypedResultsandResults<Ok<T>, NotFound>for the same purpose.
In short: Both are fully supported and equally fast.
- Controllers suit large APIs with many endpoints, teams familiar with MVC, and heavy use of MVC filters and conventions.
- Minimal APIs suit microservices and small services;
- they have less ceremony, route groups, endpoint filters, typed results and Native AOT support (controllers aren't AOT-compatible).
- They can coexist in one app.
- Organise Minimal APIs with extension methods per feature (
app.MapOrders()).
In short: The client authenticates with an identity provider (Microsoft Entra ID, Auth0, Duende IdentityServer, or your own login endpoint) and receives a signed JWT access token.
- It sends
Authorization: Bearer <token>on each request. - The JwtBearer handler validates the signature (via the authority's published keys or a configured key), issuer, audience and expiry, then builds
HttpContext.Userfrom the claims. [Authorize]with roles, scopes or policies decides access.- Tokens are stateless, so revocation needs short expiry plus refresh tokens or a deny list.
In short: Browsers enforce the same-origin policy: a page from https://app.com can't read responses from https://api.com unless the API sends Access-Control-Allow-Origin (and related headers).
- For non-simple requests, the browser first sends a preflight
OPTIONS. - CORS errors mean the server didn't allow that origin, method or header, or
UseCorsis misplaced in the pipeline. - Fix server-side with a named policy listing the exact origins.
- CORS doesn't protect the API from non-browser clients.
In short: Creating and disposing HttpClient per request leaves sockets in TIME_WAIT and can exhaust ports.
- A single long-lived static instance doesn't respect DNS changes.
IHttpClientFactorymanages pooled handlers with a rotation lifetime, supports named and typed clients, central configuration, and delegating handlers for logging, auth headers and resilience (AddStandardResilienceHandler).
In short: Use UseExceptionHandler() with IExceptionHandler implementations (.NET 8+) and AddProblemDetails() to return RFC 9457 ProblemDetails JSON.
- Map known exception types to statuses (NotFound → 404, Validation → 400, Conflict → 409), log unexpected ones as errors with a trace ID, and never return stack traces in production.
- For expected failures, consider the Result pattern instead of exceptions.
In short: Use the Asp.Versioning packages.
- Strategies: URL segment (
/api/v2/orders, most common and cache-friendly), query string (?api-version=2.0), header (api-version), or media type. - Keep old versions running for a deprecation period, report supported/deprecated versions in headers, document each version in OpenAPI, and introduce a new major version only for breaking changes (removing or renaming fields, changing types or semantics).
In short: Require an Idempotency-Key header (a client-generated UUID).
- On the first request, store the key with request hash, status and response in a table (unique constraint on key + client).
- Concurrent duplicates hit the constraint and wait or get 409.
- Later repeats return the stored response instead of re-executing.
- Expire keys after a period.
- Combine this with DB unique constraints on business identifiers.
- Stripe's API popularised the pattern.
In short: HTTPS only with HSTS;
- OAuth 2.0/OIDC with short-lived JWTs (Authorization Code + PKCE for user clients, client credentials for services);
- scope/role/policy authorisation plus resource ownership checks (IDOR);
- input validation and request size limits;
- parameterised data access;
- rate limiting and an API gateway/WAF (APIM, Front Door);
- strict CORS;
- secrets in Key Vault with managed identities;
- security headers;
- dependency scanning;
- logging and alerting on auth failures;
- no sensitive data in URLs or logs;
- and regular penetration tests or OWASP ZAP scans.
{ "success": false, "error": "Not found" } for everything. How would you improve it?In short: Use proper HTTP semantics.
- Return 404 for not found, 400/422 with ValidationProblemDetails for invalid input, 409 for conflicts, 401/403 for auth, 201 + Location for creates, 204 for deletes, and 500 ProblemDetails with a traceId for unexpected errors.
- Clients, proxies, caches and monitoring tools rely on status codes; with 200 for everything, error-rate dashboards and retries break.
- Roll it out in a new API version so existing clients keep working.