sp07cs1371-PT2

# sp07cs1371-PT2 - CS 1371 Test Team Presents Practice Test 2...

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

CS 1371 Test Team Presents: Practice Test 2 – Spring 2007 Part I: Concepts 1) Given the following recursive function, function ans = myrecur(x) if x > 10 ans = []; else ans = [(x-1) myrecur(x-2)]; end Which of the three fundamentals of recursion does this function not follow correctly? 2) Given a string variable called str , name the data type of the result of the following operations: A: double(str) B: str + 0 C: [str ‘b’] D: num2str(str) E: str + ‘b’

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

View Full Document
Part II: Coding 1) Write a MATLAB function called recursiveDecoder() which takes in an encoded string and returns an decoded one. The first character of the encoded message is the first character of the decoded message, The second character of the encoded message is the last character of the decoded message The third character of the encoded message is the second character of the decoded message The fourth character of the encoded message is the second to last character of the decoded message And so on until the entire message has been encoded Note: You must use recursion in solving this problem. The encoding algorithm is as follows: Example: recursiveDecoder(‘hoell’) should return ‘hello’ 2) Hungarian notation is a naming convention in computer programming, in which the name of an object indicates its type or intended use. In Hungarian notation, a function or variable name is denoted with the connection of lowercase “words” describing the variable, with each additional word beginning with a capital letter: i.e. “this notation is cool” would become “thisNotationIsCool” Write a function, hungarian(str) , which takes in a character string of all lowercase
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/08/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

### Page1 / 7

sp07cs1371-PT2 - CS 1371 Test Team Presents Practice Test 2...

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

View Full Document
Ask a homework question - tutors are online