Interviewers want to see that you can write code that handles failures gracefully instead of crashing on the first unexpected value. Candidates who can only read files with pd.read_csv(“file.csv”) are limited to toy-sized datasets. The efficient approach is to read it line by line or in chunks. Garbage collection handles reference cycles—situations where objects reference each other, keeping reference counts above zero even when nothing else in the program points to them. Immutable objects (strings, numbers, tuples) have stable content and therefore stable hash values.
You use recursion, keep adding parent keys with a dot, when the value is not a dictionary you save it, this is useful in configs and logging systems. You use a dictionary for fast lookup and a doubly linked list (or OrderedDict) to track recent usage, when you access an item you move it to the end, when cache is full you remove the least recently used item, this gives O(1) time for both get and put. You first count how many times each character appears using a dictionary, then loop again through the string and return the first character whose count is one, if none exist return -1. First sort intervals by start time, then go through them and merge if the current interval overlaps with the last one in result, otherwise just add it, this makes the solution clean and fast. You use a sliding window with a set, move the right pointer adding characters, if a character repeats you move the left pointer and remove characters until it becomes unique again, and keep track of the max length seen so far.
GetByText finds elements by their visible text content. If your app is even mildly accessible, getByRole will work for most interactive elements. It is the most recommended locator strategy in Playwright because it matches how a real user (or assistive technology) finds the element.
Can You Differentiate Between Responsive, Fixed And Fluid Website Design?
This example demonstrates how to interact with elements on a webpage efficiently. They are crucial in ensuring that scripts do not hang indefinitely when waiting for elements to appear or certain conditions to be met. Playwright does not come with a dedicated built-in reporting tool, but it provides useful features to facilitate test reporting. Playwright handles asynchronous operations using Promises, allowing developers to write code that can run concurrently without blocking the main thread.
- Common questions cover strings, lists, dictionaries, sets, duplicate detection, counting, JSON validation, file parsing, retries, fixtures, mocking, and debugging.
- They’ve collectively created over 10,000 quizzes and lessons, serving over 100 million users.
- Leveraging NumPy’s capabilities enhances performance and productivity in handling large datasets and complex computations.
- Interning means Python reuses a single cached object for certain immutable values, so identity (is) comparisons return True.
- For SDETs and QAs, it acts as the single source of truth for test health, replacing the need to build and maintain custom HTML reporters.
- Learn how EY conducts its hiring process and prepare effectively with interview experiences shared by candidates across different roles.
The following questions will assess your ability to apply Python to real-world scenarios and will let us see project examples. Python has automatic memory management based on reference counting and having a garbage collector to free unneeded memory. Web based applications are typically tested with Selenium which is an automated tool for browser applications.
Data structures and algorithms are essential components of many Python applications. In Python, the csv library is extensively used for reading and writing data to CSV files. You’re developing a web application with the Flask framework and need to show a webpage with a form that accepts user input. Create a Python function that returns the name of the dictionary’s oldest individual. You have a dictionary in which the keys represent names and the values indicate ages. Although namespaces are used to uniquely identify each object in a program, these namespaces also have a defined scope where their objects may be used without a prefix.
What are Python’s built-in data types?
This can be done by defining user-defined main() function and by using the __name__ property of python file. It searches over the internet for the package and installs them into the working directory without the need for any interaction with the user. PYTHONPATH is used for checking if the imported packages or modules are available in the existing directories.
PySpark does not require Hadoop to run, but it does typically operate in a production environment with Hadoop (HDFS, YARN) as part of its architecture. It is considered one of the most effective optimizations for https://uvik.io/ improving the performance of production-scale ETL pipelines. For example, if a fact table is partitioned by date and is joined with a smaller dimension table containing data for only a few dates, Spark reads only the required partitions from the fact table instead of scanning the entire dataset. Dynamic Partition Pruning (DPP) is a Spark optimization technique that reduces the amount of data read during join operations.
Describe how you would handle memory optimization for large datasets in Pandas. How do you handle imbalanced datasets in Pandas? It is commonly used to compute lag or lead values, and it can be applied to both Series and DataFrame objects. It can be created using the set_index() method or by specifying index_col parameter while reading data from external sources.