BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) Question Paper 2079 Nepal
This is the official BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) question paper for 2079, as set in the regular annual examination. It carries 80 full marks and a time allowance of 180 minutes, across 13 questions. On Kekkei you can attempt this Digital Logic (IOE, EX 502) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) exam or solving previous years' question papers, this 2079 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt all / any as specified.
(a) Perform the following arithmetic operations as indicated, showing all intermediate steps: (i) Subtract from using 2's complement method, and (ii) convert into its decimal and octal equivalents. [6]
(b) Define weighted and non-weighted codes. Explain the Gray code and the Excess-3 code with suitable examples, and state one practical application of each. [6]
(a) Arithmetic Operations
(i) Subtract from using 2's complement
Minuend , Subtrahend . Expected result .
Step 1 — 2's complement of the subtrahend :
- 1's complement:
- Add 1:
Step 2 — Add to minuend:
1101001 (minuend)
+ 0101010 (2's complement of subtrahend)
-----------
10010011
Step 3 — End-around carry rule: A carry-out of the MSB (the leading ) is generated, so the result is positive; discard the carry.
(ii) Convert to decimal and octal
Hex → Decimal:
Hex → Octal (via binary, 4 bits per hex digit):
So .
Regroup in 3-bit groups from the binary point:
- Integer:
- Fraction:
(b) Weighted and Non-weighted Codes
Weighted code: each bit position carries a fixed numerical weight, and the digit value equals the weighted sum of its bits (e.g., BCD 8421, 2421). Non-weighted code: positions carry no fixed weight, so the value is not a simple weighted sum (e.g., Gray code, Excess-3).
Gray code (non-weighted, reflected binary): successive numbers differ in exactly one bit. Conversion from binary: MSB stays the same, each lower Gray bit .
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
Application: shaft/rotary position encoders and K-map ordering, where single-bit change avoids switching glitches.
Excess-3 code (non-weighted, self-complementing): each decimal digit is coded as its BCD value plus 3. Example: ; .
| Decimal | Excess-3 |
|---|---|
| 0 | 0011 |
| 4 | 0111 |
| 9 | 1100 |
Application: used in older BCD arithmetic units because it is self-complementing (the 1's complement of a code word gives the 9's complement of the digit), simplifying subtraction.
(a) Simplify the Boolean function using a four-variable Karnaugh map. Obtain the minimal sum-of-products expression and implement it using only NAND gates. [8]
(b) State and prove DeMorgan's theorems for two variables, and prove that a positive logic X-OR gate is equivalent to a negative logic X-NOR gate. [4]
(a) K-map Simplification of
Four-variable K-map (rows , columns in Gray order ):
| AB\CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 (0) | 1 (1) | d (3) | 1 (2) |
| 01 | 0 (4) | 1 (5) | 0 (7) | 0 (6) |
| 11 | 0 (12) | 0 (13) | d (15) | 0 (14) |
| 10 | 1 (8) | 1 (9) | d (11) | 1 (10) |
Grouping (using don't-cares to enlarge groups):
- — cells 0,1,8,9 (an eight-cell band combined): minterms 0,1,8,9 give .
- — cells 0,2,8,10 give .
- — cells 1,5 (with 3 as don't-care assists, but the tight group of 1 and 5): minterm 5 needs covering. Cells 1 and 5 give . Using don't-care 3, group 1,3,5,7? — 7 is 0, so the valid pair is covering 1,5.
Combining the prime implicants that cover all required 1's:
Check: covers 0,1,8,9; covers 0,2,8,10; covers 1,5. All required minterms covered.
NAND-only implementation: A two-level SOP maps directly to two-level NAND-NAND. Each product term is formed by a NAND gate (with its inputs), and the term outputs feed a final NAND gate:
Describe: three NAND gates produce , , (literals obtained by inverters or available complements); a fourth NAND gate combines them to give . This is the standard NAND-NAND realization of an SOP function.
(b) DeMorgan's Theorems and XOR/XNOR Equivalence
DeMorgan's Theorems:
Proof by truth table (theorem 1):
| A | B | ||
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
Columns match for all input combinations, proving . The second theorem follows identically.
Positive-logic XOR = Negative-logic XNOR: In positive logic, HIGH voltage = 1. Under negative logic, the same physical HIGH represents 0 and LOW represents 1, so every input/output value is complemented. For an XOR gate, the negative-logic function is . Since , we get (XNOR). Hence a physical XOR gate read in negative logic behaves as an XNOR gate.
(a) Design a synchronous sequential circuit that detects the input sequence "1011" (overlapping allowed) and produces an output of 1 whenever the sequence is detected. Draw the state diagram, construct the state table, perform state assignment, and implement the circuit using JK flip-flops. Show the excitation table and the simplified flip-flop input equations. [10]
(b) Differentiate between a Moore machine and a Mealy machine. Explain the role of state reduction in sequential circuit design with an example. [6]
(a) "1011" Sequence Detector (overlapping) using JK Flip-flops
States (Mealy machine, output depends on input + state):
- : no useful prefix
- : got "1"
- : got "10"
- : got "101"
State diagram (described): From : input 1 → , 0 → . From : 1 → , 0 → . From : 1 → , 0 → . From : 1 → with output 1 (overlap: the final 1 starts a new "1"), 0 → .
State / output table:
| Present | x=0 → next, out | x=1 → next, out |
|---|---|---|
| , 0 | , 0 | |
| , 0 | , 0 | |
| , 0 | , 0 | |
| , 0 | , 1 |
State assignment: (flip-flops ).
Transition table:
| x | out | ||
|---|---|---|---|
| 00 | 0 | 00 | 0 |
| 00 | 1 | 01 | 0 |
| 01 | 0 | 10 | 0 |
| 01 | 1 | 01 | 0 |
| 10 | 0 | 00 | 0 |
| 10 | 1 | 11 | 0 |
| 11 | 0 | 10 | 0 |
| 11 | 1 | 01 | 1 |
JK excitation (rule: ; ; ; ):
| x | |||
|---|---|---|---|
| 00 | 0 | 0× 0× | (Q0 0→0) 0× |
| 00 | 1 | 0× | 1× |
| 01 | 0 | 1× | ×1 |
| 01 | 1 | 0× | ×0 |
| 10 | 0 | ×1 | 0× |
| 10 | 1 | ×0 | 1× |
| 11 | 0 | ×0 | ×1 |
| 11 | 1 | ×0 | ×0 |
Simplified input equations (from K-maps over ):
Implementation: Two JK flip-flops clocked together; combinational gates realize the four input equations above, and an AND gate produces the output .
(b) Moore vs Mealy Machine
| Feature | Moore | Mealy |
|---|---|---|
| Output depends on | Present state only | Present state and input |
| Output timing | Synchronous, changes with state | Can change asynchronously with input |
| Number of states | Usually more | Usually fewer |
| Output stability | More stable (glitch-free) | May glitch on input change |
State reduction removes redundant/equivalent states — two states are equivalent if, for every input, they produce the same output and go to equivalent next states. Merging them reduces flip-flop count and gate cost. Example: if states and always give the same output and equivalent next states, replace all references to with ; a machine of 6 states reducible to 4 needs only 2 flip-flops instead of 3.
(a) Design a full adder using two half adders and explain its operation with a truth table. Show how four full adders can be cascaded to build a 4-bit binary parallel adder. [6]
(b) Implement the Boolean function using an multiplexer, and explain how the same function can be realized with a multiplexer. [4]
(a) Full Adder from Two Half Adders
A half adder adds two bits: , . A full adder adds three bits .
Truth table:
| A | B | Sum | ||
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Using two half adders: HA-1 adds giving sum and carry . HA-2 adds and giving final Sum and carry . An OR gate combines: .
4-bit parallel (ripple-carry) adder: Cascade four full adders FA0..FA3. The carry-out of each stage feeds the carry-in of the next: , , ..., producing and final carry . The carry ripples from LSB to MSB.
(b) with multiplexers
Using an MUX: Apply to select lines . Tie each data input for minterms in the list, else 0:
The MUX output equals directly.
Using a MUX: Use as select lines; express each data input as a function of (the residual variable):
| minterms | in terms of | |
|---|---|---|
| 00 (m0,m1) | m1=1, m0=0 | |
| 01 (m2,m3) | m3=1, m2=0 | |
| 10 (m4,m5) | m5=1, m4=0 | |
| 11 (m6,m7) | m6=1, m7=0 |
So and . The MUX with these inputs realizes using one less variable on the select lines.
Section B: Short Answer Questions
Attempt all / any as specified.
Design a combinational logic circuit for a BCD-to-seven-segment display decoder for a common-cathode display. Write the truth table for any two of the output segments and derive their simplified Boolean expressions using K-maps.
BCD-to-Seven-Segment Decoder (Common-Cathode)
A common-cathode display lights a segment when its input is HIGH (1). The decoder has 4 BCD inputs (=MSB) and 7 outputs –. Inputs 10–15 are don't-cares (). Digit patterns (segments lit):
| Dec | a b c d e f g | |
|---|---|---|
| 0 | 0000 | 1 1 1 1 1 1 0 |
| 1 | 0001 | 0 1 1 0 0 0 0 |
| 2 | 0010 | 1 1 0 1 1 0 1 |
| 3 | 0011 | 1 1 1 1 0 0 1 |
| 4 | 0100 | 0 1 1 0 0 1 1 |
| 5 | 0101 | 1 0 1 1 0 1 1 |
| 6 | 0110 | 1 0 1 1 1 1 1 |
| 7 | 0111 | 1 1 1 0 0 0 0 |
| 8 | 1000 | 1 1 1 1 1 1 1 |
| 9 | 1001 | 1 1 1 1 0 1 1 |
Segment a truth table and K-map
for digits 0,2,3,5,6,7,8,9 → only for 1 and 4. So .
K-map simplification gives:
Segment b truth table and K-map
for 0,1,2,3,4,7,8,9 → for 5 and 6. So .
K-map simplification gives:
(i.e. — segment b is OFF only when and , i.e. digits 5 and 6.)
Each output is realized as a two-level AND-OR (or NAND-NAND) network from these expressions; the remaining segments – are derived identically.
What is the difference between a decoder and an encoder? Design an octal-to-binary priority encoder, write its truth table, and explain the need for priority in such encoders.
Decoder vs Encoder
| Decoder | Encoder |
|---|---|
| inputs → outputs | (or more) inputs → outputs |
| Activates one output line for each input code | Generates the binary code of the active input |
| Expands code to lines (1-of-) | Compresses lines to code |
| Example: 3-to-8 decoder | Example: 8-to-3 encoder |
Octal-to-Binary (8-to-3) Priority Encoder
Inputs –, outputs plus a valid bit . Priority means if several inputs are active, the highest-numbered input wins. = don't-care.
| V | ||
|---|---|---|
| 0 0 0 0 0 0 0 0 | x x x | 0 |
| 0 0 0 0 0 0 0 1 | 0 0 0 | 1 |
| 0 0 0 0 0 0 1 x | 0 0 1 | 1 |
| 0 0 0 0 0 1 x x | 0 1 0 | 1 |
| 0 0 0 0 1 x x x | 0 1 1 | 1 |
| 0 0 0 1 x x x x | 1 0 0 | 1 |
| 0 0 1 x x x x x | 1 0 1 | 1 |
| 0 1 x x x x x x | 1 1 0 | 1 |
| 1 x x x x x x x | 1 1 1 | 1 |
Output expressions:
Need for priority: In an ordinary encoder, if two or more inputs are simultaneously active the output is an invalid superposition of codes. A priority encoder resolves this ambiguity by always encoding only the highest-priority active input, guaranteeing a meaningful output. The valid bit distinguishes the all-zero input (no active line) from the code for .
Explain the working of an SR latch using NOR gates and discuss its invalid state. Describe how a master-slave JK flip-flop eliminates the race-around condition, with the help of a timing diagram.
NOR-gate SR Latch
Two cross-coupled NOR gates: and . Inputs (set), (reset) are active-HIGH.
| S | R | Q | Action |
|---|---|---|---|
| 0 | 0 | Hold (no change) | |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | 0/0 | Invalid |
Invalid state: When , both NOR outputs are forced to , so — they are no longer complementary. Worse, if both inputs then return to simultaneously, the latch enters an unpredictable (race) state because the final value depends on which gate switches faster. Hence is forbidden.
Master-Slave JK Flip-flop and Race-Around
Race-around occurs in a level-triggered JK flip-flop when : while the clock is HIGH, the feedback makes the output toggle repeatedly (oscillate) because the output keeps changing the inputs as long as the clock stays high. If the clock pulse width is larger than the propagation delay, the final state is uncertain.
Master-slave configuration uses two JK latches in series:
- The master is enabled when CLK = 1 and accepts the J,K inputs.
- The slave is enabled when CLK = 0 (inverted clock) and copies the master's output.
Because master and slave are never transparent at the same time, the output of the whole flip-flop changes only once per clock cycle (on the falling edge effectively), eliminating multiple toggles.
Timing diagram (described): During CLK HIGH, the master latches the new value (master output changes) but the slave output holds. On the CLK falling edge, the slave transfers the master's value to . With , toggles exactly once per clock pulse instead of oscillating — the race-around condition is removed.
Explain the operation of a 4-bit Serial-In Parallel-Out (SIPO) shift register using D flip-flops. Draw its logic diagram and show the timing waveforms when the serial data 1101 is shifted in.
4-bit Serial-In Parallel-Out (SIPO) Shift Register
Construction: Four D flip-flops (FF0–FF3) connected in cascade, all driven by a common clock. The serial data enters of FF0; each flip-flop's output feeds the next flip-flop's D input: , , . The four outputs are available in parallel.
Logic diagram (described):
Serial in --> D0 [FF0] Q0 --> D1 [FF1] Q1 --> D2 [FF2] Q2 --> D3 [FF3] Q3
| | | |
CLK ------------+------------+------------+------------+
Operation: On each rising clock edge, every flip-flop loads the value present at its D input, so the data shifts one position to the right per clock. After 4 clocks, the 4-bit word is fully loaded and read in parallel.
Shifting serial data 1101 (LSB first, i.e. order 1,0,1,1 applied at serial input):
Assume serial input sequence applied per clock = 1, 1, 0, 1 (entering so that final pattern appears). Tracking starting from 0000:
| Clock | Serial in | ||||
|---|---|---|---|---|---|
| Initial | – | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 |
| 2 | 1 | 1 | 1 | 0 | 0 |
| 3 | 0 | 0 | 1 | 1 | 0 |
| 4 | 1 | 1 | 0 | 1 | 1 |
After 4 clock pulses the register holds the shifted data , now available in parallel.
Timing waveform (described): The clock is a square wave. The serial-input waveform shows the bit sequence. Each waveform is a one-clock-delayed copy of the stage before it, so follows serial-in by one clock, lags by one clock, and so on — illustrating the right-shift of data through the register.
Design a MOD-10 asynchronous (ripple) counter using JK flip-flops. Draw the logic diagram and the output timing waveforms, and explain how the counter resets at the count of ten.
MOD-10 Asynchronous (Ripple) Counter using JK Flip-flops
A MOD-10 (decade) counter counts 0000 → 1001 (0–9) and resets to 0000 on the 10th pulse. It needs 4 JK flip-flops (=LSB).
Ripple connections: All J,K tied HIGH (toggle mode). is clocked by the input clock; each following flip-flop is clocked by the output of the previous stage (for a negative-edge counter, drives the clock of stage ).
Reset logic: The counter must clear at count , i.e. when and . A NAND gate detects this:
When the count momentarily reaches , , the NAND output goes LOW and is fed to the active-LOW asynchronous CLEAR of all flip-flops, instantly resetting the counter to .
Logic diagram (described):
CLK -> [JK0] Q0 -> clk[JK1] Q1 -> clk[JK2] Q2 -> clk[JK3] Q3
J=K=1 on all. Q3,Q1 -> NAND -> CLR (active-low) of all FFs
Count sequence:
| Pulse | |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| ... | ... |
| 9 | 1001 |
| 10 | 1010 → CLEAR → 0000 |
Timing waveforms (described): toggles every clock pulse (÷2), toggles every 2 pulses (÷4), every 4, every 8 — but the glitch is detected and the count is forced back to 0000, so the sequence repeats every 10 clocks. Thus the counter resets at ten via the asynchronous CLEAR triggered when .
Differentiate between RAM and ROM. Explain how a combinational circuit can be implemented using a ROM, taking the example of a circuit that converts a 3-bit binary number to its square.
RAM vs ROM
| RAM | ROM |
|---|---|
| Read and write | Primarily read-only |
| Volatile (loses data on power-off) | Non-volatile (retains data) |
| Used for temporary/working storage | Used for permanent/firmware storage |
| Static (SRAM) or dynamic (DRAM) | Mask, PROM, EPROM, EEPROM types |
Implementing a Combinational Circuit with ROM
A ROM with address lines and data lines stores a complete truth table: the inputs form the address, and the stored -bit word is the output. Internally a ROM is a fixed AND array (full decoder) + programmable OR array, so it directly realizes any combinational function of variables.
Example: 3-bit binary → its square
Input (0–7); output is the square (0–49), needing 6 output bits. So a = ROM.
| Input (dec) | Square | Output | |
|---|---|---|---|
| 0 | 000 | 0 | 000000 |
| 1 | 001 | 1 | 000001 |
| 2 | 010 | 4 | 000100 |
| 3 | 011 | 9 | 001001 |
| 4 | 100 | 16 | 010000 |
| 5 | 101 | 25 | 011001 |
| 6 | 110 | 36 | 100100 |
| 7 | 111 | 49 | 110001 |
Operation: The 3 input bits address one of the 8 ROM locations; the stored 6-bit word at that location is the binary square, produced directly at the output. No gate-level minimization is needed — the ROM "looks up" the answer, making it a simple and flexible way to implement combinational logic such as code converters and look-up tables.
Distinguish between PLA and PAL with the help of their basic block diagrams. Implement the functions and using a PLA, and show the PLA programming table.
PLA vs PAL
Both are programmable logic devices with two arrays (AND then OR).
| PLA (Programmable Logic Array) | PAL (Programmable Array Logic) |
|---|---|
| AND array programmable, OR array programmable | AND array programmable, OR array fixed |
| More flexible (product terms can be shared by any output) | Less flexible (fixed group of product terms per output) |
| Slower, costlier | Faster, cheaper, easier to program |
Block diagrams (described): Inputs (with their complements) feed an AND-plane producing product terms. In a PLA both the input-to-AND connections and the AND-to-OR connections are programmable fuses. In a PAL the AND-plane is programmable but each OR gate is hard-wired to a fixed subset of product terms.
PLA Implementation
Simplify with K-maps:
: minterms 0,1,3,4.
Checking: (0,1), (1,3), (0,4). Covers 0,1,3,4. ✓
: minterms 1,2,3,4,5.
Checking: (1,3), (4,5), (2). Covers 1,2,3,4,5. ✓
Shared product terms: Both functions use , so the PLA shares it.
Product terms used: , (shared), , , .
PLA Programming Table
| Inputs (A B C) | |||
|---|---|---|---|
| 0 0 – | 1 | – | |
| 0 – 1 | 1 | 1 | |
| – 0 0 | 1 | – | |
| 1 0 – | – | 1 | |
| – 1 0 | – | 1 |
(– = don't-connect; a 1 in the columns marks the OR-array fuse left intact.) Thus 5 product terms realize both outputs, sharing .
Define analog and digital signals. State the logic gate that acts as a universal gate and justify your answer by realizing the NOT, AND and OR operations using only that gate.
Analog vs Digital Signals
- Analog signal: a continuous signal that can take any value within a range and varies smoothly with time (e.g., a sine wave, microphone voltage).
- Digital signal: a discrete signal that takes only a finite set of levels — typically two (LOW = 0, HIGH = 1) — changing in steps (e.g., a clock pulse train).
Universal Gate
The NAND gate (and equally the NOR gate) is a universal gate because any Boolean function — and hence NOT, AND, OR — can be built using only NAND gates.
NOT (tie both inputs together):
AND (NAND followed by NAND-inverter):
First NAND gives ; second NAND used as inverter gives .
OR (invert each input with a NAND, then NAND them — DeMorgan):
Use two NANDs as inverters to get , then a NAND of these gives .
Since NOT, AND and OR (a functionally complete set) are all realizable with NAND alone, the NAND gate is universal.
Design a 2-bit magnitude comparator that produces three outputs indicating , and . Write the truth table and the simplified output expressions.
2-bit Magnitude Comparator
Compares and , giving three outputs: (), (), ().
Truth table (16 rows; summarized by relation):
| 00 | 00 | 0 | 1 | 0 |
| 00 | 01/10/11 | 0 | 0 | 1 |
| 01 | 00 | 1 | 0 | 0 |
| 01 | 01 | 0 | 1 | 0 |
| 01 | 10/11 | 0 | 0 | 1 |
| 10 | 00/01 | 1 | 0 | 0 |
| 10 | 10 | 0 | 1 | 0 |
| 10 | 11 | 0 | 0 | 1 |
| 11 | 00/01/10 | 1 | 0 | 0 |
| 11 | 11 | 0 | 1 | 0 |
Simplified output expressions:
Equality — both bit pairs equal:
Greater than — compare MSB first, then LSB:
Less than — by complement / symmetry:
Note always (exactly one output is high). The circuit uses XNOR gates for bit equality plus AND/OR gates for the and terms.
Frequently asked questions
- Where can I find the BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) question paper 2079?
- The full BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) 2079 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the Digital Logic (IOE, EX 502) 2079 paper come with solutions?
- Yes. Every question on this Digital Logic (IOE, EX 502) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
- How many marks is the BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) 2079 paper?
- The BE Computer Engineering (IOE, TU) Digital Logic (IOE, EX 502) 2079 paper carries 80 full marks and is meant to be completed in 180 minutes, across 13 questions.
- Is practising this Digital Logic (IOE, EX 502) past paper free?
- Yes — reading and attempting this Digital Logic (IOE, EX 502) past paper on Kekkei is completely free.