Q1. What is the difference between a symbol and a string?
A `Symbol` is an immutable, interned identifier such as `:name`. A `String` is a mutable sequence of characters such as `"name"`. Symbols are stored once, so repeated use...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (25 available).
A `Symbol` is an immutable, interned identifier such as `:name`. A `String` is a mutable sequence of characters such as `"name"`. Symbols are stored once, so repeated use...
`string` is immutable: every operation such as concatenation or `Replace` allocates a new string. `StringBuilder` is a mutable buffer backed by a resizable array, so appe...
`String` is an owned, growable, heap-allocated UTF-8 string (essentially a `Vec`) that you can mutate and extend. `&str` is a borrowed string slice: a pointer plus a leng...
A docstring is a unique text that happens to be the first statement in the following Python constructs: Module, Function, Class, or Method def inition. A docstring gets a...
In order to convert a number into a string, use the inbuilt function str(). If you want a octal or hexadecimal representation, use the inbuilt function oct() or hex().
In modern **Python 3**, **all strings are Unicode by default** (`str` type represents Unicode code points encoded in UTF-8): ```python # In Python 3, this is already a na...
Because Python strings are **immutable**, you cannot directly append characters to an existing string in memory. Each append creates a new string object: ### 1. The `+=` ...
Use the `.lower()` or `.casefold()` string method in Python: ```python s = 'MYSTRING' print(s.lower()) # Output: 'mystring' ``` *Tip:* `.casefold()` is recommended for ca...
The most readable, pythonic, and performant way to check if substring A exists inside string B is using the **`in` operator**: ```python str_b = "HireXTech Interview Prep...
There is no simple builtĀin string function that does what you're looking for, but you could use the more powerful regular expressions: >>>[m.start()forminre.finditer('te...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.