Final+Review+Questions

# Final+Review+Questions - CS1371 Final Review Packet 1)...

This preview shows pages 1–5. Sign up to view the full content.

CS1371 Final Review Packet 1) Vectors: Given vec1 and vec2 (assume they are the same length) , write the code to do the following. After each segment, assume that vec1 and vec2 go back to the same as above. a. Concatenate vec1 and vec2 into a vector, vec3 b. Concatenate the even values of vec1 and the odd values of vec2 into a vector, vec4 c. Concatenate the even indices of vec1 and the odd indic es of vec2 into a vector, vec5 d. Create vec6, which will contain all the elements in vec1 less than the median of vec2 e. Raise vec1 to the power of the square root of vec2 and store it in vec7 f. Create a vector, vec8, that will go from the smallest value in vec1 to the largest value in vec2 using twice as many points that are in vec1 g. Create vec9, which will start at the mean of vec1 and go to the largest value in vec2 in steps of .25 h. Plot the data series as if your x values are vec1 and y values are vec2. Plot them as red circles with a title, and appropriate labels i. Create a function that returns a Boolean true or false and consumes a vector and a number. The function should output a true if that number appears in the vector. Do not use iteration

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2) Boolean Logic: Given a = true, b=true, c = false and vec1 = [ 4, 5, 3, 9, 12, 44, 23, 13 ] and vec2 = [ 19, 43, 5, 9, 8, 21, 45, 11 ], write the results of the following: a. (a & c) | b b. ( ((a & ~b) | c) & (c | (a|b))) | ((a | b) & ((c|~a) | ~b) c. vec1( vec2<vec1 & [ a a c b b c a c ]) 3) Iteration/Conditionals: a. Given vec1 and vec2 (assumed same length), write the code to create vecN which will contain the largest value of either of the two vectors at every index. b. Create a function that returns a Boolean true or false and consumes a vector and a number. The function should output a true if that number appears in the vector. Use iteration c. Create a function that will take consumes a vector and returns an augmented version of that vector. Your function should concatenate a random, positive, whole number between 5 and 10 to the end of the vector until the sum of the vector is greater than the product of the largest and smallest number in the vector.
d. Create a function that takes in a vector and will output the same vector without any repeated values. Thus, if 3 occurs in the vector 4 times, make sure to delete 3 of them. e. Create a function that takes in a number and will print out a countdown of that number down to 0. You may assume the number will be greater than zero. Use the disp function f. Create a function that takes in a vector, vec, and a number, n, and will return a vector of every nth element in vec (starting at 1). i. Also write w/o iteration

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4) Cell arrays a. Create a function that will take in a cell matrix. These specific cell matrices will only contain scalars, vectors and matrices. Your function should output the total sum of all the numbers in the Cell matrix.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/19/2010 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

### Page1 / 17

Final+Review+Questions - CS1371 Final Review Packet 1)...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online