0% found this document useful (0 votes)
112 views14 pages

Sample Quiz 1

The document provides sample problems and solutions to help prepare for a quiz on computing systems. It includes 3 problems: 1) Determining the logical functions of CMOS and logic gate circuits from their diagrams and writing the algebraic functions and truth tables. 2) Similar to the first problem, but for different CMOS and logic gate circuits. 3) Analyzing iterative programs that use loops to calculate Fibonacci sequences and factorials and determine their outputs.

Uploaded by

ganxx019
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views14 pages

Sample Quiz 1

The document provides sample problems and solutions to help prepare for a quiz on computing systems. It includes 3 problems: 1) Determining the logical functions of CMOS and logic gate circuits from their diagrams and writing the algebraic functions and truth tables. 2) Similar to the first problem, but for different CMOS and logic gate circuits. 3) Analyzing iterative programs that use loops to calculate Fibonacci sequences and factorials and determine their outputs.

Uploaded by

ganxx019
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

EE 1301 UMN

Introduction to Computing Systems Fall 2009


⊕ ⊕

Sample Problems for Quiz # 1


(with solutions)

Here are sample problems to help you prepare for Quiz 1. You’ll three problems very similar
to the problems in parts 1, 2 and 3.

1. Logic Functions from CMOS


Recall that we introduced the abstractions for transistors shown in Figure 1. A high
voltage corresponds to logical one and a low voltage to logical zero.
Determine the logical functions implemented by the CMOS circuits in Figure 2, Fig-
ure 3, and Figure 4. Write out both the algebraic functions and the corresponding
truth tables.
source source

gate gate

drain drain

n-type transistor: p-type transistor:


path from source to drain path from source to drain
closed when gate voltage is closed when gate voltage is
high; path open otherwise. low; path open otherwise.

Figure 1: n-type and p-type MOS transistors


EE 1301, Fall ’09 2

Power Power

A B

C D

A C

B D

Ground Ground

Figure 2: CMOS Circuit (a).


EE 1301, Fall ’09 3

Power Power

A B

C D

Ground Ground

Figure 3: CMOS Circuit (b).


EE 1301, Fall ’09 4

Power Power Power

A
B

Ground Ground Ground

Figure 4: CMOS Circuit (c).


EE 1301, Fall ’09 5

Solution (a)

Y = (A0 + B 0 )(C 0 + D0 ) = AB + CD

A B C D Y
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
EE 1301, Fall ’09 6

Solution (b)

Y = Ā + B̄(C̄ + D̄) = A(B + CD)

A B C D Y
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
EE 1301, Fall ’09 7

Solution (c)

Y = ĀB + AB̄ = A ⊕ B

A B Y
0 0 0
0 1 1
1 0 1
1 1 0
EE 1301, Fall ’09 8

A
C
Y
NAND
AND
D

OR

B
(a)

A A

AND AND

B B

Y Y
OR NOR
A C

AND AND
B D
(b) (c)

Figure 5: Logic Circuits.

2. Logic Functions from Logic Gates


Determine the logical functions implemented by the logic gates in in Figure 5. Write
out both the algebraic functions and the corresponding truth tables.
EE 1301, Fall ’09 9

Solution (a)

Y = A(B + CD)

A B C D Y
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
EE 1301, Fall ’09 10

Solution (b)

Y = ĀB + AB̄ = A ⊕ B

A B Y
0 0 0
0 1 1
1 0 1
1 1 0
EE 1301, Fall ’09 11

Solution (c)

Y = AB + CD

A B C D Y
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
EE 1301, Fall ’09 12

3. Iterative Programs

(a) What will the following program print out?


# include < stdio .h >

int main ()
{
int i , p , q , s , t ;
p = 1;
q = 1;
printf ( " %d , " , p );
for ( i = 1; i <= 10; ++ i ) {
printf ( " % d " , p );
s = p;
t = q;
q = p;
p = s + t;
if ( i < 10) printf ( " , " );
}
printf ( " \ n " );
}

Solution
1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89
EE 1301, Fall ’09 13

(b) What the following program print out?


# include < stdio .h >

int mario ( int base , int n )


{
int i , p ;
p = 1;
for ( i = 1; i <= n ; ++ i )
p = p * base ;
return p ;
}

int luigi ( int n )


{
int i , p ;
p = 1;
for ( i = 1; i <= n ; ++ i )
p = p * i;
return p ;
}

int main ()
{
int i , j , sum ;
for ( i = 1; i <= 10; ++ i ) {
sum = 0;
for ( j = 1; j <= i ; ++ j ) {
sum = sum + ( mario ( -1 , i - j ) * luigi ( j ));
}
printf ( " % d % d \ n " , i , sum );
}
}

1 1
2 1
3 5
4 19
5 101
6 619
7 4421
8 35899
EE 1301, Fall ’09 14

9 326981
10 3301819

You might also like