Algorithms & Programming Fundamentals
If you concatenate strings using the + operator in a loop that runs n times, how does time complexity generally scale with n?
O(n)
O(n^2)
O(log n)
O(1)
What is the result of concatenating the string "Code" with the integer 2021 in most programming languages that support automatic type conversion?
INCORRECT 1. A runtime error
CORRECT. "Code2021"
INCORRECT 2. "Code" + 2021
INCORRECT 3. An undefined value
Given a list of strings, which algorithm would generally require more comparisons to determine if a particular string is present when the list size increases?
Binary search
Depth-first search
Linear search
Hash table lookup
Suppose String fruit = "banana"; What is the result of fruit.substring(2, 5)?
"ana"
"nan"
"nana"
Error
When implementing unit tests for a function designed to reverse strings, what edge case should be included to ensure it can handle extreme conditions?
A palindrome string where reversal does not change its sequence.
A single word without special characters or spaces.
A very long string that approaches system memory limits.
A typical sentence that includes punctuation and spaces.
Which operation would you use to determine how many characters are in the string "Hello"?
Index()
Length()
Count()
Size()
How can you navigate through a string in Python?
Using mathematical operations.
Using index values
Using boolean conditions
Using loops

How are we doing?
Give us your feedback and let us know how we can improve
Which method commonly used on strings returns the position of the first occurrence of a specified substring?
INCORRECT 1. length()
INCORRECT 2. charAt()
INCORRECT 3. compareTo()
CORRECT. indexOf()
What could cause unexpected behavior when accessing individual characters in a string based on indexing?
Assuming equal byte sizes for all characters.
Using one-based indexing instead of zero-based indexing.
Accurately counting indices starting at zero.
String stored properly without corruption.
What is returned by calling "environment".substring(10)?
An empty string ("")
"vironment"
A runtime error
"ment"