Practice Exam
Please answer the following to the best of your ability. Read all directions and try your best.
1. What are the three things needed to have a working loop?
a. Updating condition, initial condition, and condition to continue
b. Condition to c
PreLab 11a
CS 122L  5 Points Total
Objectives
Learn about several MATLAB builtins that will be useful in the upcoming lab.
Deliverables
Submit your prelab answers in Bblearn under the Lab 11 prelab assignment area prior
to the start of class.
1) Re
PreLab 8
CS 122L  5 Points Total
Objectives
Learn how to write a matrix to a file in a delimiter separated format
Practice with for loops
Deliverables
Submit your prelab answers in Bblearn under the Lab 8 prelab assignment area prior
to the start o
CS122 Exam 2 Notes
The floor function truncates values (floor(63.984)=63)
The rand function loads random values between 0 and 1
%load array with random numbers from
For Index=1:100
%Generate random value between 0 and 1
value=rand();
%Make value between 1
Practice Exam
Please answer the following to the best of your ability. Read all directions and try your best.
1. What are the three things needed to have a working loop?
a. Updating condition, initial condition, and condition to continue
b. Condition to c
1.) The sed command is a stream editor which can transform text. In the case shown above, sed will substitute the value
between the first two slashes (192.168.20.10) to the value between the second and third slashes (a blank space). The grep
command will
Homework 2: Universal Gates & Flip Flops
CS 200 10 Points Total
Due Wednesday, February 8, 2017
Assignment
Answer each of the following questions based on Chapter 3 of the Null textbook.
1. Which gates are called "universal" gates? Why? (2 pts)
NAND and N
Homework 1: Digital Logic
CS 200 10 Points Total
Due Wednesday, February 1, 2017
Assignment
Answer each of the following questions.
1. Draw a truth table to demonstrate that xy' is equivalent to (x'+y)'. (2 pts)
2. Use a Karnaugh Map to reduce the followi
Project 9: Maze Generator
CS 200 20 Points Total
Due Friday, April 21, 2017
Objectives
Write a recursive maze generator in assembly.
Practice using procedural calling, general assembly programming, and using a highlevel
language implementation as a refer
Homework 6: Data Encoding
CS 200 10 + 5EC Points Total
Due Wednesday, March 22, 2017
Assignment
Read Chapter 2 of the textbook. Answer the following questions.
1. What causes divide underflow? (1 pt)
Divide underflow is happens when the divisor is much sm
Homework 3: C/C+
CS 200 10 Points Total
Due Wednesday, February 22, 2017
Assignment
Name the C/C+ bitwise operator used for the following operations. (1 pt each)
1.
2.
3.
4.
5.
Test bits with a mask.
Set bits with a mask.
Multiply by a power of 2.
Toggle
Homework 4: Number Base Conversions
CS 200 10 Points Total
Due Wednesday, March 1, 2017
Assignment
Perform the following number base conversions. All necessary steps to convert by hand should be
shown  any conversion without accompanying work will be cou
Homework 8: Assembly Language
CS 200 10 Points Total
Due Wednesday, April 5, 20167
Assignment
Work the following problems.
1. QTSPIM is loaded with the following program in the user text section. It will, after
running the builtin kernel, start at the in
Project 8: Bubble Sort
CS 200 20 Points Total
Due Friday, April 14, 2017
Objectives
Write a bubble sort in assembly.
Practice conditional jumps, indirect addressing, and using procedures/subroutines.
Requirements
Write a MIPS assembly language program tha
Homework 7: ISA
CS 200 10 Points Total
Due Wednesday, March 29, 2017
Assignment
Read chapter 5 of Computer Organization and Architecture and the accompanying slides and answer the
following problems.
1. Suppose I have the following memory map.
ADDRESS
3C6
Homework 5: Converting Fractions
CS 200 10 Points Total
Due Wednesday, March 8, 2017
Assignment
1. Perform the following conversions. All necessary steps to convert by hand should be shown  any
conversion without accompanying work will be counted wrong.
1) Based on the information above, write the MATLAB code to ask the user to enter a velocity in
m/s. Be sure to store the input in a variable that has a fitting name.
 Velocity = input (please enter a number in m/s)
please enter a number in m/s 75
Veloci
We want to plot the function y = x2 over the interval [1,3]. In order to do this, we need to establish an x vector (our independent variable) and a y vector (our dependent variable).
1. Given x = [1:0.05:3], write the MATLAB code to generate our y vector
1) Write the MATLAB code to generate a random number between 1 and 3 using the randi function. You can find more information about randi at
http:/www.mathworks.com/help/matlab/ref/randi.html.
 x = randi(3);
2) a. Write the pseudocode to ask the user whi
1) a. The nthroot function allows one to specify the degree of the root they wish to take (e.g., a
cube root would have a degree of 3, square 2, etc.). Write the MATLAB code to take the 5th root
of 187.
 y = nthroot(187, 5)
b. The length function can be
1) The following questions are intended to provide definitions that will aid in your understanding of future labs.
a) What is a variable?

A Variable is a region of memory containing an Array, which is a collection of data values
organized into columns a
1) The primary form of data in MATLAB is vectors. They can be onedimensional (i.e., vectors),
or twodimensional (i.e., matrices).
a) Write the MATLAB code to create a 1x3 vector containing the elements [1,2,3]. Additionally,
write the MATLAB code to cre
1) a. Assume we have a matrix, M. Using the dlmwrite function, write the MATLAB code to
write the matrix to a file named myfile.txt, and have the content of the matrix be separated by
commas.
 M = magic(3);
dlmwrite(myfile.txt,M);
type(myfile.txt)
b. Wha
1. Given the information above, write the MATLAB code for 3 nested for loops. Use the same
variable naming scheme as above, and have the following number of iterations:

for i = [1,2];
for j = [1,3];
for k = [1,2];
fprintf(i is: 0, j is: 0, k is: 0\n, i,
1. Define eigenvector. It is OK to paste a definition you found on the Internet, but include your
source (reference), e.g. the web URL from which you obtained the definition.
 A vector that when operated on by a given operator gives a scalar multiple of
1) As you have learned, you can use the input function to accept numbers. For example, the following code accepts a number and stores it in the variable named coin:
a) Based on the above discussion, write the MATLAB code to ask the user to enter a coin (q
CS 122 L
PreLab 4
February 21, 2017
Deliverables:
1) Given x = [1:0.05:3], write the MATLAB code to generate our y vector (Hint: refer to the
original function that we are trying to plot).
> x=[1:0.05:3]
x =
Columns 1 through 9
1.0000
1.0500
1.3500
1.400
CS 122 L3
PreLab 6
March 7, 2017
Deliverables
1a) Write the MATLAB code for 3 nested for loops. Use the same variable naming scheme as
given, and have the following number of iterations:
i (the outer loop) loops from 1 to 2
j (the second loop) loops fro
CS 122 L
PreLab 3a
February 14, 2017
Deliverables:
1. Define eigenvector.
Eigenvector:
A special set of vectors associated with a linear system of equations (i.e., a matrix equation) that
are sometimes also known as characteristic vectors, proper vectors