Docsity

Test 3 Sample Questions - Computing for Engineers - Fall 2007 | CS 1371, Exams of Computer Science

Toggle sidebar
bg1
CS1371 - Computing for Engineers - Test 3 Version C November 28th, 2007
Page 1 of 10
Georgia Institute of Technology
College of Computing
CS 1371 Computing for Engineers
Test 3 Version C - Fall Semester 2007
0
0
0
0
0
0
0
0
0
Prob.
Poss.
Pts
Earned
Pts
Lost
Pts
by
(cover)
-
-
1
15
2
35
3
25
4
25
TOTAL
100
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
8
8
8
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
A
A
A
A
A
A
A
A
A
B
B
B
B
B
B
B
B
B
C
C
C
C
C
C
C
C
C
D
D
D
D
D
D
D
D
D
E
E
E
E
E
E
E
E
E
F
F
F
F
F
F
F
F
F
G
G
G
G
G
G
G
G
G
H
H
H
H
H
H
H
H
H
I
I
I
I
I
I
I
I
I
J
J
J
J
J
J
J
J
J
K
K
K
K
K
K
K
K
K
L
L
L
L
L
L
L
L
L
M
M
M
M
M
M
M
M
M
N
N
N
N
N
N
N
N
N
O
O
O
O
O
O
O
O
O
P
P
P
P
P
P
P
P
P
Q
Q
Q
Q
Q
Q
Q
Q
Q
R
R
R
R
R
R
R
R
R
S
S
S
S
S
S
S
S
S
T
T
T
T
T
T
T
T
T
U
U
U
U
U
U
U
U
U
V
V
V
V
V
V
V
V
V
W
W
W
W
W
W
W
W
W
X
X
X
X
X
X
X
X
X
Y
Y
Y
Y
Y
Y
Y
Y
Y
Z
Z
Z
Z
Z
Z
Z
Z
Z
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Test 3 Sample Questions - Computing for Engineers - Fall 2007 | CS 1371 and more Exams Computer Science in PDF only on Docsity!

Georgia Institute of Technology

College of Computing

CS 1371 Computing for Engineers

Test 3 Version C - Fall Semester 2007

0 0 0 0 0 0 0 0 0  Print your T-Square username in the spaces

provided, and shade the boxes of the

corresponding numbers and/or letters.

I hereby signify that this examination paper

contains my own work exclusively, and I have

neither given nor received inappropriate help

during the taking of this examination, in

compliance with the letter and spirit of the

Academic Honor Code of Georgia Tech.

Name (print):

Signature:

TA / Section: ____________________________

Prob.

Poss.

Pts

Earned

Pts

Lost

Pts

by

(cover) - -

TOTAL 100

Please Note: Failure to complete this front sheet correctly
will cost you 5% of your grade.
Please turn off (or silence) and put away any cell
phones, beepers/pagers, personal radios or music
players that you have in your possession

Good Luck!

1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 A A A A A A A A A B B B B B B B B B C C C C C C C C C D D D D D D D D D E E E E E E E E E F F F F F F F F F G G G G G G G G G H H H H H H H H H I I I I I I I I I J J J J J J J J J K K K K K K K K K L L L L L L L L L M M M M M M M M M N N N N N N N N N O O O O O O O O O P P P P P P P P P Q Q Q Q Q Q Q Q Q R R R R R R R R R S S S S S S S S S T T T T T T T T T U U U U U U U U U V V V V V V V V V W W W W W W W W W X X X X X X X X X Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z

Academic misconduct (including - but not limited to - examples on the list below) could result in a zero score on this
examination, an “F” final grade in the course, and/or other disciplinary action:
 Failure to cooperate with or follow directions given by a proctor.
 Failure to stop writing when the allotted time is up (as reported by a proctor).
 Communication with anyone other than a proctor for ANY reason in ANY language in ANY manner.
 Sharing of ANYTHING (e.g. pencils, erasers, paper).
 Writing on paper that is not given to you by a proctor.
 Using cell phones, beepers, personal radios or music players, etc. during the exam.
 Using calculators (unless explicitly permitted) or hand-held computers during the exam.
 Using books or other reference material during the exam.
 Disruption of the exam setting.
Reference Section:
char(x) – converts the numerical vector into it string ASCII value
diff(x) – returns a vector of column differences of the vector x
double(x) – converts the string x to its ASCII representation
false(a,b) – creates a matrix of a rows and b columns of boolean false
find(m) – returns the indices of the true elements of m
image(x) - display the image from the matrix x
imread(filename) - returns a matrix representation of an image
imwrite(x, filename) – writes the image x to the file: filename
newy = interp1(x,y,newx) - Interpolates to find newy, the values of the underlying function Y at the
points in newx.
isa(a, str) – checks if the variable a belongs to the class str
ischar(a) – checks if a is of class char (a string)
isnumeric(a) – checks if a is of a numeric data type(a number)
isempty(here) – checks if here is null (usually represented by [], the empty vector
(x/y/z)label(str) – labels the plot axes with the given string
length(a) – largest dimension of a
max(a) – value and index of the max value in a
mean(a) – returns the average (mean) value of the vector a
mesh(x, y, z) – plot the surface defined by the x, y and z arrays with colored lines and white faces
[xx, yy] = meshgrid(x, y) – compute the plaid from the x and y vectors
min(a) – value and index of the min value in a
mod(a, b) – the remainder when a is divided by b
ones(rows, cols) – generate a matrix filled with 1
p = polyfit(x,y,n) - Finds the coefficients of a polynomial P(X) of degree N that fits the data
y = polyval(p,x) - Evaluates the polynomial p, at all points in x
prod(v) – compute the product of all the elements in a vector v
rem(a, b) – the remainder when a is divided by b
size(a) – all the dimensions of a
sort(v) – arranges the vector v in ascending numerical order
sound(x, fs) – plays the sound x at a sampling frequency fs
newy = spline(x,y,newx) - Performs cubic spline interpolation to find newy, the values of the underlying
function Y at the points in newx.
strcmp(a, b) – checks if the string a is identical to string b
strcmpi(a, b) – checks if the string a is identical to string b ignoring case of a and b
sum(v) – total of all the elements in the vector v
surf(x, y, z) – plot the surface defined by the x, y and z arrays with colored faces and black lines
title(str) – titles the plot with the given string
true(a,b) – creates a matrix of a rows and b columns of boolean true
[x, fs] = wavread(file) – gives the waveform and sampling frequency for a .wav file
wavwrite(x, fs, filename) – write the vector x as a wav file: filename at a sampling frequency fs
zeros(rows, cols) – generate a matrix filled with 0

Problem 2 – Images [25 Points]

I. You have the following image: ‘myPicture.jpg’ which looks like an image consisting of 4

letters shown below: Given this image which has dimensions of 100x100, the following code is

executed in MATLAB:

pic = imread('myPicture.jpg');

[c b a] = size(pic);

s1 = pic(c/2:end,b/2:-1:1,:);

s2 = pic(1:c/2,1:b/2,:);

s3 = pic(c/2:end,b/2:end,:);

s4 = pic(c/2:-1:1,b/2:end,:);

subplot(2,2,1)

image(s1)

subplot(2,2,2)

image(s2)

subplot(2,2,3)

image(s3)

subplot(2,2,4)

image(s4)

Fill in the resulting figure with what you would see after the code above is executed:

Page 5 of 10

II. Write a MATLAB function called meanImage that will take in a filename as its input. The

function does not return anything, but it generates an image and saves it as ‘myPicture.jpg’. The

picture generated should be a grayscale image where the intensity of each pixel should be the

mean of the intensities of the red, green and blue pixels found in the previous image.

Write your code here:

Page 7 of 10

II. Given that the data vector of a sound file has 4000 samples and is read at a sampling

frequency of 2000 Hz, how long (in seconds) will the sound play for?

A. 2 seconds

B. 4 seconds

C. 6 seconds

D. 8 seconds

E. None of the above

Problem 4 – Numerical Methods [25 Points]

You are given the following figure containing four plots. The various plots consist of different

curves fit on the same set of data points. Analyze the plots below and answer the questions that

follow.

The data points used consist of x-values between [1, 10] (end points inclusive) and the y-values

range between [1, 7] (end points inclusive).

Plot
Plot
Plot
Plot

Given the plots possible in ‘Corresponding Code’ column, match the plots above to the

corresponding code given. Note that only 3 of the plots will match the 3 pieces of code. For the

plot that does not have a match, write the code corresponding to that plot that will generate that

figure as option D. Once you have option D written out, match it to the correct plot.

This page intentionally left blank for any extra work.