0% found this document useful (0 votes)
3 views4 pages

Python Interview Questions ReBIT

This document contains a comprehensive list of Python interview questions and answers tailored for ReBIT's 2025 batch, covering basic, intermediate, and advanced topics. Key areas include Python features, data types, decorators, generators, multithreading, and practical coding problems related to data structures and algorithms. The content serves as a study guide for candidates preparing for Python-related interviews.

Uploaded by

tanmay4227
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Python Interview Questions ReBIT

This document contains a comprehensive list of Python interview questions and answers tailored for ReBIT's 2025 batch, covering basic, intermediate, and advanced topics. Key areas include Python features, data types, decorators, generators, multithreading, and practical coding problems related to data structures and algorithms. The content serves as a study guide for candidates preparing for Python-related interviews.

Uploaded by

tanmay4227
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Interview Questions and Answers for ReBIT (2025 Batch)

Basic Python Questions

Q: What are the key features of Python?

A: Python is interpreted, dynamically-typed, object-oriented, and supports high-level data structures and

libraries.

Q: What are Python's data types?

A: Common types include int, float, bool, str, list, tuple, dict, and set.

Q: Difference between lists and tuples?

A: Lists are mutable, tuples are immutable. Tuples use less memory and are faster.

Q: How is memory managed in Python?

A: Through reference counting and garbage collection via the `gc` module.

Q: Use of *args and **kwargs?

A: *args passes variable-length non-keyword args; **kwargs passes keyworded args.

Q: Difference between is and ==?

A: `is` checks identity, `==` checks equality of values.

Q: What are list comprehensions?

A: A concise way to create lists: [x for x in range(5)]

Q: How do you import modules?

A: Use `import module_name` or `from module import name`.

Q: What is PEP8?

A: PEP8 is the style guide for Python code to ensure readability.

Q: Explain type casting in Python.

A: Using int(), float(), str(), list(), etc. to convert data types.


Python Interview Questions and Answers for ReBIT (2025 Batch)

Intermediate Python Questions

Q: What are decorators in Python?

A: Decorators modify the behavior of a function using `@decorator_name` syntax.

Q: What are generators?

A: Generators return an iterator using `yield`. Efficient for large datasets.

Q: Difference between lambda and def?

A: `lambda` creates anonymous functions; `def` creates named functions.

Q: Explain try-except block.

A: Used to catch and handle exceptions in code execution.

Q: What is a virtual environment?

A: An isolated Python environment to manage dependencies per project.

Q: Explain deep copy vs shallow copy.

A: Shallow copies reference nested objects, deep copies clone everything.

Q: What is the GIL?

A: Global Interpreter Lock prevents multiple native threads in Python interpreter.

Q: Difference between map and filter?

A: `map` transforms items, `filter` selects items based on condition.

Q: What is list slicing?

A: Access sublists using [start:stop:step] syntax.

Q: What is duck typing?

A: If it behaves like a duck, it is a duck - based on behavior, not type.


Python Interview Questions and Answers for ReBIT (2025 Batch)

Advanced Python Questions

Q: Explain multithreading in Python.

A: Limited by GIL; better to use multiprocessing for parallel tasks.

Q: What is async programming?

A: Using `async`/`await` to handle non-blocking IO operations.

Q: How does Flask work?

A: A micro web framework for Python used to build APIs.

Q: What is a context manager?

A: Used with `with` statement for resource management, like files.

Q: How to profile Python code?

A: Use `cProfile`, `line_profiler` to analyze performance bottlenecks.

Q: What is monkey patching?

A: Dynamically changing classes or modules at runtime.

Q: What are metaclasses?

A: They define behavior of classes themselves.

Q: How to secure Python web apps?

A: Use input validation, HTTPS, CSRF tokens, JWTs, etc.

Q: Explain memory leaks in Python.

A: Occur when objects aren't garbage collected due to references.

Q: What is SQLAlchemy?

A: ORM library for handling databases in Python.


Python Interview Questions and Answers for ReBIT (2025 Batch)

Python for DSA and Coding Interviews

Q: Reverse a linked list in Python.

A: Use iteration or recursion to reverse pointers.

Q: Detect a cycle in a list.

A: Use Floyd's Cycle Detection algorithm (slow/fast pointers).

Q: Find the first non-repeating character.

A: Use collections.Counter and iterate over string.

Q: Implement a stack using two queues.

A: Use two queues to simulate LIFO behavior.

Q: Check if a string is a palindrome.

A: Compare string to its reverse.

Q: Sort a dictionary by value.

A: Use `sorted(dict.items(), key=lambda x: x[1])`.

Q: Count words in a sentence.

A: Use `split()` and `Counter` from collections.

Q: Merge two sorted lists.

A: Use two pointers to compare elements and merge.

Q: Implement binary search.

A: Recursive or iterative approach with mid-point logic.

Q: Find the maximum subarray sum.

A: Use Kadane's algorithm.

You might also like