{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Programming Part 6 Flashcards

(20 cards)

1
Q

What is unit testing?

A

Testing individual pieces of code (like functions) in isolation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What Python module is commonly used for testing?

A

unittest or pytest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an assertion?

A

A statement that checks if a condition is True; used in tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you write a basic test function in pytest?

A

Define a function with a test_ prefix and use assert statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is automated testing important?

A

It helps catch bugs early and ensures consistent behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why use Jupyter notebooks in data science?

A

To combine code, output, and narrative in a single, interactive document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a code cell in Jupyter?

A

A block that can be executed independently to run code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you restart the kernel in Jupyter?

A

Use the ‘Restart Kernel’ option to clear memory and re-run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you ensure results are reproducible?

A

Set random seeds, document dependencies, and organize code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does it mean to ‘restart and run all’ in a notebook?

A

Clears all variables and executes every cell from top to bottom.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why is version control important?

A

It tracks changes, supports collaboration, and enables rollback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Git?

A

A distributed version control system for tracking changes in files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does ‘git commit’ do?

A

Saves a snapshot of tracked changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does ‘git push’ do?

A

Sends local commits to a remote repository.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does ‘git pull’ do?

A

Fetches changes from a remote repository and merges them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a script in Python?

A

A file with code intended to be executed from top to bottom.

17
Q

What is a function in the context of code reuse?

A

A reusable block of code that performs a specific task.

18
Q

What is modular code?

A

Code that is broken into functions or files that each handle one responsibility.

19
Q

Why is code documentation important?

A

It helps others (and your future self) understand what the code does.

20
Q

What is the difference between a script and a notebook?

A

Scripts are linear and file-based; notebooks are interactive and cell-based.