Back to marketplace

Programming (Topic 6 and Topic 7)

No description yet. This curated deck is ready for daily study.

Total cards: 21•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (21)

#1
Front (Question)

What is Binary Search?

Back (Answer)

A search algorithm for sorted lists that divides the list into halves to find a target.

#2
Front (Question)

How does Binary Search work?

Back (Answer)

• Compare the middle element to the target. • Search left or right based on the target. • Repeat.

#3
Front (Question)

What is Linear Search?

Back (Answer)

A search algorithm that checks each element one by one until the target is found or list ends.

#4
Front (Question)

When is Linear Search useful?

Back (Answer)

For small or unsorted lists.

#5
Front (Question)

How does Bubble Sort work?

Back (Answer)

• Compare two adjacent items. • Swap if wrong order. • Repeat for the whole list.

#6
Front (Question)

What is the main disadvantage of Bubble Sort?

Back (Answer)

It is slow for large lists because it repeatedly checks all elements.

#7
Front (Question)

How does Insertion Sort work?

Back (Answer)

• Start with one item as “sorted.” • Insert the next item into its correct position. • Repeat.

#8
Front (Question)

How does Merge Sort work?

Back (Answer)

• Divide the list into smaller sublists. • Merge the sublists back in sorted order.

#9
Front (Question)

What is a While Loop?

Back (Answer)

A loop that runs as long as a condition is true. Example: while x < 5: print(x)

#10
Front (Question)

What is a For Loop?

Back (Answer)

A loop that iterates over a sequence (list or range). Example: for i in range(5): print(i)

#11
Front (Question)

What is an If Statement?

Back (Answer)

A decision-making construct that runs code based on a condition. Example: if x > 0: print(“Positive”)

#12
Front (Question)

What is an Array?

Back (Answer)

A collection of items stored in a single variable (lists in Python). Example: numbers = [1, 2, 3]

#13
Front (Question)

What is a Function?

Back (Answer)

A reusable block of code designed for a specific task. Example: def greet(name): return f”Hello, {name}!”

#14
Front (Question)

What is a Subroutine?

Back (Answer)

Another term for a function or method used for specific tasks in a program.

#15
Front (Question)

What are Parameters in Functions?

Back (Answer)

Variables in the function header to take inputs. Example: def add(x, y): return x + y

#16
Front (Question)

What is Basic File Handling?

Back (Answer)

Operations to read from and write to files in Python. Modes: “r” (read), “w” (write), “a” (append).

#17
Front (Question)

How do you write to a file in Python?

Back (Answer)

with open(“file.txt”, “w”) as file: file.write(“Hello, world!”)

#18
Front (Question)

How do you read a file in Python?

Back (Answer)

with open(“file.txt”, “r”) as file: content = file.read()

#19
Front (Question)

What is SQL?

Back (Answer)

Structured Query Language, used to manage and query databases.

#20
Front (Question)

What are common SQL commands?

Back (Answer)

SELECT (retrieve), INSERT (add), UPDATE (modify), DELETE (remove).

#21
Front (Question)

How do you connect Python to a database?

Back (Answer)

Use sqlite3 for simple databases: import sqlite3; conn = sqlite3.connect(“example.db”)