final_overview_Fall2023

.pdf

School

Rensselaer Polytechnic Institute *

*We aren’t endorsed by this school

Course

1100

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

8

Uploaded by ConstableWaterBuffalo22878

Report
Computer Science 1 — CSci 1100 Fall Semester, 2023 Final Exam Overview and Practice Questions Overview The final exam will be held Thursday, December 14, 2023 from 6:30 pm - 8:30 pm. Note that this will be a two-hour exam . Most students will take the exam from 6:30 pm - 8:30 pm (120 minutes). Room assignments will be posted on Submitty by Wednesday night, December 13. For most students these assignments will be different from previous exams. Students who provided with an accommodation letter indicating the need for extra time or a quiet location will be given extra time beyond the 2 hour base. Shianne Hulbert will send you a reminder for your time and location. Use whatever information she sends you. It overrides any assignments given you on Submitty. If you show up at your Submitty location or time, you will be allowed to take the exam, but you will lose the accommodations. Students MUST: – Go to their assigned rooms. – Bring their IDs to the exam. – Sit in the correct room/section. – Put away all calculators, phones, etc. and take off/out all headphones and earbuds Failing to do one of these may result in a 20 point penalty on the exam score. Failure to do all can cost up to 80 points . During the exam, if you are doubtful/confused about a problem, simply state your assumptions and/or interpretation as comments right before your code and write your solution accordingly. During the exam you are not allowed to take any breaks (including bathroom breaks). Exam coverage is the entire semester, except for the following: JSON data format, Images, You do not need to know the intricacies of tkinter GUI formatting, but you should understand the GUI code structure we outlined (Lecture Notes and Class Code), be able to trace through event driven code and write small methods that are invoked by the GUI. Consider the lecture exercises for Lecture 22 and the modifications you made to the BallDraw class during Lab 11 for practice. Please review lecture notes, class exercises, labs, homework, practice programs, and tests, working through problems on your own before looking at the solutions. You are expected to abide by the following Honor code when appearing for this exam: “On my honor, I have neither given nor received any aid on this exam.” As part of our regular class time on Thursday December 7th, we will answer questions about the course material, so bring your questions! There are often study events held on campus, for example UPE often holds tutoring sessions. I do not know of any specific events right now, but we will post anything we learn to the Submitty discussion forum. Please monitor the channel if you are looking for help. What follows are a few additional practice problems. These are by no means comprehensive, so rework problems from earlier in the semester. All the material from tests 1, 2, and 3 are also fair game. This is a comprehensive final exam. We have separately provided Spring 2017’s final exam.
Questions The following are the questions and solutions to some practice problems. Please be aware that there may be more than one way to solve a problem and so your answer may be correct despite being different from ours. 1. Write a version of merge that does all of the work inside the while loop and does not use the extend . 2. Using what you learned from writing the solution to the previous problem, write a function to merge three sorted lists. For example print(three_way_merge( [2, 3, 4, 4, 4, 5], [1, 5, 6, 9], [ 6, 9, 13])) Should output [1, 2, 3, 4, 4, 4, 5, 5, 6, 6, 9, 9, 13] 3. Given a list of test scores, where the maximum score is 100, write code that prints the number of scores that are in the range 0-9, 10-19, 20-29, ... 80-89, 90-100. Try to think of several ways to do this. Outline test cases you should add. For example, given the list of scores scores = [ 12, 90, 100, 52, 56, 76, 92, 83, 39, 77, 73, 70, 80 ] The output should be something like [0,9]: 0 [10,19]: 1 [20,29]: 0 [30,39]: 1 [40,49]: 0 [50,59]: 2 [60,69]: 0 [70,79]: 4 [80,89]: 2 [90,100]: 3 4. Given a list of floating point values containing at least 10 values, how do you find the 10 values that are closest to each other? In other words, find the smallest interval that contains 10 values. By definition the minimum and maximum of this interval will be values in the original list. These two values and the 8 in between constitute the desired answer. This is a bit of a challenging variation on earlier problems from the semester. Start by outlining your approach. Outline the test cases. For example, given the list values = [ 1.2, 5.3, 1.1, 8.7, 9.5, 11.1, 2.5, 3, 12.2, 8.8, 6.9, 7.4,\ 0.1, 7.7, 9.3, 10.1, 17, 1.1 ] The list of the closest 10 should be [6.9, 7.4, 7.7, 8.7, 8.8, 9.3, 9.5, 10.1, 11.1, 12.2] 5. Consider the following recursive function: def mystery( L, v ): if v < len(L): x = L[v] mystery( L, x ) print(x) else: print(v) 2
(a) Show the output from the call: mystery( [2, 5, 4, 7, 1], 0 ) (b) Write a Python call to the function mystery containing a list and an index that causes the recursion to never stop (until the stack overflows). Do this with as short a list as you possibly can. (c) Write a Python call to the function mystery that causes the program to crash (without the problem of infinite recursion): 6. You are given the following function definition with doctest comments embedded. def f(x, y, z = 0, w = False): ''' >>> f([1,2,3], [4,6,8,5,11], 3, True) True >>> f([1,2,3,4,5], [0,2,6], -1, True) False >>> f([1,2,3,4,5], [2,3,4]) False >>> f([5,4,5,8], [6,7,8,9,10,12], 2, True) False ''' count = 0 for item in x: if w and (item+z in y): count += 1 if count == len(x): return True elif count == len(y): return False When the lines below are executed, indicate whether the tests above will pass or fail and, for the failures, indicate what is returned by f . import doctest doctest.testmod() 7. You are given a dictionary called clubs where each key is the name of a club (a string), and each value is the set of id strings for the students in the club. Write a segment of Python code that creates a set of all student ids (if any) that are in all the clubs in the dictionary. 8. Write a function called framed that takes a string storing a name and creates output with a framed, centered greeting. For example, if the name string is 'Tim' the output should be ********** * Hello! * * Tim * ********** and if the name string is 'Anderson' the output should be ************ * Hello! * * Anderson * ************ 9. Consider a file called addresses.txt that contains a name and an address on each line of the file. The parts of each name and address are separated by a '|' . For example, 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help