CSE314S - Sheet 02
CSE314S - Sheet 02
Faculty of Engineering
Computers and Systems Engineering Department
Sheet No.: 2
Course: Systems Analysis (CS314)
Time: 2 Hours
1- A state machine with 𝐼𝑛𝑝𝑢𝑡𝑠 = {𝑎, 𝑏, 𝑐, 𝑑, 𝑎𝑏𝑠𝑒𝑛𝑡} has a state 𝑆 with two emerging arcs
with guards 𝑔𝑢𝑎𝑟𝑑1 = {𝑎} 𝑎𝑛𝑑 𝑔𝑢𝑎𝑟𝑑2 = {𝑎, 𝑏, 𝑑}. 3.1
a. Is this state machine deterministic?
b. Define the set else for state 𝑆 and specify the source and destination state for the
else arc.
2- For the answering service example of the flowing figure assume the input sequence is
(𝑜𝑓𝑓ℎ𝑜𝑜𝑘; 𝑜𝑓𝑓ℎ𝑜𝑜𝑘; 𝑟𝑖𝑛𝑔; 𝑜𝑓𝑓ℎ𝑜𝑜𝑘; 𝑟𝑖𝑛𝑔; 𝑟𝑖𝑛𝑔; 𝑟𝑖𝑛𝑔; 𝑜𝑓𝑓ℎ𝑜𝑜𝑘;···) This corresponds to a
user of the answering service making two phone calls, answering a third after the first
ring, and answering a second after the third ring. 3.2
a. Give the state response of the answering service.
b. Give the trace of the answering service.
c. Give the output sequence.
3- Consider the alphabets 𝐼𝑛𝑝𝑢𝑡𝑠 = 𝑂𝑢𝑡𝑝𝑢𝑡𝑠 = 𝐵𝑖𝑛𝑎𝑟𝑦 = {0,1} note that there is no
stuttering input or output symbols here. This simplifies the notation in the problem
somewhat.3.3
1
Minia University
Faculty of Engineering
Computers and Systems Engineering Department
Sheet No.: 2
Course: Systems Analysis (CS314)
Time: 2 Hours
a. Construct a state machine that uses these alphabets such that given any input
sequence (𝑥(0), 𝑥(1), . . ) without stuttering symbols, the output sequence is given
by, ∀𝑛 ∈ ℕ0 ,
1 𝑖𝑓 𝑛 ≥ 2 ∧ (𝑥(𝑛 − 2), 𝑥(𝑛 − 1), 𝑥(𝑛)) = (1,1,1)
𝑦(𝑛) = {
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
In words, the machine outputs 1 if the current input symbol and the two previous
input symbols are all 1’s, otherwise it outputs 0. (Had we included a stuttering
symbol, the above equation would be a bit more complicated.)
b. For the same input and output alphabet, construct a state machine that outputs 1
if the current input symbol and two previous input symbols are either
(1,1,1) 𝑜𝑟 (1, 0, 1), and otherwise it outputs 0.
4- A modulo 𝑁 counter is a device that can output any integer between 0 and 𝑁 − 1. The
device has three input symbols, increment, decrement, and reset, plus, as always, a
stuttering symbol absent; increment increases the output integer by 1 decrement
decreases this integer by 1; and reset sets the output symbol to 0. Here increment and
decrement are modulo 𝑁 operations. Unless otherwise stated, you may assume that the
counter begins at 0. Note: Modulo 𝑁 numbers work as follows. For any integer 𝑚,
𝑚 𝑚𝑜𝑑 𝑁 = 𝑘 𝑤ℎ𝑒𝑟𝑒 0 ≤ 𝑘 ≤ 𝑁 − 1 is the unique integer such that 𝑁
𝑑𝑖𝑣𝑖𝑑𝑒𝑠 (𝑚 − 𝑘). Thus there are only 𝑁 distinct 𝑚𝑜𝑑𝑢𝑙𝑜 − 𝑁 numbers, namely, 0;···
; 𝑁 − 1. 3.4
a. Give the state transition diagram of this counter for N = 4.
b. Give the update table of this counter for N = 4.
c. Give a description of the state machine by specifying the five entities
𝑆𝑡𝑎𝑡𝑒𝑀𝑎𝑐ℎ𝑖𝑛𝑒 = (𝑆𝑡𝑎𝑡𝑒𝑠; 𝐼𝑛𝑝𝑢𝑡𝑠; 𝑂𝑢𝑡𝑝𝑢𝑡𝑠; 𝑢𝑝𝑑𝑎𝑡𝑒; 𝑖𝑛𝑖𝑡𝑖𝑎𝑙𝑆𝑡𝑎𝑡𝑒)again, assume N = 4.
d. Take 𝑁 = 3. Calculate the state response for the input sequence
(𝑖𝑛𝑐𝑟𝑒𝑚𝑒𝑛𝑡 4 ; 𝑑𝑒𝑐𝑟𝑒𝑚𝑒𝑛𝑡 3 ;···) starting with initial state 1, where 𝑠 𝑛 means 𝑠
repeated 𝑛 times. You may give the state response for the first seven reactions
only.
2
Minia University
Faculty of Engineering
Computers and Systems Engineering Department
Sheet No.: 2
Course: Systems Analysis (CS314)
Time: 2 Hours
8- For the nondeterministic state machine in the Figure blow the input and output alphabets
are 𝑖𝑛𝑝𝑢𝑡𝑠 = 𝑜𝑢𝑡𝑝𝑢𝑡𝑠 = {0,1, 𝑎𝑏𝑠𝑒𝑛𝑡}.3.9
3
Minia University
Faculty of Engineering
Computers and Systems Engineering Department
Sheet No.: 2
Course: Systems Analysis (CS314)
Time: 2 Hours
𝑛
9- Use induction to show that if 𝐴 = [
𝑎 1
] then for all 𝑛 ≥ 0 𝐴𝑛 = [𝑎 𝑛𝑎𝑛−1 ] 5.2
0 𝑎 0 𝑎𝑛
(a, 1) (b, 1)
(b, 1) (c, 0)
4
Minia University
Faculty of Engineering
Computers and Systems Engineering Department
Sheet No.: 2
Course: Systems Analysis (CS314)
Time: 2 Hours
(c, 1) (d, 0)
(d, 1) (e, 1)
(𝑒, 1) (f, 0)
(𝑓, 1) (𝑎, 0)