
CS 1400 Final Review
Authored by Kayleeq Martin
Computers
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
31 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is executed first in this code?
[Lecture 19]
The return statement
sum(vals)
The multiply
Answer explanation
The multiply cannot execute until its inputs are known, and the return won't happen until its operation is completed.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which operation is performed first?
[Lecture 19]
add
divide
subtract
Answer explanation
The subtraction can't finish until both of its values are known, so it goes to func1.
The addition can't finish until both of its values are known, so it goes to func2.
The division can happen because y was passed as a parameter.
3.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Which of the following are true of recursion or recursive functions?
[Lecture 19]
Recursion involves a base case and a recursive step.
The base case of a recursive function is the first iteration of the recursion.
Recursive functions invoke themselves to solve a smaller part of the same problem.
Recursive solutions involve iterating by adding one to a counting variable.
Answer explanation
Right Answers:
Recursive solutions always identify a base case and a recursive step/case.
Recursion involves a function calling itself repeatedly to whittle down the problem to the most trivial case.
Wrong Answers:
The base case is the simplest version of a problem (e.g. for the factorial problem it is when N is 1).
Recursive solutions progress by repeatedly calling the function with smaller versions of the problem, not by increasing by one.
4.
OPEN ENDED QUESTION
5 mins • Ungraded
Write two functions:
1) iter_factorial takes an integer as the parameter, returns the factorial of that parameter. The factorial must be solved iteratively (e.g. without recursion).
2) recurs_factorial takes an integer as the parameter, returns the factorial of that parameter. The factorial must be solved recursively.
[Lecture 19/Lab 12]
Evaluate responses using AI:
OFF
Answer explanation
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the base case in this code?
[Lecture 20]
number // 2
1 + mystery
return 1
number <= 1
Answer explanation
The base case is the simplest version of a problem.
The only answer option that involves checking the parameter (to decide if it's time to stop recursing) is number <= 1.
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What causes recursion to progress towards the base case?
[Lecture 20]
number // 2
1 + mystery
return 1
number <= 1
Answer explanation
Recursion progresses through the recursive step. This step has 2 parts: calling the function again, and making the problem smaller. In the case of the factorial example, this looks like factorial(n - 1).
For this problem, technically the whole line return 1 + mystery(number // 2) is the recursive step, but this question is specifically asking what is progressing this code to the base case. In other words, it's asking what part of the code is making the problem smaller. The only code doing that is number // 2.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the value of mystery(1)?
[Lecture 20]
0.5
0
1
Infinite recursion (Stack Overflow)
Answer explanation
1 is included in the base case (if number <= 1), so 1 is returned.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
29 questions
Google Drawings Review
Quiz
•
2nd Grade - Professio...
28 questions
TIN 9 ÔN TẬP CUỐI KỲ 1
Quiz
•
9th Grade - University
27 questions
Foundations Farewell
Quiz
•
University
29 questions
TMK TAHUN 5
Quiz
•
KG - University
26 questions
Quiz on Application Programming Interfaces (APIs)
Quiz
•
University
27 questions
Cuestionario sobre Chatbots y Redes Sociales
Quiz
•
1st Grade - University
27 questions
Fundamentos de Programación en C
Quiz
•
University
27 questions
ML WORKSHOP QUIZ
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Computers
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
20 questions
Endocrine System
Quiz
•
University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
30 questions
W25: PSYCH 250 - Exam 2 Practice
Quiz
•
University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
38 questions
Unit 8 Review - Absolutism & Revolution
Quiz
•
10th Grade - University