Land the job you want — prepare
with Real interviews Q&A
Curated interview questions, company-wise guides and coding rounds. Practice mock interviews, improve with feedback, and track your progress.
Ada is a structured, statically typed, high-level programming language designed for reliability and safety-critical systems. It features built-in support for design-by-contract, strong typing, and concurrent real-time execution.
Bagian dari U.S. Department of Defense (DoD) in the late 1970s to replace hundreds of disparate programming languages then in use within military systems. It was named after Ada Lovelace, often credited as the first computer programmer.
Because of its uncompromising features: strong static typing, compile-time checks, safe pointer interfaces, and built-in concurrency support. It heavily minimizes the occurrences of runtime system vulnerabilities, crashes, and undefined behaviors.
Strong typing in Ada means the compiler enforces strict differentiation between types. For example, you cannot accidentally add an integer measuring Speed to an integer measuring Distance without explicit conversions, preventing logical programming mistakes.
A package is the fundamental modular unit in Ada used for grouping logically related declarations and implementations together. It consists of a specification file (interface) and a body file (implementation), ensuring clean encapsulation.
A procedure is a subprogram in Ada that executes an action but does not return a value. It can communicate inputs and outputs to calling blocks using parameters marked with modes: in, out, or in out.
A function is a subprogram in Ada that performs computations and must return a single value of a specified type using a return statement.
In Ada, variables are declared using the pattern: Variable_Name : Type_Name := Initial_Value;
X : Integer := 10;Constants are declared by adding the constant keyword right after the colon delimiter, which guarantees they cannot be modified after compilation.
Pi : constant Float := 3.14;An if statement checks condition states and ends explicitly with an end if; statement.
if X > 0 then Put_Line("Positive"); end if;Loops in Ada can be controlled using standard ranges or index iterations. Numeric attributes can be formatted as output text using the 'Image attribute.
for I in 1..10 loop Put_Line(Integer'Image(I)); end loop;Arrays explicitly define their boundary conditions during creation (e.g., indexes 1 to 5).
A : array (1..5) of Integer;A record allows programmers to group elements of varying types together into a cohesive custom type definition, similar to a struct in C.
type Person is record Name : String(1..20); Age : Integer; end record;Ada handles runtime exception boundaries using structured blocks, stopping failures from destabilizing complex critical environments.
begin -- Potentially unsafe operation X := Y / Z; exception when Constraint_Error => Put_Line("Division by zero or overflow!"); end;The program's entry execution context starts within a standard procedure mapped directly as the main system loop configuration block.
procedure Main is begin -- Execution starts here Put_Line("Main entry execution"); end Main;A task is an active concurrent execution thread managed directly by Ada's compiler and runtime platform layer, enabling native, portable multi-threading support.
task type Worker is
entry Start;
end Worker;
task body Worker is
begin
accept Start;
Put_Line("Task is running concurrently.");
end Worker;A rendezvous is Ada's fundamental synchronization mechanism, allowing safe data exchanges and thread coordination when multiple tasks meet.
-- Task communication handshake
accept Start do
-- Synchronized mutual-exclusion zone
Put_Line("Rendezvous active");
end Start;Generic components are templates parameterized with types, subprograms, or values, facilitating compilation-level type-safe code reuse.
generic type Element is private;
procedure Swap(A, B : in out Element);A subtype defines a subset of an existing base type's values without instantiating a completely new distinct type category.
subtype Positive_Integer is Integer range 1 .. Integer'Last;Access types are type-safe pointer alternatives in Ada used to securely allocate and dereference memory addresses dynamically.
type Int_Ptr is access Integer; My_Ptr : Int_Ptr;A tagged type enables object-oriented programming (OOP) paradigms in Ada, acting as a className base to support dynamic dispatching and inheritance.
type Instrument is tagged record ID : Integer; Name : String(1..10); end record;A protected object provides coordinated lock synchronization, encapsulating data and locking thread entries automatically for concurrent access.
Ada allows overloading, enabling multiple subprograms to declare identical names provided their signature parameters vary.
procedure Display(Item : Integer); procedure Display(Item : Float);Recursion occurs when subprograms execute self-calls recursively to partition mathematical problems into manageable chunks.
A pragma is a compiler directive used to configure optimizations, constraints, calling profiles, or target behaviors directly.
pragma Optimize(Time); -- Instructs compiler to focus on execution speedRange constraints restrict variable domains dynamically, catching overflow logic errors automatically via runtime type-checking engines.
Memory allocations are safely structured using pointer constructors inside active heap spaces.
Ptr : access Integer := new Integer'(10);Discriminated records function similarly to variant records, altering structural properties based on dynamic discriminant variables.
type Buffer(Size : Positive) is record Data : String(1 .. Size); end record;Task entries establish structured communication interfaces to accept parameter payloads safely across thread boundaries.
task Server is entry Get_Status(Code : out Integer); end Server;Delay statements yield task executions temporarily, pausing threads for precise durations.
delay 2.5; -- Pause task execution for 2.5 secondsAda provides native, deterministic scheduling models, priority-inversion controls, and clock systems vital for high-reliability embedded targets.
pragma Priority(Interrupt_Priority'Last);The Ravenscar Profile is a specialized tasking subset that guarantees deterministic, analyzable, and safety-certifiable real-time concurrency.
pragma Profile(Ravenscar);Contract-based programming leverages Pre (preconditions) and Post (postconditions) aspects to mathematically verify subprogram correct states at boundaries.
procedure Deposit(Amount : Positive) with Pre => Amount > 0, Post => Balance = Balance'Old + Amount;SPARK is a specialized language subset and formal verification toolset. It mathematically proves the absence of runtime errors (like division by zero or buffer overflows) and verifies correctness.
procedure Safety_Critical_Process with SPARK_Mode => On;