All Flashcards
What are the differences between lists and dictionaries?
Lists: ordered collections, accessed by index | Dictionaries: unordered, accessed by keys.
What are the differences between linear search and binary search?
Linear Search: Checks each element one by one | Binary Search: Efficient for sorted lists, divides search space in half.
What are the differences between functions and procedures?
Functions: Return values | Procedures: Don't always return values.
What are the differences between HTTP and HTTPS?
HTTP: Transfers web pages without encryption | HTTPS: Secure version with encryption.
What are the differences between TCP and IP?
TCP: Ensures reliable data delivery | IP: Handles addressing.
What are the differences between iteration and sequence?
Iteration: Repeats a block of code | Sequence: Instructions executed in order.
What are the differences between syntax and logic errors?
Syntax Errors: Mistakes in code's grammar | Logic Errors: Mistakes in program's logic.
What are the differences between encryption and hashing?
Encryption: Reversible | Hashing: Not reversible.
What are the differences between positive and negative impacts of computing?
Positive: Improved communication, productivity | Negative: Privacy concerns, job displacement.
What are the differences between bubble sort and merge sort?
Bubble Sort: Simpler, less efficient | Merge Sort: More complex, more efficient for large datasets.
How is encryption applied in real-world scenarios?
Protecting sensitive data like passwords and credit card numbers.
How are firewalls applied in real-world scenarios?
Securing networks by preventing unauthorized access.
How are searching algorithms applied in real-world scenarios?
Finding data in databases or on the internet.
How are sorting algorithms applied in real-world scenarios?
Organizing data in a specific order, like alphabetically or numerically.
How is data abstraction applied in real-world scenarios?
Using functions to simplify complex operations in software.
How are lists/arrays applied in real-world scenarios?
Storing collections of items, such as a list of student names.
How are dictionaries/maps applied in real-world scenarios?
Storing key-value pairs, such as a phone book (name: phone number).
How are loops applied in real-world scenarios?
Automating repetitive tasks, such as processing each item in a list.
How are conditional statements applied in real-world scenarios?
Making decisions in a program, such as determining if a user is logged in.
How is the concept of time complexity applied in real-world scenarios?
Choosing the most efficient algorithm for a specific task to optimize performance.
What does the following code output?
python
strawberries_in_fridge = 7
number_of_eggs = 12
if strawberries_in_fridge >= 7:
print ("You can make strawberry shortcake!")
if number_of_eggs < 12:
print ("... if you go to the store first.")
else:
print ("So start baking!")
You can make strawberry shortcake! So start baking!
What does the following code output?
python
x = 5
if x > 10:
print("x is greater than 10")
elif x > 3:
print("x is greater than 3")
else:
print("x is not greater than 3")
x is greater than 3
What does the following code output?
python
my_list = [1, 5, 2, 8]
my_list.sort()
print(my_list)
[1, 2, 5, 8]
What does the following code output?
python
def greet(name):
return "Hello, " + name + "!"
print(greet("World"))
Hello, World!
What does the following code output?
python
for i in range(3):
print(i)
0 1 2
What does the following code output?
python
x = 10
while x > 0:
print(x)
x -= 2
10 8 6 4 2
What does the following code output?
python
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
print(factorial(5))
120
What does the following code output?
python
my_dict = {"name": "Alice", "age": 30}
print(my_dict["age"])
30
What does the following code output?
python
print(2 ** 3)
8
What does the following code output?
python
print("Hello".replace("l", "p"))
Heppo