Title | Final August, questions and answers |
---|---|
Author | unuallison ggf |
Course | Computer Programming For Scientists And Engineers |
Institution | University of Manitoba |
Pages | 12 |
File Size | 689.8 KB |
File Type | |
Total Downloads | 53 |
Total Views | 136 |
Download Final August, questions and answers PDF
International*College*of*Manitoba* Name:!_________________________________________________* Final*Exam*–*August*8,*2016**(R.$Cooper)* Student$ID:$_________________________________$ COMP*1012:*Computer*Programming*for*Scientists*and*Engineers* Time$3$hours$$ Page$1$of$12* $ Instructions:$ 1. Answer$all$questions$on$this$paper.$For$multiple$choice$questions$circle$the$letter$of$the$best$choice.$ For$short$answer$questions,$write$your$answer$in$the$space$provided.$ 2. No$aids$(such$as$calculators$or$language$translators)$are$permitted.$ 3. Do$NOT$remove$any$pages$from$the$exam.$ 4. You$have$3$hours$to$complete$the$exam.$There$is$a$total$of$51$marks.$ Part)1:)Predict)the)output)[12)x)1)mark])
) )
In$each$row$of$the$table$below,$mentally$execute$the$code$fragment$on$the$left$and$enter$the$expected$ output$in$the$box$on$the$right.$Assume$any$necessary$imports$have$been$done.$Each$row$is$separate.$ $
!
Code!Fragment!
1.
print(3 % 7 + 3 // 7)
2.
print(1 + 4 * 6 / 2**3)
3.
ax = np.zeros((2,2), bool) for el in ax: print(el, end=' ')
4.
print(np.linspace(-1, 1, 5))
5.
print('stop'[-1::-1])
6.
ar = np.arange(6).reshape(2,3) print(ar)
7.
aa = np.array([1,4,9,16]) bb = np.array([5,6,7,8]) print(np.sqrt(aa)+bb//2)
8.
sl = ("4/2","1*2","1+1","2") print('=='.join(sl))
9.
s1 = "h,hi,hit,hilt" print(s1.split('hi'))
10. print({2,3,4}...