All Flashcards
What is the significance of indexing in strings?
Allows access to specific characters within the string.
Explain the concept of immutability in the context of strings.
Strings in many languages (like Python) are immutable, meaning their values cannot be changed after creation. Operations create new strings.
How does the + operator work with strings?
It performs string concatenation, joining two strings together.
What is the role of booleans in control structures?
Booleans are used to determine which code block to execute in conditional statements (if/else).
What is the purpose of a for loop?
To repeat a block of code a specific number of times or over a sequence.
What is the purpose of a while loop?
To repeat a block of code as long as a condition is true.
What is the difference between parameters and arguments?
Parameters are placeholders in the function definition; arguments are the actual values passed when the function is called.
What are the characteristics of a good algorithm?
Precise, unambiguous, and finite.
Explain the concept of data abstraction.
Hiding the complex implementation details and showing only the essential information.
What is the purpose of DNS?
Translates domain names (e.g., google.com) to IP addresses.
What are the differences between a for loop and a while loop?
for loop: iterates a specific number of times or over a sequence. while loop: iterates as long as a condition is true.
What are the differences between functions and procedures?
Functions: return a value. Procedures: do not return a value.
What are the differences between lists and dictionaries?
Lists: ordered collections of items (mutable). Dictionaries: key-value pairs (unordered, mutable).
How is encryption applied in real-world scenarios?
Protecting sensitive data like passwords, credit card numbers, and personal information during online transactions.
How are algorithms applied in real-world scenarios?
Search engines use complex algorithms to rank search results, and social media platforms use algorithms to personalize content feeds.
How is data abstraction applied in real-world scenarios?
Using a car: you don't need to know how the engine works to drive it; you only need to know how to use the steering wheel, pedals, etc.