Podcast
Questions and Answers
How many times will the loop run in the following code? for x in range(3, 17, 2): print(x)
How many times will the loop run in the following code? for x in range(3, 17, 2): print(x)
The line 'if my_list:' in the function 'find_depth' checks if the list is empty.
The line 'if my_list:' in the function 'find_depth' checks if the list is empty.
True
What does the recursive call in the function 'find_depth' do?
What does the recursive call in the function 'find_depth' do?
It calls itself with a sublist to calculate the depth.
In the expression not(my_int % 2)
, 'not' checks if the result is _____ .
In the expression not(my_int % 2)
, 'not' checks if the result is _____ .
Signup and view all the answers
Match the following programming concepts with their definitions:
Match the following programming concepts with their definitions:
Signup and view all the answers
Which line in the function 'find_depth' contains the recursive call?
Which line in the function 'find_depth' contains the recursive call?
Signup and view all the answers
The expression not(my_int % 2)
will return true when my_int
is odd.
The expression not(my_int % 2)
will return true when my_int
is odd.
Signup and view all the answers
What is the primary purpose of using a loop in programming?
What is the primary purpose of using a loop in programming?
Signup and view all the answers
What will the output of the following code be? print( composers.get("Scriabin", "Who?!") )
What will the output of the following code be? print( composers.get("Scriabin", "Who?!") )
Signup and view all the answers
The statement composers['Scarlatti'] = 17 will raise an error if 'Scarlatti' is not already a key in the dictionary.
The statement composers['Scarlatti'] = 17 will raise an error if 'Scarlatti' is not already a key in the dictionary.
Signup and view all the answers
What is the output of print(composers["Chopin"], composers["Beethoven"], composers["Vivaldi"]) if composers is defined as given?
What is the output of print(composers["Chopin"], composers["Beethoven"], composers["Vivaldi"]) if composers is defined as given?
Signup and view all the answers
The number 64 in binary is represented as __________.
The number 64 in binary is represented as __________.
Signup and view all the answers
Match the decimal numbers with their corresponding binary conversions:
Match the decimal numbers with their corresponding binary conversions:
Signup and view all the answers
Which statement correctly evaluates if a list named scotsmen is non-empty and a variable ship_of_theseus has at least 12 elements?
Which statement correctly evaluates if a list named scotsmen is non-empty and a variable ship_of_theseus has at least 12 elements?
Signup and view all the answers
The binary number 1101 1011 is equivalent to the decimal number 219.
The binary number 1101 1011 is equivalent to the decimal number 219.
Signup and view all the answers
Convert the decimal number 183 to hexadecimal.
Convert the decimal number 183 to hexadecimal.
Signup and view all the answers
The code snippet print("\\\nMerry\nChristmas!\")
will output "Merry
Christmas!".
The code snippet print("\\\nMerry\nChristmas!\")
will output "Merry
Christmas!".
Signup and view all the answers
What does the code print(the_list)
output after executing list_add(the_list)
twice, given the_list = ['1', '7']
?
What does the code print(the_list)
output after executing list_add(the_list)
twice, given the_list = ['1', '7']
?
Signup and view all the answers
In the code a_list = ['Python', 'is', 'a', 'fun', 'time']
, the expression a_list[4:10]
outputs ___________.
In the code a_list = ['Python', 'is', 'a', 'fun', 'time']
, the expression a_list[4:10]
outputs ___________.
Signup and view all the answers
Match the following functions with their expected output:
Match the following functions with their expected output:
Signup and view all the answers
What is the result of three_plus_one(1)
?
What is the result of three_plus_one(1)
?
Signup and view all the answers
The function rec_fun(5)
produces an output containing only the letter 'a'.
The function rec_fun(5)
produces an output containing only the letter 'a'.
Signup and view all the answers
When the following matrix code is run, what is printed? the_matrix = [[4, 2, 7], [8, 5, 6], [9, 1, 3]]; print(the_matrix)
When the following matrix code is run, what is printed? the_matrix = [[4, 2, 7], [8, 5, 6], [9, 1, 3]]; print(the_matrix)
Signup and view all the answers
Study Notes
Exam Information
- Course: CMSC 201
- Semester: Fall 2024
- Exam Type: Practice Final Exam
- Total Points: 165 points (5 extra points)
- Discussion Sections: Students are assigned to a discussion section (numbers listed)
Exam Instructions
- Name: Write your name neatly on the exam.
- Login ID: Use your UMBC email ID without the "@umbc.edu" portion.
- Pencil: The exam must be completed using a pencil.
- Name on Every Page: Write your name at the top of every page.
Undergraduate Honors Statement
- Academic Honesty: Students agree to uphold the highest standards of academic honesty in the course.
- Academic Dishonesty: Cheating, fabrication, plagiarism, and assisting others in committing academic dishonesty is prohibited.
- Academic Integrity: Students agree to abide by the University's and course's academic integrity policies.
Multiple Choice
- Format: Multiple choice questions with bubbles for the correct answer.
- Points: 3 points per question
- Total Points: 30 points (3 points each)
- Instructions: Clearly and cleanly fill in the bubbles for the selected option.
Additional Questions
- Recursive Call: A recursive call in a function is specified.
- Mutable vs Immutable Types: Lists are mutable data types that are passed by reference.
- Error: A type error is described, and its cause is explained.
- Boolean Expressions: Boolean expressions evaluate to True or False. Students must write correct boolean expressions.
- Dictionary Evaluation: Students are required to provide the results of dictionary operations, recognizing any errors.
Binary, Hexadecimal & Decimal
- Conversions: Convert numbers between binary, hexadecimal, and decimal formats.
- Decimal to Binary/Hexadecimal: Work for conversions of integers
- Binary/Hex to Decimal: Work for conversions of given values
Code Evaluation
- Programming Concepts: Evaluates code snippets and their outputs.
- Formatted Output: Output formatting is a consideration in evaluating code.
Debugging
- Errors: Find and correct five errors in given code snippets.
- Recursive function: Creating function for binary number operations and vowel counting.
- Debugging (Part 2): Find, and fix errors for a second set of code.
Programming Problems
- 2D Lists: Finding minimum of maximum in 2-dimensional lists
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Prepare for your CMSC 201 final exam with this practice test designed for Fall 2024. The exam evaluates your understanding of course material through multiple-choice questions. Ensure you follow the exam instructions carefully for successful completion.