Featured Post

SQL Interview Success: Unlocking the Top 5 Frequently Asked Queries

Image
 Here are the five top commonly asked SQL queries in the interviews. These you can expect in Data Analyst, or, Data Engineer interviews. Top SQL Queries for Interviews 01. Joins The commonly asked question pertains to providing two tables, determining the number of rows that will return on various join types, and the resultant. Table1 -------- id ---- 1 1 2 3 Table2 -------- id ---- 1 3 1 NULL Output ------- Inner join --------------- 5 rows will return The result will be: =============== 1  1 1   1 1   1 1    1 3    3 02. Substring and Concat Here, we need to write an SQL query to make the upper case of the first letter and the small case of the remaining letter. Table1 ------ ename ===== raJu venKat kRIshna Solution: ========== SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS capitalized_name FROM Table1; 03. Case statement SQL Query ========= SELECT Code1, Code2,      CASE         WHEN Code1 = 'A' AND Code2 = 'AA' THEN "A" | "A

10 Must Read Python Interview Questions

10  Must Read Python Interview Questions

Here are ten python interview questions useful for your project use and other interviews.


Python Interview questions 


Python is a powerful scripting language. And you can use it in the web development, and science applications. Below, you will find interview questions on core python and web-framework as well.


1. What is PEP8?


PEP8 is a set of rules to format Python code for better readability. Further, you can read the user guide on PEP8.


2. What is memory management, and explain in detail?


Python manages memory automatically - cleaning, allocating, and managing; the detailed mechanism is as follows:


In the interview, you need to tell as below:

  • Python manages private heap space and is accessible to the only interpreter.
  • In heap space, Python stores objects and data structures.
  • The memory allocation is the responsibility of the memory manager
  • Python heap divides into pools (1 heap=64 pool), and the Pool divides into blocks (256 KB).
  • Python has an inbuilt garbage collector, which recycles the unused memory and frees the memory.

3. What are the different data types?

  • int
  • string
  • list
  • tuple
  • dictionary
  • Boolean

Check here more on data types.



4. What is Python Copy an object?


The '=' operator and COPY module you can use to copy objects. Here are the examples.



5. What are the various types of inheritances?


There are different types of inheritances:

  • Single inheritance
  • Multiple-inheritance
  • Multi-level inheritance
  • Hierarchical inheritance
  • Hybrid inheritance

Here is the example for each inheritance.



6. What are the differences between List and Tuple?


The list is mutable. But, tuple is immutable. Check out more differences between these two.



7. What is List Comprehension?


It is a concise way of creating a list and is popularly called List Comprehension.


Example:


a=[n*2 for n in range(10)]
print(a)
myList = [ num**2 for num in range(1,10) if num %2==0]
print(myList)


Python List comprehension examples.



8. What is dictionary comprehension?


The method of transforming one Dictionary into another Dictionary is called dictionary comprehension. Here are more examples of Dictionary comprehension.



9. What is slicing?


You can slice an object using the slice() method, which allows three parameters - start, length, and separator you can give.


Here is the best example for the slice method.



10. What is a negative index?


Internally python assigns to '-1' for the last occurrence of a string. Python assigns a negative index (-1, -2, and so on) in reverse order.  Here is the best example for a negative index.



References

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

Explained Ideal Structure of Python Class

How to Check Kafka Available Brokers