Basic Electricity Electronics IT 1011 for Second Semester Sample

Basic Electricity & Electronics
IT 1011
for
Second Semester
Sample Question
1. Determine the forward voltage and forward current for the diode in figure for
each of the diode models. Also find the voltage across the limiting resistor in
each case. Assume r'd = 10 ohms.
(10 marks)
2. Determinte the reverse voltage and reverse current for the diode in figure for each
of the diode models. Also find the voltage across the limiting resistor in each case.
Assume IR = 1 microAmpere.
(10 marks)
3. Sketch the output voltage of each rectifier circuit for the indicated input voltages,
as shown in fig. (a), (b)
(10 marks)
Figure (a)
Fig (b)
4. Determine the peak and average power delivered to RL in figure 2.2.
(10 marks)
5. Consider the circuit in figure.
(10 marks)
Figure 2.3
(a) What type of circuit is this?
(b) What is the total peak secondary voltage?
(c) Find the peak voltage across each half of the secondary.
(d) Sketch the voltage wave form across RL.
(e) What is the peak current through each diode?
(f) What is the PIV for each diode?
6. Determine the output voltage for the bridge rectifier in figure. What PIV rating is
required for the silicon diodes? The transformer is specified to have a 12 Vrms
secondary voltage for the standard 110 V across the primary. (10 marks)
7.Determine the ripple faction for the filtered bridge rectifier in figure. (20 marks)
8.A 120 Hz full-wave rectified voltage with a peak value of 162 V is applied to the
LC filter in figure. Determine the filter output in terms of its dc value and the rms
ripple voltage. (20 marks)
9. A certain full-wave rectifier has a peak output voltage of 30V. A 50microF
capacitor filter is connected to the rectifier. Calculate the peak-to-peak ripple and
the dc output voltage developed across a 600 ohms load resistance. What is the
percentage of ripple for that rectifier filter.
(20 marks)
10.A certain zener diode has a ZZT = 6.8 V at IZT = 20 mA, and IZM = 50 mA. What
is the voltage across the zener terminals when the current is 30 mA? When the current
is 10 mA?
(10 marks)
IZ
∆l Z
VZ
+
∆l Z
-
+
-
VZ = VZT
11.Determine the minimum and the maximum input voltages that can be regulated by
the zener diode in Figure.
(20 marks)
12. Determine the minimum and the maximum load currents for which the zener
diode in Figure will maintain regulation. What is the minimum RL the can be used?
VZ = 12 V, IZK = 1mA and IZM = 50mA. Assume ZZ = 0 ohm and VZ remains a
constant 12 V over the range of current values for simplicity.
(20
marks)
13 .For the circuit in Figure.
(20 marks)
(a) Determine VOUT at IZK and at IZM.
(b) Calculate the value of R that should be used.
(c) Determine the minimum value of RL that can be used.
14.To what value must R be adjusted in figure to make IZ = 40mA? Assume VZ = 12
V at 30 mA and ZZ = 30 ohms.
(20 marks)
15. A loaded zener regulator is shown in figure 3.5. VZ = 5.1 V at 35 mA, IZK = 1mA,
ZZ = 12 ohms and IZM = 70mA. Determine the minimum and maximum permissible
load currents.
(20 marks)
16. State the mathematical relationship between О±DC and ОІDC. (20 marks)
17.Determine IB,IC,IE,VBE,VCE and VCB in the circuit of figure. The transistor
has a ОІDC = 150.
(20 marks)
18.Determine IB,IC,IE,VBE,VCE and VCB in figure for the following values: RB =
22kohm, RC = 220 ohms, VBB = 6V, VCC = 9V and ОІDC = 90. (20 marks)
19. Determine whether or not the transistor in figure is in saturation. Assume VCE(sat)
= 0.2.
(20 marks)
20. Determine whether or not the transistor in figure is saturated for the following
values: ОІDC = 125, VBB = 1.5V, RB = 6.8kohms, VCE(sat) = 0.2, RC = 180 ohms, and VCC
= 12 V.
(20 marks)
21. The transistor in figure has the following maximum ratings: PD(max) = 800 mW,
VCE(max) = 15V and IC(max) = 100mA. Determine the maximum value to which VCC
can be adjusted without exceeding a rating which rating would be exceeded first?
(20 marks)
22.Determine whether or not the transistor in figure are saturated.
Assume VCE(sat) = 0.2.
(20 marks)
Basic Electricity & Electronics
IT 1011
for
Second Semester
Sample Answer & Question
1. Determine the forward voltage and forward current for the diode in figure for
each of the diode models. Also find the voltage across the limiting resistor in
each case. Assume r'd = 10 ohms.
(10 marks)
Figure
Solution:
Complex model:
IF =
VBIAS в€’ 0.7 V 5V в€’ 0.7 V
4.3V
=
= 4.26mA
=
'
1kΩ + 10Ω 1010Ω
R LIMIT + rd
VF = 0.7 V + I F rd' = 0.7 V + (4.26mA)(10Ω) = 743mV
VLIMIT = I F R LIMIT = (4.26mA)(1kΩ) = 4.26V
2. Determinte the reverse voltage and reverse current for the diode in figure1. (b)
for each of the diode models. Also find the voltage across the limiting resistor in
each case. Assume IR = 1 microAmpere.
(10 marks)
Figure
Solution:
3. Sketch the output voltage of each rectifier circuit for the indicated input voltages,
as shown in fig. (a), (b)
(10 marks)
Figure (a)
Fig (b)
).
Solution:
3(b)
Solution:
4.Determine the peak and average power delivered to RL in figure 2.2.
(10 marks)
Figure 2.2
Solution:
5.Consider the circuit in figure 2.3.
(10 marks)
Figure 2.3
(a) What type of circuit is this?
(b) What is the total peak secondary voltage?
(c) Find the peak voltage across each half of the secondary.
(d) Sketch the voltage wave form across RL.
(e) What is the peak current through each diode?
(f) What is the PIV for each diode?
Solution:
Vp ( pri ) = 1.414Vrms = 1.414(110)
= 155.54
(a)
(b)
This type of circuit is full-wave center-tapped rectifier.
вЋ› N sec вЋћ
вЋџвЋџVp( pri )
Vp(sec) = вЋњвЋњ
вЋќ Npri вЋ 1
(155.4) =38.885 v
4
V sec
38.885
=
= 19.4425v
2
2
=
(c)
(d)
v
(e)
V sec
- 0.7v
2
= 19.4425-0.7
Vp ( out ) =
= 18.7425v
Ipeak =
(f)
Vp(out ) 18.7425
=
= 0.085A
R
220
PIV = 2Vp(out) + 0.7v
= 38.185v`
6. Determine the output voltage for the bridge rectifier in figure 2.4. What PIV rating
is required for the silicon diodes? The transformer is specified to have a 12 Vrms
secondary voltage for the standard 110 V across the primary. (10 marks)
Figure
Solution:
The peak output voltage is
Vp (sec) = 1.414 vrms
= 1.414(12v)
= 17v
Vp(out) = Vp(sec) – 1.4v
= 17v-1.4v
= 15.6v
The PIV for each diode is
PIV =Vp(out)+ 0.7v
= 16.3v
7.Determine the ripple faction for the filtered bridge rectifier in figure 2.5. (20 marks)
Figure
The peak primary voltage is
Vp(pri) = 1.414(115)v =163v
The peak secondary voltage is
1
(163) = 16.3
Vp(sec) =
10
Vp(in) = Vp(sec) – 1.4v = 14.9v
VDC = (1-
вЋЎ вЋ›
вЋћвЋ¤
1
1
вЋџвЋџвЋҐ 14.9
) Vp(in) = вЋў1 в€’ вЋњвЋњ
2 fRLc
вЋЈ вЋќ (240)(2.2)(50) вЋ вЋ¦
= (1-0.038)14.9v = 14.3v
вЋ› 1 вЋћ
вЋџвЋџ Vp(in)
Vr = вЋњвЋњ
вЋќ fRlc вЋ вЋЎ
вЋ¤
1
вЋў (120)(2.2)(50) вЋҐ (14.9)
вЋЈ
вЋ¦
=
= 1.13v
Vr
r= V
DC
1.13
14.3 = 0.079v
=
The percent ripple is 7.9%.
8.A 120 Hz full-wave rectified voltage with a peak value of 162 V is applied to the
LC filter in figure. Determine the filter output in terms of its dc value and the rms
ripple voltage. (20 marks)
Figure
Solution:
. VDC(IN) = VAVG =
2V p
ПЂ
=
2(162)
ПЂ
= 103v
Vr (in) = 0.308 Vp = 0.308 (162) = 49.9v
VDC(OUT)
Xl
=
2 ПЂfl
=
Xc =
вЋЎ
вЋ¤
Rl
вЋЎ1вЋ¤
вЋў
вЋҐ VDC(IN) = вЋў вЋҐ
вЋЈ1.1вЋ¦
вЋЈ ( Rw + Rl ) вЋ¦
= 2
ПЂ (120)(1000) =
754
(103) = 93.6v
Ω
1
1
= 26.5 Ω
=
2ПЂfc
2ПЂ (120)(50)
вЋЎ Xl
вЋ¤
вЋў
вЋҐ Vr(in)
вЋўвЋЈ X l в€’ X c вЋҐвЋ¦
вЋЎ 26.5 вЋ¤
= вЋў
вЋҐ (49.9)
вЋўвЋЈ 754 в€’ 26.5 вЋҐвЋ¦
= 1.82Vrms
Vr(out) =
9. A certain full-wave rectifier has a peak output voltage of 30V. A 50microF
capacitor filter is connected to the rectifier. Calculate the peak-to-peak ripple and
the dc output voltage developed across a 600 ohms load resistance. What is the
percentage of ripple for that rectifier filter.
(20 marks)
Solution:
Vp (in) = 30v
c = 50Вµf
Rl
600 Ω
=
VDC =
=
вЋЎ вЋ› 1
вЋў1 в€’ вЋњвЋњ
вЋЈвЋў вЋќ 2 fR
вЋћвЋ¤
вЋџвЋҐ Vp(in)
c вЋџвЋ вЋ¦вЋҐ
вЋЎ вЋ›
вЋћвЋ¤
1
вЋџвЋџвЋҐ (30)
вЋў1 в€’ вЋњвЋњ
вЋЈ вЋќ 2(120)(600)(50) вЋ вЋ¦
= (1-0.138) 30 = 25.86v
Vr
вЋЎ 1 вЋ¤
вЋў
вЋҐ Vp(in)
fR
c
вЋЈ l вЋ¦
=
вЋЎ
вЋ¤
1
= вЋў
вЋҐ 30
вЋЈ (120)(600)(50) вЋ¦
= (0.277)30 = 8.33v
r =
Vr
8.33
=
= 0.322v
V DC
25.86
10.A certain zener diode has a ZZT = 6.8 V at IZT = 20 mA, and IZM = 50 mA. What
is the voltage across the zener terminals when the current is 30 mA? When the current
is 10 mA?
(10 marks)
IZ
∆l Z
VZ
+
∆l Z
-
+
-
VZ = VZT
Solution:
ZZT = 5Ω, VZT = 6.8 V
For I z = 30mA : The 30mA current is a 10mA increase above I ZT = 20mA .
∆I Z = I Z − I ZT = +10mA
∆VZ = ∆I Z I ZT = (10mA)(5Ω) − +50mV
VZ = 6.8V + ∆VZ = 6.8V + 50mV = 6.85V
For I Z = 10mA : The 10mA current is 10 mA decrease below I ZT = 20mA
∆l Z = −10mA
∆VZ = ∆l Z Z ZT = (−10mA)(5Ω) = −50mV
VZ = 6.8V − ∆VZ = 6.8V − 50V = 6.75V
11.Determine the minimum and the maximum input voltages that can be regulated by
the zener diode in Figure
(20 marks)
Figure
Solution:
VZ = 5.1V at IZT = 49mA, IZK = 1mA, and ZZ = 7Ω at IZT. The equivalent circuit is shown
in figure. At IZK = 1mA, the output voltage is
VOUT = 5.1V - ∆VZ – 5.1V – (IZT_IZK) ZZ
= 5.1V – (48mA) ( 7Ω) = 5.1V – 0.336V = 4.76V
Therefore,
VIN(min) = IZK R + VOUT = (1mA)(100 Ω) + 4.76V = 4.86V
IZM = PD(max) / VZ = 1W/5.1V = 196mA
VOUT = 5.1V+ ∆VZ = 5.1V + (IZM - IZT) ZZ
= 5.1V + (147mA) (7Ω) = 5.1V + 1.03V = 6.13V
VIN(max) = IZMR + VOUT = (196mA)(100 Ω) + 6.13V = 25.7 V
12. Determine the minimum and the maximum load currents for which the zener
diode in Figure will maintain regulation. What is the minimum RL the can be used?
VZ = 12 V, IZK = 1mA and IZM = 50mA. Assume ZZ = 0 ohm and VZ remains a
constant 12 V over the range of current values for simplicity.
(20 marks)
Figure
Solution:
When I L = 0A ( R L = О± )
I Z (max) = I T = (VIN − VZ ) / R = (24V − 12V)470Ω = 25.5mA
I L (max) = 0A
When R L (min) в‡’ I L = I T в€’ I ZK = 25.5mA в€’ 1mA = 24.5mA
R L (min) = VZ / I L (max) = 12V / 24.5mA = 490Ω
13 .For the circuit in Figure.
(a) Determine VOUT at IZK and at IZM.
(b) Calculate the value of R that should be used.
(20 marks)
(c) Determine the minimum value of RL that can be used.
Figure
Solution:
(a) FOR IZK:
(b)
(c)
VOUT = VZ = 15V -∆IZ ZZT = 15V –(IZT-IZK )ZZT
= 15V – (16.75mA) (14Ω) = 15V – 0.235V = 14.76V
IZM = PD(max) / VZ = 1W / 15V =66.7mA
For IZM:
VOUT = VZ = 15V + ∆IZIZZT
= 15V + (IZM - IZT) ZZT = 15V + (49.7mA)(14 Ω)
R = (VIN- VZ ) / IZM = (24V – 15.7V) / 66.7V = 124 Ω
R = 130 Ω
IT = (VIN – VOUT) / R = (24V – 14.7V) / 130 Ω = 71.0mA
IL = IT –IZK = 71.0mA – 0.25mA
RL(min) = VOUT / IL = 14.76V / 70.75mA = 209 Ω
(a)
(b)
14.To what value must R be adjusted in figure to make IZ = 40mA? Assume VZ = 12
V at 30 mA and ZZ = 30 ohms.
(20 marks)
Figure
Solution:
∆Iz = 40-30 = 10mA
∆Vz = ∆Iz Zz = 10(30mA) = 0.3v
Vz = 12+ ∆Vz = 12+0.3 = 12v
R=
Vin в€’ V z
18 в€’ 12.3
=
= 142.5v
I
40mA
15. A loaded zener regulator is shown in figure. VZ = 5.1 V at 35 mA, IZK = 1mA, ZZ
= 12 ohms and IZM = 70mA. Determine the minimum and maximum permissible load
currents.
(20 marks)
Figure
Solution:
When Rl =
в€ћ , Iz (max) = It =
Vinв€’V z
R
8 в€’ 5.1
=
22
= 0.131A
I L (min) = 0A
When R L (min) в‡’ I L (max) = I T в€’ I ZK
= 0.131 – 1 mA
= 0.1308 A
16. State the mathematical relationship between О±DC and ОІDC. (20 marks)
Solution:
17.Determine IB,IC,IE,VBE,VCE and VCB in the circuit of figure 4.1. The transistor
has a ОІDC = 150.
(20 marks)
Figure
Solution:
18.Determine IB,IC,IE,VBE,VCE and VCB in figure for the following values: RB =
22kohm, RC = 220 ohms, VBB = 6V, VCC = 9V and ОІDC = 90. (20 marks)
Figure
Solution:
19. Determine whether or not the transistor in figure is in saturation. Assume VCE(sat)
= 0.2.
(20 marks)
Figure
Solution:
20. Determine whether or not the transistor in figureis saturated for the following
values: ОІDC = 125, VBB = 1.5V, RB = 6.8kohms, VCE(sat) = 0.2, RC = 180 ohms, and VCC
= 12 V.
(20 marks)
Figure
Solution:
IC (sat) = VCC – VCE (sat) = 12 – 0.2 = 0.065 A
RC
18
IB = VBB – VBE = 1.5 – 0.7 = 1.176 x 10-4A
RB
6.8k Ω
IC = βDC – IB = 1258 x 1.176x 10-4 = 0.014A
Therefore, IC < IC (sat)
Therefore, transistor is not saturated.
21. The transistor in figure has the following maximum ratings: PD(max) = 800 mW,
VCE(max) = 15V and IC(max) = 100mA. Determine the maximum value to which VCC
can be adjusted without exceeding a rating which rating would be exceeded first?
(20 marks)
Figure
Solution:
IB = (VBB - VBE) / RB = (5V – 0.7V) / 22kΩ = 195 µA
IC = ОІDC IB = (100)(195 ВµA) = 19.5 mA
VRC = IC RC = (19.5mA)(1kΩ) = 19.5 V
When VCE = VCE (max) = 15V
VRC = VCC – VCE
VCC (max) = VCE (max) + VRC = 15V + 19.5V = 34.5V
PD = VCE (max) IC = (15V)(19.5mA) = 293mW
If the base current is removed causing the transistor to turn off,
VCE (max) = VCC = 34.5V
22.Determine whether or not the transistor in figure are saturated.
Assume VCE(sat) = 0.2. (20 marks)
Figure
Solution:
IC(sat) = VCC – VCE (sat) = 15 – 0.2 = 0.082 A
RC
180
IB = VBB – VBE = 5 – 0.7 = 1.102mA
RB
3.9k Ω
IC = ОІDC IB = 50 x 1.102 mA = 0.055 mA
Therefore, IC < IC (sat)
Therefore, transistor is not saturated.
Introduction to Computer System
IT 1012
Sample Question
for
Second semester
1. Write a program that determines whether a given integer is even or add. (10 marks)
2. Create a program that test whether a given integer is zero or positive or negative.
(10 marks)
3. Write a program that test on exam mark is pass, pass with Distinction or fail.
(10 marks)
4. Write a program that will input numbers and find the maximum number and minimum
numbers.
(10 marks)
5. Write a program to sort the three integers a, b and c in ascending order. The number
will be given from the keyboard.
(10 marks)
6. Write a program to input two numbers and then display the following menu:
Вѓ Sum of two numbers
Вѓ Subtract the second number from the first
Вѓ Multiply the two numbers by the second
Вѓ Divide the two numbers by the second
Вѓ None of the above
The program will then produce the output selected by the user from the menu.
(20 marks)
7. Write an appropriate control structure that will examine the value of a following point
variable called temp and print one of the following messages, depending on the value
assigned to temp.
(10 marks)
(a) ICE, if the value of temp is less than 0.
(b) WATER, if the value of temp lies between 0 and 100,
(c) STEAM, if the value of temp exceeds 100.
8. Write a program that reads a grade A, B, C, D or F and then print “Excellent”, “Good”,
“Fair”, “Poor”, and “Fail”.
(10 marks)
9. Write a program to calculate the sum of the given ten integers and then display the
result. Ask the user to input ten integers.
(5 marks)
10. Write a program to calculate the sum and average value of the given integers. (by
while loop)
(10 marks)
11. Write a program to calculate the sum and average value of the given integers. (by do
while loop)
(10 marks)
12. Write a program to find and display the sum of the successive even integers 2, 4, …
200.
(5 marks)
13. Write a program to find and display the sum of the successive add integers 1, 3, …..
199.
(5 marks)
14. Write a program to find the sum of the following series.
(5 marks)
7, 11, 15, 19, 23, 31, 35, 39, 43.
15. Write a program to find the factorial value for a given number
n ! = 1*2*3* ... *n
(10 marks)
16. Suppose you deposit $ 50 per month in blank account every month for a year. Every
month, after the deposit has been made interest at the rate of 1 % is added to the balance.
Eg. After one month, the balance is $ 50.5, and after two month it is $ 101.51. Write a
program to calculate the balance for one year.
(10 marks)
17. Ten students in a class write a test. Three subject marks enter as input data for each
student. Write a program which will read all ten students marks from the keyboard and
determine the result as follow.
(20 marks)
Roll No.
Subject 1
Subject 2
Subject 3
Total
Remark
1
67
85
70
222
Pass with Credit
2
35
68
59
162
Fail
3
70
60
57
187
Pass
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10
67
75
65
207
Pass
18. Create a function to calculate the sum and product of the given two integers. Write a
program to implement function.
(10 marks)
19. Write a function to calculate the area of a room. Ask the user to enter the length and
width of the room.
(10 marks)
20.Write a function to calculate tax amount from the amount of purchase. Ask the user to
enter the amount of purchase and then call tax (float) function to calculate tax and then
display the amount of purchase, amount of tax and total amount. Use tax rate = 0.065.
(10 marks)
21. Write the functions to calculate the following equations.
x cos (a) + y sin (a) , - x sin (a) + y cos (a)
(20 marks)
22. Write your own function
double Mypow (double a, double b);
to return the value of ab, calculated as
exp ( b * log (a) )
Try it out in a test program (remember to include math.h)
(10 marks)
23. Write your own C++ function to compute the exponential function directly from the
Tayler series:
(20 marks)
ex + 1 + x + n2 / 2! + n3 / 3! + --24. Write a function Bin (int n, int r) which returns the binomial coefficient n! / (r!(r-n)! ).
(20 marks)
25. Write a function to find the Fibonacci numbers are generated by the sequence 1, 1, 2,
3, 5, 8, 13, ….
(20 marks)
26. Write a program to perform the following:
(20 marks)
- Accept three numbers
- Calculate average
- Find smallest and largest numbers
- Display the results such as average, maximum, and minimum.
27. Write a program or function the max: number of the 10 integers. (20 marks)
28. Write some statements to put some Fibonacci numbers (1, 2, 3, 5, 8, 13, …) int an
array F[0],…. What is the largest one which can be represented exactly?
(10 marks)
29. Salary level at any educational institution are (in thousand of dollars) 9, 10, 12, 15,
20, 35 and 50. The numbers of employees at each level are respectively, 3000, 2500,
1500, 1000, 400, 100, 25. Write a program which finds and writes.
(a) the average salary level;
(b) the number of employees above and below the average level,
(c) the average salary earned by an individual in the institution. (20 marks)
30. Write a program which finds the mean of the elements of an array, and the element of
the array furthest in absolute value from the mean. Eg. If the array elements are -4, 0, 5, 1, 10, 3, 4, 1, 2, 4
The element 10 is furthest from the mean.
(20 marks)
31. Write a program to sort the n integers by using exchange sort method.
(20 marks)
32. Write a program to sort the n integers by using bubble sort method.
(By using ascending order)
(20 marks)
33. List an integer array with n elements. By using linear search, write a program to
search a number in that array. Display “Found” if the search number is found or display
“Not found” if the search number is not found.
(20 marks)
34. List an integers array with n elements and write a program to search a number in that
array by using binary search method. Display a “Found” if the search number is found or
display “Not found” if it is not found.
(20 marks)
Introduction to Computer System
IT 1012
Sample Answer and Question
for
Second semester
2
1. Write a program that determines whether a given integer is even or add.(10 marks)
Answer
# include <iostream.h>
void main ( )
{ int num;
cout << “Enter a number”;
cin >> num;
if (num % 2 == 0 )
cout << “Enter number”;
else
cout << “Odd number”;
}
2. Create a program that test whether a given integer is zero or positive or negative.
(10 marks)
Answer
# include <iostream.h>
void main ( )
{ int num;
cout << “Enter a number”;
cin >> num;
if (num <0) cout <<”Negative”;
else if (num >0) cout << “Positive”;
else cout << “Zero”;
}
3. Write a program that test on exam mark is pass, pass with Distinction or fail. (10 marks)
Answer
#include<iostream.h>
void main()
{
int x;
cout<<”Enter three exam mark”;
cin>>x>>y>>z;
if(x>=40&& y>=40&& z>=40)
{
if(x>=80&& y>=80&& z>=80)
cout<<”pass with Distinction”;
else if(x>=65&& y>=65&& z>=65)
cout<<”pass with Credit”;
else cout<<”Pass”;
}
else cout<<”fail”;
getch();
}
3
4. Write a program that will input numbers and find the maximum number and minimum
numbers.
(10 marks)
Answer
# include <iostream.h>
void main ( )
{ int x, y;
cout << “Enter two number”;
cin << x >> y;
if ( x > y )
cout << x << “is max” << y << “is min”;
else cout << y << “is max” << x << “is min”;
}
5. Write a program to sort the three integers a, b and c in ascending order. The number will be
given from the keyboard.
(10 marks)
Answer
# include <iostream.h>
void main ( )
{ int a, b, c, max, mid, min;
cout << “Enter three numbers”;
cin >> a >> b >> c;
if (a > b && a > c)
{ max = a;
if (b>c)
{ mid = b;
min = c;
}
else
{ mid = c
min = b
}
}
else if (b > a && b > c)
{ max = b;
if (a > c)
{ mid = a;
min = c;
}
else
{ mid = c;
min = a;
}
}
else { max = c;
if (a > b)
4
{ mid =a;
min = b;
}
else { mid = b;
min = a;
}
}
cout << min << “\t” << mid << “\t” << max;
}
6. Write a program to input two numbers and then display the following menu:
Вѓ Sum of two numbers
Вѓ Subtract the second number from the first
Вѓ Multiply the two numbers by the second
Вѓ Divide the two numbers by the second
Вѓ None of the above
The program will then produce the output selected by the user from the menu. (20 marks)
Anwer
#include <iostream.h>
void main
{ int a, b, x;
cout << “Enter two numbers”;
cin << a >> b;
cout << “ 1. Sum of two numbers”;
2. Subtract the second number from the first \n
3. Multiply the two numbers by the second \n
4. Divided the two numbers by the second \n
5. None of the above”
cout << “Enter select number”;
cin >> x ;
Switch (x)
{ case 1: cout << “Sum =” << a + b; break;
case 2: cout << “Subtract =” << a – b; break;
case 3: cout << “Multiply =” << a * b; break;
case 4: cout << “Divide =” << a/b ; break;
default: cout << “cout << “None of above”;
}
}
7. Write an appropriate control structure that will examine the value of a following point
variable called temp and print one of the following messages, depending on the value
assigned to temp.
(10 marks)
(a) ICE, if the value of temp is less than 0.
(b) WATER, if the value of temp lies between 0 and 100,
(c) STEAM, if the value of temp exceeds 100.
5
Answer
# include <iostream.h>
voice main ( )
{ float temp;
cout << “Enter temperature”;
cin >> temp;
if (temp < 0)
cout << “ICE”;
else if (temp >= 0 && temp <= 100)
cout << “WATER”;
else cout <<”STREAM”;
}
8. Write a program that reads a grade A, B, C, D or F and then print “Excellent”, “Good”,
“Fair”, “Poor”, and “Fail”.
(10 marks)
Answer
# include <iostream.h>
void main ( )
{ char ch ;
cout << “Enter A, B, C, D or F”;
cin >> ch;
switch ( toupper (ch) )
{ case �A’ : cout << “Excellent”; break;
case �B’ : cout << “Good”; break;
case �C’ : cout << “Fair”; break;
case �D’ : cout “Poor”; break;
case �F’ : cout << “Fail”; break;
default : cout << “Invalid character”;
}
}
9. Write a program to calculate the sum of the given ten integers and then display the result.
Ask the user to input ten integers.
(5 marks)
Answer
# include <iostream.h>
void man ( )
{
int i, num, sum = 0 ;
for ( i = 0; i < 10 ; i++ )
{
cout << “Enter a number”;
cin >> num;
sum += num;
}
cout << “\n The sum is” << sum;
}
6
10. Write a program to calculate the sum and average value of the given integers. (by while
loop)
(10 marks)
Answer
# include <stdio.h>
# include <conio.h>
void main ( )
{
int i = 0, sum = 0, num;
float avg;
cout << “Enter the number”;
cin >> num;
while (num пЂЎ! = 0)
{ i++
sum += num;
cout << “Enter number”;
cin >> num;
}
avg = sum / i ;
cout << “The sum is” << sum;
cout << “The average is” << avg;
}
11. Write a program to calculate the sum and average value of the given integers. (by do
while loop)
(10
marks)
Answer
# include <iostream.h>
# include <conio.h>
void main ( )
{ int i = 0, sum = 0, num;
float avg;
do
{ cout << “Enter the number”;
cin >> num;
i++ ;
}
while (I < 5)
avg = sum / 5 ;
cout << “The sum is” << sum;
cout << “The average is” << avg;
}
12. Write a program to find and display the sum of the successive even integers 2, 4, … 200.
(5 marks)
Answer
# include <iostream.h>
# include <conio.h>
void main ( )
7
{
int i, sum = 0;
clrscr ( );
for ( i = 2; i <= 200; i+ = 2)
sum = sum + i ;
cout << “sum =” << sum;
getch ( );
}
13. Write a program to find and display the sum of the successive add integers 1, 3, ….. 199.
(5 marks)
Answer
# include <iostream.h>
# include <conio.h>
void main ( )
{
int i, sum = 0;
clrscr ( );
for ( i = 1; i <= 199; i += 2 )
sum = sum =+ i;
cout << “Sum =” << sum;
getch ( );
}
14. Write a program to find the sum of the following series.
7, 11, 15, 19, 23, 31, 35, 39, 43.
(5 marks)
Answer
# include <iostream.h>
# include <conio.h>
void main ( )
{ int i, sum = 0;
clrscr ( );
for (i = 1; i <= 10; i++ )
sum = sum + ( (i*4) + 3 );
cout << “Sum =” << sum;
getch ( );
}
15. Write a program to find the factorial value for a given number
n ! = 1*2*3* ... *n
Answer
# include <iostream.h>
void main ( )
{ int n, f = i ;
cout << “Enter factorial number”;
cin >> n;
for ( i = 1; i <= n; i++ )
{ f *= i ; }
cout <<n << “! =” << f;
}
(10 marks)
8
16. Suppose you deposit $ 50 per month in blank account every month for a year. Every
month, after the deposit has been made interest at the rate of 1 % is added to the balance. Eg.
After one month, the balance is $ 50.5, and after two month it is $ 101.51. Write a program to
calculate the balance for one year.
(10 marks)
# include <iostream.h>
void main ( )
{ int i ; float balance = 0 ; interest ;
cout << “month \t balance \n”;
for ( i = 1; i<= 12; i++ )
{ balance += 50;
interest = (balance * 1) / 100;
balance += interest;
cout << 1 << “\t” << balance << “\n”;
}
}
17. Ten students in a class write a test. Three subject marks enter as input data for each
student. Write a program which will read all ten students marks from the keyboard and
determine the result as follow.
(20 marks)
Roll No.
Subject 1
Subject 2
Subject 3
Total
Remark
Pass with Credit
222
70
85
67
1
Fail
162
59
68
35
2
Pass
187
57
60
70
3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Pass
207
65
75
67
10
Answer
# include <iostream.h>
void main ( )
{ int i; m1, m2, m3;
cout << “Roll no \t sub 1 \t sub 2 \t sub 3 \t total \t remark \n”;
for ( i = 1; i <=10; i ++ )
{ cout << “Enter Students Marks”;
cin >> m1 >> m2 >>m3;
cout << i << “\t” << m1 << “\t” << m2 << “\t” << m3 << �\t” <<
(m1+m2+m3) << “\t”;
if ( m1 > 65 && m2 > 65 && m3 > 65 )
cout << “Pass with credit \n”;
else if ( m1 >= 50 && m2 >= 50 && m3 >= 50 )
cout << “Pass \n”;
else cout << “Fail \n”;
}
}
9
18. Create a function to calculate the sum and product of the given two integers. Write a
program to implement function.(10 marks)
Answer
# include <iostream.h>
int sum (int x, int y);
int mul (intx, int y);
void main ( )
{
int a, b;
cout << “Enter Two Number”;
cin >> a >> b;
cout << “Sum =” << (a, b);
cout << “Mul + “ << (a, b);
}
int sum (int x, int y)
{
int z;
z = x + y;
return z;
}
int Mul (intx, int y)
{ int h;
h = x * y;
return h;
}
19. Write a function to calculate the area of a room. Ask the user to enter the length and
width of the room.
(10 marks)
Answer
# include <iostream.h>
int area (int x, int y);
void main ( )
{
int l, h, A;
cout << “Enter length and wide”;
cin >> l >> h;
A = area (l, b);
cout << “Area =” << A;
}
{
int area (int x, int y)
return (x * y);
}
10
20.Write a function to calculate tax amount from the amount of purchase. Ask the user to
enter the amount of purchase and then call tax (float) function to calculate tax and then
display the amount of purchase, amount of tax and total amount. Use tax rate = 0.065.
(10 marks)
Answer
# include <iostream.h>
float tax (float P);
void main ( )
{
float P;
cout << “Enter purchase”;
cin >> P;
float t = tax (p);
cout << “Purchase =” << P;
cout << “Tax =” << t;
cout << “Total =” << (p + t);
}
float tax (float P)
{ return (0.065 * P);
}
21. Write the functions to calculate the following equations.
x cos (a) + y sin (a) , - x sin (a) + y cos (a)
Answer
# include <iostream.h>
# include <math.h>
# include <conio.h>
double Xnew (double, double, double);
double Ynew (double, double, double);
void main ( )
{
double a, x, y;
cout << “Enter a, x, y”;
cin >> a >> x >> y;
cout << “Xnew” << Xnew (x, y, a) << endl;
cout << “Ynew” << Ynew (x, y, a);
getch ( );
}
double Xnew (double x, double y, double a)
{
return (x * cos (a) + y * sin (a) );
}
double Ynew (double x, double y, double a)
{
return (-x * sin (a) + y * cos (a) );
}
(20 marks)
11
22. Write your own function
double Mypow (double a, double b);
to return the value of ab, calculated as
exp ( b * log (a) )
Try it out in a test program (remember to include math.h)
(10 marks)
(10 marks)
# include <iostream.h>
double Mypow (double a, double b);
void main ( )
{ double a, b;
cout << “Enter a & b”;
cin >> a >> b;
cout << “Mypow =” << Mypow (a, b);
}
double Mypow (double a, double b)
{ return exp ( b * log (a) );
}
23. Write your own C++ function to compute the exponential function directly from the Tayler
series:
ex + 1 + x + n2 / 2! + n3 / 3! + --(20 marks)
Answer
# include <iostream.h>
double Myexp (double n);
void main ( )
{
double x;
cout <<”Enter x”;
cin >> x;
cout << “Myexp =” << Myexp (x);
}
double Myexp (double x)
{ double e = 1, d = 1, p = 1, f = 1, i = 1;
while ( d > 0.00001)
{
p *= x;
f *= I;
i++ ;
d = p/f;
e += d;
}
return exp;
}
24. Write a function Bin (int n, int r) which returns the binomial coefficient n! / (r!(r-n)! ).
(20 marks)
12
Answer
# include <iostream.h>
double Bin (int n, int r);
int facto (int x);
void main ( )
{
int n, r;
cout << “Enter n & r”;
cin >> n >> r;
cout << Bin
}
double Bin (int n, int r)
{
double res;
res = (double)
facto (n) / (facto (n) * facto (n – r) );
return res;
}
int facto (int x)
{ int f = 1;
for (i = 1;i <= x ; i++ )
{ f *= I;
}
return f;
}
25. Write a function to find the Fibonacci numbers are generated by the sequence 1, 1, 2, 3, 5,
8, 13, ….
(20 marks)
Answer
# include <iostream.h>
void fibo (int n);
void main ( )
{ int n;
cout << “Enter How many numbers”;
cin >> n;
fibo (n);
}
void fibe (int n)
{ int f = 1, s = 1, t, n, I;
cout << f << “\t” << s << “\T” ;
for ( I = 3; I <= n; i++
{ t = f + s;
cout << t << “\t”;
f = s;
s = t;
}
}
13
26. Write a program to perform the following:
- Accept three numbers
- Calculate average
- Find smallest and largest numbers
- Display the results such as average, maximum, and minimum.
Answer
# include <iostream.h>
int a, b, c;
void accept ( );
float avg (int x, int y, int z);
int min (int x, int y, int z);
int max (int x, int y, int z);
void display (float avg, int min, int max);
void main ( )
{ float A;
int B, C;
accept ( );
A = avg (a, b, c);
B = min ( a, b, c);
C = max (a, b, c);
Display (A, B, C);
}
void accept ( )
{ cout << “Enter three numbers”;
cin >> a >> b >> c;
}
float avg (int x, int y, int z)
return (x = y + z) / 3.0 ; }
{
int min (int x, int y, int z)
{ int m;
m = x;
if (m > y)
m = y;
if (m > z)
m = z;
return m;
}
void display (float avg, int min, int max)
{ cout << “Avg =” << avg;
cout << “min =” << min;
cout << “max =” << max;
}
(20 marks)
14
27. Write a program or function the max: number of the 10 integers. (20 marks)
Answer
# include < stdio. h>
# include < conio. h>
# define MAXINT - 32768
void maximum (int n, int* cmax);
void main ( )
{
int i , num , max;
printf ( “Please enter 10 integers \n’’);
max= MAXANT;
for ( i=0; i<10; i+1)
{
Scanf (“ % d” , & num);
maximum (num, &max);
}
Printf (“ \n The maximum number entered was %d\n, max);
getch ( );
}
Void maximum ( int n, int* cmax )
{
if ( n> * cmax ) * cmax = n;
}
28. Write some statements to put some Fibonacci numbers (1, 2, 3, 5, 8, 13, …) int an array
F[0],…. What is the largest one which can be represented exactly?
(10 marks)
Answer
# include < iostream .h >
void main ( )
{
int f [100] = {1,1};
int I;
cout << “ How many Fibonacci number’’ ;
cin >> n;
for ( i=0 ; i<n-2; i++ )
{ f[i+2] = f[i]+ f[i+1];
}
Cout << “the largest num” << f(n-1) ;
}
15
29. Salary level at any educational institution are (in thousand of dollars) 9, 10, 12, 15, 20, 35
and 50. The numbers of employees at each level are respectively, 3000, 2500, 1500, 1000,
400, 100, 25. Write a program which finds and writes.
(20 marks)
(a) the average salary level;
(b) the number of employees above and below the average level,
(c) the average salary earned by an individual in the institution.
Answer
# include <iostream.h>
void main ( )
{ int I, total salary = 0, below + 0, above = 0, total = 0, total emp = o;
float avg salary , avg;
int s [7] = { 9, 10, 12, 15, 20, 35, 50 };
int e [7] = { 3000, 2500, 1500, 1000, 400, 100, 25};
for (i = 0; i < 7; i++ )
{ total salary += s [i]; }
avg salary = total salary / 7.0;
for ( i= 0; I < 7; i++ )
{ if ( s [i] < avg salary ) below += e [i];
else above += e [i];
}
for ( i= 0; i < 7; i++ )
{ total += s [i] * e [i];
total emp = e [i];
}
avg = (float) total / total emp ;
cout << “avg salary =” << avg salary;
cout << “the number of employees below level =” << below;
cout << “the number of employees above level =” << above;
cout << “individual avg” << avg;
}
30. Write a program which finds the mean of the elements of an array, and the element of the
array furthest in absolute value from the mean. Eg. If the array elements are -4, 0, 5, -1, 10, 3,
4, 1, 2, 4
The element 10 is furthest from the mean.
(20 marks)
Answer
# include <iostream.h>
# include < math.h>
void main ( )
{ int I, float d, f, sum = 0; float mean;
int A [10] = { -4, 0, 5, -1, 10, 3, 4, 1, 2, 4};
for ( i = 0; i < 10; i++ )
{ if (d < fabs (mean – A [i]) )
{ d = fabs (mean – A [1]) );
f = A [i];
}
}
cout << “farthest =” << f;
16
cout << “abs value =” << mean;
}
31. Write a program to sort the n integers by using exchange sort method.
(20 marks)
Answer
# include <iostream.h>
void sel-sort (int B [ }, int n);
void main ( )
{
int A [100], n;
cout << “How many sorting number”;
cin >> n;
for (i = 0; i < n, i++ )
{
cout << “Enter numbers”;
cin >> A [i]; }
sel-sort (A, n);
for (i = 0; i < n; i++ )
{
cout << A [i];
}
void sel-sort (int B [ ], int n)
{
int i, j, temp, min, p;
for ( i = 0; i < n – 1; i++ )
{
min = B [i];
p = i;
for ( j = i+ 1; j < n; j++ )
{ if (min > B [j] )
{ min = B [j];
p = j;
}
}
temp = B [i];
B [i] = B [p];
B [p] = temp;
}
}
32. Write a program to sort the n integers by using bubble sort method.
(By using ascending order)
Answer
# include <iostream.h>
void bub-sort (int A [ ], int n);
void main ( )
{
int A [100], n;
(20 marks)
17
cout << “How many sorting numbers”;
cin >> n;
for ( i = 0; i < n; i++ )
{
cout << “Enter numbers”;
cin >> A [i};
}
bub-sort (A, n);
for ( i = 0; i < n; i++ )
{
cout << A [i];
}
}
void bub-sort (int A [ ], int n )
{
int x, temp, l;
x = n;
while ( x > 0 )
{ l = 0;
for ( i = 0; i < x – 1; i++ )
{
if ( A [i] > A [ i + 1] )
{ temp = A [i];
A [i] = A [ I + 1];
A [ i + 1] = temp;
l =i + 1;
}
}
x = 1;
}
}
33. List an integer array with n elements. By using linear search, write a program to search a
number in that array. Display “Found” if the search number is found or display “Not found”
if the search number is not found.
(20 marks)
Answer
# include <iostream.h>
void main ( )
{
int A [100], n, num, found = 0;
cout << “How many numbers”
cin >> n;
for (int i = 0;i < n; i++ )
{
cout << “Enter number”;
cin >> A [i];
}
cout << “Enter search number”;
cin >> num;
18
i=0
while (i < && ! found )
{ if ( num == A [i] ) found = 1;
else i++ ;
}
if (found)
cout << “Found”;
else cout << “Not Found”;
}
34. List an integers array with n elements and write a program to search a number in that
array by using binary search method. Display a “Found” if the search number is found or
display “Not found” if it is not found.
(20 marks)
Answer
# include <iostream.h>
void main ( )
{ int A [100], num, n, f, l, M;
cout << “Enter how many numbers”;
cin >> n;
for ( i = 0; i < n; i++ )
{ cout << “Enter search number”;
cin >> num;
f = 0;
l = n – 1;
while ( f <= 1 && !found )
{ M = (f + i )/ 2 ;
if ( num == A [M] )
found = 1;
else if ( num > A [M] )
f = M + 1;
else l = M – 1;
}
if (found) cout << “Found”;
else
cout << “Not Found”;
}
Digital Electronic
IT 1013
for
Second Semester
Sample Question
1. Explain full adder and draw a complete logic circuit of it. (20 marks)
2. Use 74HC85 comparators to compare the magnitudes of two 8-bits numbers. Show the
comparators with proper interconnections. (10 marks)
3. What is multiplexers and draw a logic diagram for 4-inputs multiplexers.(20 marks)
4. (a) Convert the binary number 0101 to Gray code with exclusive- OR gates.(10 marks)
(b) Convert the Gray code 1011 to binary with exclusive- OR gates.(10 marks)
5. Implement the logic function specified in table by using a 74LS151 8-input data
selector/multiplexer. Compare this method with discrete logic gate implementation. (10
marks)
Inputs
Output
A2
A1
A0
Y
0
0
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
1
1
0
6. (a) Draw the logic diagram for a 1-line-to-4-line demultiplexer.(10 marks)
(b) The serial data input waveform (Data in) and data-select inputs (S0 and S1) are
shown in figure. Determine the data-output waveform on D0 trough D3 for the
demultiplexer.(10 marks)
Data in
S0
S1
7. (a) Determine the Q output waveform if the inputs shown in figure are applied to a
gated S-R latch that is initially RESET.
(b)Determine the Q output waveform if the inputs shown in figure are applied to a
gated D latch, which is initially RESET. (20 marks)
S
R
EN
8. Determine the Q and Q output waveform of the flip-flop in figure for the S, R and
CLK input in figure. Assume that the positive edge-triggered flip-flop is initially RESET.
(10 marks)
CLK
1
2
3
4
5
6
CLK
S
Q
S
C
R
o
R
9. The waveform in figure are applied to the J, K and clock inputs are indicated.
Determine the Q output, assuming that the flip-flop is initially RESET. (10 marks)
10. For the positive edge-triggered J-K flip-flop with preset and clear input in figure,
determine the Q output for the inputs shown in the timing diagram in part (a) if Q is
initially LOW.(10 marks)
Q
1
2
3
4
5
6
7
8
9
CLK
PRE
CLR
HIGH
PRE
o
Q
J
C
o
R
Q
o
CLR
11. (a) A certain application requires a one-shot with a pulse width of approximately
100ms. Using 74121 show the connections and the component values.
(b) Determine the values of REXT and CEXT that will produce a pulse width of 1 Вµs
when connected to a 74LS122. (20 marks)
12.(a) What is the output width for a 555 mono stable circuit with R1=2.2 kΩ and
C1=0.01ВµF?
(b) A 555 timer configured to run in the as table mode (oscillator) is shown in figure.
Determine the frequency of the output and duty cycle. (10 marks)
13. A 4-bit asynchronous binary counter is shown in figure. Each flip-flop is negative
edge-triggered and has a propagation delay for 10ns. Develop a timing diagram showing
the Q output of each flip-flop and determine the total propagation delay time from the
triggering edge of a clock pulse until a corresponding change can occur in the which the
counter can be operated. (10 marks)
14. Show how an asynchronous counter can be implemented having modulus of twelve
with a straight binary sequence from 0000 though 1011. (20 marks)
15. Design a counter with the irregular binary count sequence in the state diagram of
figure. Use J-K flip-flops.(30 marks)
001
(1)
010
(2)
111
(7)
101
(5)
16. Develop a synchronous 3-bit UP/DOWN counter with a Gray code sequence. The
counter should count up when an UP/
control input is 1 and count down when the
control input is 0. (30 marks)
17. Design a binary counter with the sequence shown in the state diagram of figure.
(20 marks)
0
3
11
9
5
7
18. Use 74LS160 counters to obtain a 10KHz waveform from a 1MHz clock. Show
the logic diagram. (10 marks)
19. Implement the decoding of binary state 2 and binary state 7 of a 3-bit synchronous
counter. Show the entire counter timing diagram and the output waveforms of the
decoding gates. Binary 2 = 2Q1 0
and binary 7 = Q2Q1Q0 .(20 marks)
20. Determine the overall modulus of the two cascaded counter configurations in figure.
(10 marks)
Input
Input
CTR DIV 8
CTR DIV 12
CTR DIV 10
CTR DIV 4
CTR DIV 16
CTR DIV 7
Output
CTR DIV 5
Output
Digital Electronic
IT 1013
for
Second Semester
Sample Answer & Question
1
1. Explain full adder and draw a complete logic circuit of it.(20 marks)
Answer
The full-adder accepts two input bits and an input carry and generates a sum output
and an output carry.
Truth Table for full-adder
A
0
0
0
0
1
1
1
1
A
B
B
0
0
1
1
0
0
1
1
Cin
0
1
0
1
0
1
0
1
Cout
0
0
0
1
0
1
1
1
C in =input carry
C out=output carry
ОЈ =sum
A and B=input variables
ОЈ
0
1
1
0
1
0
0
1
A B
ОЈ=(A B)
Cin
Cin
(A B) C in
Cout=AB+(A B)Cin
AB
Complete Logic circuit for a full- adder
2
2. Use 74HC85 comparators to compare the magnitudes of two 8-bits numbers. Show the
comparators with proper interconnections.(10 marks)
Answer
74HC85 comparator is 4 bit comparator, so we need two 74HC85 comparator to compare the
magnitude of two 8 bits numbers. They are connected as the following figure.
LSBs
A0
A1
A2
A3
+5V
0
A
3
A>B
A=B
A<B
0
B0
B1
B2
B3
3
A>B
A=B
A<B
B
74HC85
MSBs
A4
A5
A5
A6
B4
B5
B5
B6
0
A
3
A>B
A=B
A<B
0
3
A>B
A=B
A<B
Output
B
74HC85
Q.3 What is multiplexers and draw a logic diagram for 4-inputs multiplexers.(20 marks)
Answer
A multiplexer (MUX) is a device that allows digital information from several sources to be
routed onto s dingle line for transmission over that line to a common destination. The basic
multiplexer has several data input lines and a single output line. It also has data select inputs
which permit digital data on any one of the inputs to be switched to the output line. Multiplexers
are also known as data selectors.
S0
S1
0
o
o
1
D0
D1
Y
D2
3
D3
Data Select Inputs
S1
S0
0
0
0
1
1
0
1
1
Input Selected
D0
D1
D2
D3
Logic diagram for a 4-input multiplexer
4. (a) Convert the binary number 0101 to Gray code with exclusive- OR gates.(10 marks)
(b) Convert the Gray code 1011 to binary with exclusive- OR gates.(10 marks)
Answer
(a)
Binary = 0101
Binary
Gray
LSB 1
1
0
1
1
0
1
0
MSB
Gray code for binary 01012 is 0111
4
(b)
Gray Code = 1011
Gray
Binary
LSB 1
1
1
0
0
1
1
1
MSB
Binary number for Gray code 1011 is 1101
5. Implement the logic function specified in table by using a 74LS151 8-input data
selector/multiplexer. Compare this method with discrete logic gate implementation. (10 marks)
5
Inputs
Output
A2
A1
A0
Y
0
0
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
1
1
0
Solution:
Y=
2 1A0+ 2A1A0+A2A1 0
EN
Input
Variables
+5V
A0
A1
A2
0
2
001
011
101
110
MUX
G
Y=
0
1
2
3
4
5
6
7
74LS151
2 1A0+ 2A1A0+A2A1 0
6
The implementation of this function with logic gates would required four 3-input AND gates,
one4-input OR and three inverters unless the expression can be simplified.
6. (a) Draw the logic diagram for a 1-line-to-4-line demultiplexer.(10 marks)
(b) The serial data input waveform (Data in) and data-select inputs (S0 and S1) are shown in
figure. Determine the data-output waveform on D0 trough D3 for the demultiplexer.(10 marks)
Data in
S0
S1
Answer
(a) A 1-line-to-4-line demultiplexer
Data
Input
Select
lines
S0
o
S1
o
D0
D1
D2
Data
Output
lines
D3
(b)
7
Data
in
S0
S1
D0
D1
D2
D3
7. (a) Determine the Q output waveform if the inputs shown in figure are applied to a gated S-R
latch that is initially RESET.
(b)Determine the Q output waveform if the inputs shown in figure are applied to a gated D
latch, which is initially RESET. (20 marks)
8
S
R
EN
Solution:
9
8. Determine the Q and Q output waveform of the flip-flop in figure for the S, R and CLK input
in figure. Assume that the positive edge-triggered flip-flop is initially RESET. (10 marks)
CLK
1
2
3
4
5
6
CLK
S
R
Q
S
C
R
Q
o
Solution:
1. At clock pulse 1, S is LOW and R is LOW, so Q does not change.
2. At clock pulse 2, S is LOW and R is HIGH, so Q remains LOW (RESET).
3. At clock pulse 3, S is HIGH and R is LOW, so Q goes HIGH (SET).
4. At clock pulse 4, S is LOW and R is HIGH, so Q goes LOW (RESET).
5. At clock pulse 5, S is HIGH and R is LOW, so Q goes HIGH(SET).
6. At clock pulse 6, S is HIGH and R is LOW, so Q stays HIGH.
9. The waveform in figure are applied to the J, K and clock inputs are indicated. Determine the
Q output, assuming that the flip-flop is initially RESET. (10 marks)
10
Solution:
10. For the positive edge-triggered J-K flip-flop with preset and clear input in figure, determine
the Q output for the inputs shown in the timing diagram in part (a) if Q is initially LOW.(10
marks)
11
1
2
3
4
5
6
7
8
9
CLK
PRE
CLR
HIGH
PRE
o
Q
J
C
o
R
Q
o
CLR
Solution:
12
11. (a) A certain application requires a one-shot with a pulse width of approximately 100ms.
Using 74121 show the connections and the component values.
(b) Determine the values of REXT and CEXT that will produce a pulse width of 1 Вµs when
connected to a 74LS122. (20 marks)
Solution:
13
(a)
(b)
12.(a) What is the output width for a 555 mono stable circuit with R1=2.2 kΩ and C1=0.01µF?
(b) A 555 timer configured to run in the as table mode (oscillator) is shown in figure.
Determine the frequency of the output and duty cycle. (10 marks)
Solution:
(a) tw = 1.1R1C1 = 1.1(2.2k-ohm)(0.01 micro-F) = 24.2 micro-s.
14
+5.5V
R1
2.2kΩ
VCC
4.7 kΩ
R2
THRESH
TRIG
C1
0.022 ВµF
C2
0.01ВµF
(b)
13. A 4-bit asynchronous binary counter is shown in figure. Each flip-flop is negative edgetriggered and has a propagation delay for 10ns. Develop a timing diagram showing the Q output
of each flip-flop and determine the total propagation delay time from the triggering edge of a
clock pulse until a corresponding change can occur in the which the counter can be operated. (10
marks)
15
HIGH
•
•
•
FF0
•
CLK
FF1
Q0
J0
•
FF2
Q1
J1
o C
•
2
3
4
5
6
•
o C
K2
7
8
9
10
11
Q3
J3
o C
K1
1
FF3
Q2
J2
o C
K0
CLK
•
K3
12
13
14
15
16
Q0
Q1
-
Q2
Q3
Solution
tp(tot) = 4 x 10ns = 40ns
The maximum clock frequency is
Fmax = (1/ tp(tot)) = 1/40ns = 25 MHz
14. Show how an asynchronous counter can be implemented having modulus of twelve with a
straight binary sequence from 0000 though 1011. (20 marks)
Answer
When the counter gets to its last state, 1011, it must recycle back to 0000
rather than going to its normal next state of 1100 as illustrated in the following sequence
chart.
Q3
Q2
Q1
Q0
0
.
.
.
1
0
.
.
.
0
0
.
.
.
1
0
.
.
.
1
Recycles
Normal next state
16
1
1
0
0
12 decoder
o
HIGH
FF1
FF0
Q0
J0
o C
CLK
K0
CLR
o
CLK
1
2
3
FF2
Q1
J1
Q2
J2
o C
o C
K1
K2
K3
5
o
6
7
Q3
J3
o C
o
4
FF3
o
8
9
10
11
12
Q0
Q1
Glitch
Q2
Q3
Decoder
Output
Glitch
17
15. Design a counter with the irregular binary count sequence in the state diagram of figure.
Use J-K flip-flops.(30 marks)
001
(1)
010
(2)
111
(7)
101
(5)
Solution;
PRESENT STATE
Q2 Q1
Q0
0
0
1
0
1
0
1
0
1
1
1
1
OUTPUT
QN
0
0
1
1
TRANSITION
Q N+1
0
1
0
1
NEXT STATE
Q2 Q1 Q0
0
1
0
1
0
1
1
1
1
0
0
1
FLIP-FLOP
J
0
1
X
X
INPUTS
K
X
X
1
1
18
Q1
Q2Q1
0
1
00
x
0
01
1
x
11
x
x
10
x
x
Q2Q1
0
0
1
00
x
x
00
x
1
01
1
x
01
x
x
11
x
x
11
x
x
10
x
x
10
x
1
Q1
Q2Q1
J0 map
0
1
x
x
00
x
x
01
x
x
01
1
x
11
x
1
11
x
1
10
x
0
10
x
1
Q1
Q2Q1
0
1
00
x
1
01
x
x
11
x
0
10
x
0
K0 map
K1map
K2 map
J0
1
J1 map
1
J0=1,K0= 2
J1 =K1 =1
J2 =K2 =Q1
HIGH
0
Q1
Q2Q1
J2 map
Q1
Q1
Q2Q1
Q0 HIGH
Q2
Q1
J1
C
C
K0
K1
J2
C
K2
o
2
19
16. Develop a synchronous 3-bit UP/DOWN counter with a Gray code sequence. The counter
control input is 1 and count down when the control input is
should count up when an UP/
0. (30 marks)
Solution:
000
110
PRESENT STATE
001
Q2
0
0
0
0
1
1
1
1
Q1
0
0
1
1
1
1
0
0
Q0
0
1
1
0
0
1
1
0
OUTPUT TRANSITIONS
QN+1
QN
0
0
0
1
1
0
1
1
J
0
1
X
X
100
011
101
010
111
Q0Y
00
Q2Q1
00
01
11
10
Q0Y
Q2Q1
01
10
Q2Q1
Q0Y
00
Q0Y
00
01
2
1
01
11
10
00
01
11
10
00
01
11
10
Q1
11
11
10
Q2Q1
K
X
X
1
0
00
0
01
0
11
1
100
00 X
01 X
11 0
10
X
X
0
X
X
0
X
X
1
1Y
2
Q0Y
00
Q2Q1
00
01
11
10
2Q1
01
11
Q0Y
Q2Q1
00
01
11
2Q 1Y
10
00
01
11
10
Q2Q1
Q2Q0Y
K1 map
10
Q2 1Y
Q2Q1Y
2Q0
0Y
K2 map
NEXT STATE
Y=0(Down)
Y=1(Up)
Q2 Q1 Q0
Q2 Q1 Q0
1
0
0
0 0 1
0
0
0
0 1 1
0
0
1
0 1 0
0
1
1
1 1 0
0
1
0
1 1 1
1
1
0
1 0 1
1
1
1
1 0 0
1
0
1
0 0 0
Q2 20
1Y
K0 map
1
0
X
X
0
1
X
X
0
0
X
X
0
0
X
X
0
1
0
1
X
X
1
0
X
X
0
1
X
X
0
0
X
X
0
0
X
0
0
X
X
0
0
X
X
0
1
X
X
1
0
X
1
0
1
0
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
0
1
0
1
1
0
1
0
21
2 Q2 1
Q1
0
Q0
Y
J0
Q0
C
K0
J1
0
Q1
C
K1
J2
1
Q2
C
K
2
22
CLK
17. Design a binary counter with the sequence shown in the state diagram of figure.
(20 marks)
0
3
11
9
5
7
Solution:
0
J3
Q3 Q3
Q2
J2
Q2
Q1
J2
1
1
Q1
J0
Q0
1
K3
o
3
3
Q1
K2
o
2
K2
o
1
3
Q2
o
K0
Y
CLK
23
0
18. Use 74LS160 counters to obtain a 10KHz waveform from a 1MHz clock. Show the logic
diagram. (10 marks)
Solution:
To obtain 10 KHz from a 1MHz clock requires a division factor of 100. Two
74LS160 counters must be cascaded as shown in figure. The left counter produces an
RCO pulses for every 10 clock pulses. The right counter produces an RCO pulse for
every 100 clock pulses.
D0 D1 D2 D3
D0 D1 D2 D3
3
4
CTR DIV
6
5
3 4 5 6
CTR DIV 10
6
10
1
9
ENP
RC0
ENT
>C
14
CLK
1MHz
13 12
11
15
7 ENP
10
ENT
2
>C
RC0
14 13 12
15
10KHz
11
Q0 Q1 Q2 Q3
Figure:A device by 100 counter using two 74LS160 decode counters.
19. Implement the decoding of binary state 2 and binary state 7 of a 3-bit synchronous counter.
Show the entire counter timing diagram and the output waveforms of the decoding gates. Binary
2 = 2Q1 0 and binary 7 = Q2Q1Q0 .(20 marks)
24
Solution;
FF2
HIGH
FFO
FF1
Q0
J0
FF2
J1
J2
>C
>C
>C
>C
>C
>C
K1
K2
0
K0
MSB
1
7
2
CLK
1
2
3
4
5
6
7
8
Q0
Q1
Q2
2
Figure: A 3bit counter with active-HIGH decoding of count 2 and count 7.
25
20. Determine the overall modulus of the two cascaded counter configurations in figure.
(10 marks)
Input
Input
CTR DIV 8
CTR DIV 12
CTR DIV 10
CTR DIV 4
CTR DIV 16
CTR DIV 7
Output
CTR DIV 5
Output
Solution;
In figure (a), the overall for the 3 counter configuration is 8 12 16 =1536
In figure (b), the overall modulus for the 4 counter configuration is 10 4 7 5 =1400
26