Mock Final Exam CSci 127: Introduction to Computer Science ...
Mock Final Exam CSci 127: Introduction to Computer Science Hunter College, City University of New York
10 December 2019
Exam Rules
? Show all your work. Your grade will be based on the work shown. ? The exam is closed book and closed notes with the exception of an 8 1/2" x 11" piece of paper
filled with notes, programs, etc. ? When taking the exam, you may have with you pens and pencils, and your note sheet. ? You may not use a computer, calculator, tablet, phone, or other electronic device. ? Do not open this exam until instructed to do so.
Hunter College regards acts of academic dishonesty (e.g., plagiarism, cheating on examinations, obtaining unfair advantage, and falsification of records and official documents) as serious offenses against the values of intellectual honesty. The College is committed to enforcing the CUNY Policy on Academic Integrity and will pursue cases of academic dishonesty according to the Hunter College Academic Integrity Procedures.
I understand that all cases of academic dishonesty will be reported to the Dean of Students and will result in sanctions. Name:
EmpID:
Email:
Signature:
(Image from wikipedia commons)
EmpID:
CSci 127 Mock Final, F19
1. (a) What will the following Python code print:
pioneers="Asimov%Isaac#Shelley%Mary#Gibson%William"
i. num = pioneers.count('%') num = num + pioneers.count('#') + 2
Output:
print(pioneers[len(pioneers)-num:].lower())
names = pioneers.split('#') ii. m = names[1]
print(m[-4]+'. '+m[:7])
Output:
for n in names:
iii.
print(n.split('%')[0][0])
Output:
(b) Consider the following shell commands:
$ pwd /Users/login/temp $ ls csBridge.png Elevations.csv
p25.py
p27.py
i. What is the output for: $ mkdir hwk $ mv *.p* hwk $ ls
Output:
ii. What is the output for:
$ cd hwk $ ls | grep ^p | wc -l
iii. What is the output for: $ pwd $ cd ../ $ pwd
Output: Output:
1
EmpID:
CSci 127 Mock Final, F19
2. (a) Consider the code:
import turtle thomasH = turtle.Turtle()
i. After the command: thomasH.color("#1B1B1B"), what color is thomasH?
black
red
white
gray
teal
ii. After the command: thomasH.color("#00AAAA"), what color is thomasH?
black
red
white
gray
teal
iii. Fill in the code below to change thomasH to be the color white:
thomasH.color("#
")
iv. Fill in the code below to change thomasH to be the brightest purple:
thomasH.color("#
")
(b) Fill in the code to produce the output on the right:
i. for i in range(
):
print(i, end=" ")
Output: 0123456789
Output:
ii. for j in range(
,
,
):
print(i, end=" ")
-2 0 2 4 6
Output:
import numpy as np import matplotlib.pyplot as plt iii. im = np.ones( (10,10,3) )
im[:, :5,:] = 0 plt.imshow(im) plt.show()
Output:
import numpy as np import matplotlib.pyplot as plt iv. im = np.ones( (10,10,3) )
im[0::
, 2::
plt.imshow(im)
plt.show()
, :] = 0
2
EmpID:
3. (a) What is the value (True/False): in1 = False
i. in2 = True out = in1 or in2
in1 = True ii. in2 = True
out = not in1 or (in2 and not in2)
in1 = True iii. in2 = True or not in1
in3 = in1 or in2 out = in1 and not in3
CSci 127 Mock Final, F19
True True True
False False False
iv. in1 = True in2 = False in3 = False
True
(b) Draw a circuit that implements the logical expression: ((in1 or in2) and (not in2))
False
(c) Fill in the circuit that implements the logical expression: ((in1 or (in1 and not in2)) and (in3 or not in3))
3
EmpID: 4. (a) Draw the output for the function calls:
CSci 127 Mock Final, F19 i. ramble(tess,8)
1: import turtle 2: tess = turtle.Turtle() 3: tess.shape('turtle')
4: def ramble(t, len):
5:
if len ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- mock final exam csci 127 introduction to computer science
- hp prime programming hpcc
- cs 341 foundations of computer science ii prof marvin
- cpu performance evaluation cycles per instruction cpi
- computer science one
- linear programming computer science department at
- big o notation mit
- history of computer science
- parallel computing chapter 7 performance and scalability
Related searches
- introduction to computer systems pdf
- introduction to computer studies pdf
- introduction to computer science
- introduction to computer packages pdf
- introduction to computer pdf notes
- introduction to computer science free
- introduction to computer network pdf
- introduction to computer science class
- introduction to computer science course
- introduction to computer science online
- introduction to computer science pdf
- introduction to computer science syllabus