PEC EPE Computer & Allied cheat sheet
PEC EPE Computer & Allied · Keep the key ideas within reach.
Computer Fundamentals and Programming
Two's complement range for n bits is -2^(n-1) to 2^(n-1)-1; negating a value means inverting all bits and adding 1.
Stack grows downward on most architectures and stores return addresses and locals; heap grows upward and is managed by malloc/new.
Big-O of common operations: binary search O(log n), balanced-tree search O(log n), hash lookup O(1) average, quicksort O(n log n) average but O(n^2) worst case.
Pass by value copies the argument; pass by reference (C++ &, or pointer) lets the callee modify the caller's variable.
In C, a string is a char array terminated by the null character '\0'; strlen excludes the terminator, sizeof includes it.
Dangling pointer references freed memory; memory leak is allocated memory never freed; both are avoided by setting pointers to NULL after free.
Recursion requires a base case; each call consumes stack frame space, so depth-n recursion uses O(n) auxiliary space.
A compiler translates source to machine code before execution; an interpreter executes statements at runtime, trading speed for portability.
Digital Logic Design and Microprocessors
De Morgan: (A·B)' = A' + B' and (A+B)' = A'·B'; use to convert between AND/NAND and OR/NOR forms.
Karnaugh map grouping rules: groups of 1, 2, 4, 8 adjacent cells; larger groups eliminate more variables; don't-cares may be grouped freely.
A D flip-flop output follows input on the clock edge; a JK flip-flop toggles when J=K=1, which D flip-flops avoid without extra logic.
A multiplexer with n select lines routes 2^n inputs to one output; a decoder with n inputs activates one of 2^n outputs.
Setup time is the interval data must be stable before the clock edge; hold time is the interval after; violating either causes metastability.
In the 8085, ALE latches the lower address byte (AD0-AD7) because those pins are time-multiplexed with the data bus.
Interrupts are maskable (INTR) or non-maskable (TRAP in 8085); vectored interrupts jump to a fixed address without polling.
Ripple-carry adder delay grows with bit width; carry-lookahead adders reduce worst-case delay to O(log n) by computing generate and propagate terms.
Electrical Power Engineering Fundamentals
Three-phase power: P = √3·V_L·I_L·cos φ for a balanced load, with V_L the line voltage and I_L the line current.
Star (Y) connection: V_L = √3·V_phase and I_L = I_phase; delta connection: V_L = V_phase and I_L = √3·I_phase.
Transformer EMF equation: E = 4.44·f·N·Φ_max; the 4.44 factor comes from the RMS value of a sinusoidal flux.
Transformer efficiency peaks when copper loss equals iron (core) loss; rated kVA is limited by heating, not by load power factor.
Synchronous speed n_s = 120·f/P rpm; slip s = (n_s - n_r)/n_s, and rotor frequency equals s·f.
A DC shunt motor has nearly constant speed; a series motor has high starting torque and must never run unloaded.
Power factor correction: capacitor kVAR = P·(tan φ1 - tan φ2), where φ1 and φ2 are the before and after phase angles.
Per-unit value = actual value / base value; changing base uses Z_pu,new = Z_pu,old·(S_new/S_old)·(V_old/V_new)^2.
Power System Analysis and Protection
Per-unit reactance simplifies fault analysis: I_fault(pu) = V_th(pu)/Z_th(pu), then multiply by base current I_base = S_base/(√3·V_base).
Symmetrical components split an unbalanced set into positive, negative, and zero sequences; only the positive sequence produces forward torque.
Zero-sequence currents require a return path; a delta winding blocks zero-sequence current, and an ungrounded star has no zero-sequence path.
A relay's plug setting multiplier (PSM) = fault current / (CT ratio × plug setting); time from the relay characteristic curve at that PSM.
IDMT overcurrent relays coordinate by time grading so the downstream relay trips first; the upstream relay adds a discrimination margin.
Differential protection compares currents entering and leaving a zone; it is the standard for transformer and busbar protection.
Distance relays measure impedance Z = V/I; zone 1 covers about 80% of the line, zone 2 about 120-150%, with time delays.
Surge impedance Z_c = √(L/C); the surge impedance loading (SIL) of a line equals V^2/Z_c and marks the natural load point.
Control Systems and Instrumentation
Closed-loop transfer function T(s) = G(s)/(1 + G(s)H(s)); poles are roots of the characteristic equation 1 + G(s)H(s) = 0.
Routh-Hurwitz: the number of sign changes in the first column equals the number of right-half-plane poles; a zero row uses the auxiliary polynomial.
Steady-state error: type 0 gives finite error to a step, type 1 zero error to a step and finite to a ramp, type 2 zero error to a ramp.
Second-order response: ω_n is natural frequency, ζ damping ratio; percent overshoot = 100·e^(-ζπ/√(1-ζ^2)) for ζ < 1.
Stability margins: gain margin is the negative dB of |G| at the phase crossover (-180°); phase margin is 180° plus phase at the gain crossover.
A transducer converts a physical quantity to an electrical signal; sensitivity is output change per unit input, and linearity describes deviation from a straight line.
A Wheatstone bridge nulls when R1/R2 = R3/R4; it measures small resistance changes such as strain-gauge output.
A PID controller output is Kp·e + Ki∫e dt + Kd·(de/dt); derivative action adds damping but amplifies measurement noise.
Electronics and Signal Processing
Ideal op-amp assumptions: infinite open-loop gain, infinite input impedance, zero output impedance; with negative feedback, V+ = V- (virtual short).
Inverting amplifier gain = -Rf/Rin; non-inverting gain = 1 + Rf/Rin; both depend only on external resistors.
BJT regions: cutoff (V_BE < 0.7 V), active (base-emitter forward, collector-base reverse), saturation (both forward, small V_CE).
A half-wave rectifier gives V_dc = V_m/π; a full-wave rectifier gives 2V_m/π; ripple frequency is f and 2f respectively.
Nyquist criterion: sample at more than twice the highest signal frequency, or aliasing folds high frequencies into the baseband.
A low-pass filter has a -3 dB cutoff at f_c = 1/(2πRC) for a first-order RC stage; roll-off is -20 dB per decade per pole.
Z-transform of a unit impulse is 1; of a unit step is z/(z-1); the ROC determines stability, and a system is stable if the ROC includes the unit circle.
DFT of N points costs O(N^2) operations; the FFT reduces this to O(N log N) by exploiting symmetry and periodicity.
Engineering Ethics and Professional Practice
A licensed engineer's seal on drawings signifies responsibility for the work; sealing work outside one's competence is a violation.
Conflict of interest exists when a personal interest could bias professional judgment; disclosure and recusal are the standard responses.
Whistleblowing is justified when a serious public safety or legal violation exists and internal channels have failed or are unsafe.
Engineering codes (e.g., NSPE, IEEE) place the public's safety, health, and welfare first, above employer and client interests.
Accepting gifts or payments from suppliers that could influence selection decisions is bribery; nominal hospitality still requires transparency.
Intellectual property: patents protect novel, useful, non-obvious inventions for a limited term; copyright protects expression, not ideas.
A contract requires offer, acceptance, and consideration; negligence requires duty, breach, causation, and damages.
Professional development and continuing education are code obligations, not optional, because competence must track current standards.