{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

final

# final - CS 177 Fall 2010 Final Exam There are 50 single...

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

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

View Full Document
CS 177 Fall 2010 Final Exam ------------------------------------------------------------------------------ 2 Recitation Section Number________________________________ Recitation TA‟s Name ________________________________ Student Last Name_________________________________ Student First Name_________________________________
CS 177 Fall 2010 Final Exam ------------------------------------------------------------------------------ 3 Q1. Which set of statements given below give the same results? A) print int(1.0/2.0) print 1 / 2 B) print 1 / 2.0 print int(1 / 2.0) C) print 1.0 / 2 print int(1.0 / 2) D )print 1 / 2 print 1 / 2.0 Q2. Given two numbers in binary format a = 010101 , b = 000111 , compute the 2‟s complement of a+b. Which one of the following is the correct answer? A) 100011 B) 100101 C) 100100 D) 100110 Q3. What happens when the following function is executed? def guess_the_function(): i = 0 while 1==1: print "CS177" i = i + 1 if ( i > 10): 1 = 0

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

View Full Document
CS 177 Fall 2010 Final Exam ------------------------------------------------------------------------------ 4 Q4. A DNA string consists of four characters {A, T, C, G}. Consider the following function: def finalexam2(s): t = s; for i in range(0,len(s)): if (s[i] == 'A'): c = 'T' elif (s[i] == 'T'): c = 'A' elif (s[i] == 'C'): c = 'G' else: c = 'C' if i == 0: t = c + t[1: ] elif (i == len(t) - 1): t = t[:i] + c else: t = t[:i] + c + t[i+1:] print t If s=” ATCGCCTGA ”, what‟s the value of t? A) TAGCCGACT B) ATCGCCTGA C) TAGCGGACT D) ATCGCGTGA
CS 177 Fall 2010 Final Exam ------------------------------------------------------------------------------ 5

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 24

final - CS 177 Fall 2010 Final Exam There are 50 single...

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

View Full Document
Ask a homework question - tutors are online