Algorithms & Programming Fundamentals
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
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 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"
If a programmer needs to encode a character sequence into Unicode values, which step is unnecessary in this process?
Storing Unicode values in an integer array.
Mapping characters to their Unicode numbers.
Assigning each character a unique numeric value.
Converting each letter into lowercase.
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
How does String comparison using equals() differ from using == in Java-based languages?
INCORRECT. It's case-insensitive while == is case-sensitive.
INCORRECT. It compares only lengths instead of actual content.
INCORRECT. It always results in false when comparing two different String objects.
CORRECT. It checks for content equality rather than reference equality.

How are we doing?
Give us your feedback and let us know how we can improve
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()