What keyword defines a function in Python?
What is def?
What is printed?
x = 4
print(x + 2)
What is 6?
What is an algorithm?
What is a step-by-step solution?
What number system do computers use?
What is binary?
What does the internet use to send data?
A: What are packets?
What is the output type of input()?
What is a string?
What is printed?
x = 3
if x % 2 == 0:
print("Even")
else:
print("Odd")
What is Odd?
What search is faster on large sorted lists?
What is binary search?
What is a bit?
What is a 0 or 1?
What does DNS do?
What is converts domain names to IP addresses?
What does len() do?
What is returns the length of a string or list?
What is printed?
total = 0
for i in range(1, 5):
total += i
print(total)
What is 10?
A list has 20 elements. What is the maximum number of comparisons needed to find a value using linear search?
What is 20?
How many bits are in a byte?
What is 8?
What is an IP address?
What is a unique identifier for a device?
What is the difference between = and ==?
What is assignment vs comparison?
What is printed?
nums = [1, 2, 3]
nums[0] = nums[1]
print(nums)
What is 2,2,3?
You are searching for a name in a sorted list of 1,000 items. Which algorithm would be more efficient, and why?
What is binary search, because it eliminates half the list each step?
What is data abstraction?
What is simplifying data using structures (like lists)?
What is encryption?
What is encoding data to protect it?
What error occurs if you divide by zero?
What is a runtime error (ZeroDivisionError)?
What is printed?
def mystery(x):
if x > 5:
return x - 2
else:
return x + 2
print(mystery(5))
What is 7?
A program uses linear search to find a value in a list of 200 items. The value is located at index 0 in one test and at index 199 in another test.
What is the difference between these two cases in terms of efficiency?
What is best case = 1 step, worst case = 200 steps?
Why is data compression used?
What is to reduce file size for storage/transmission?
What is redundancy in the internet?
What is multiple paths for reliability?