Loading, please wait...

A to Z Full Forms and Acronyms

Python Viva Question

This Post lists the List of Python Viva Question and Answers.

List of Python Viva Question and Answers

Q1: Name the key features of Python?

Answer: There are many key features in python and some of them are listed below:

  1. Dynamically-typed
  2. Interpreted
  3. Object-oriented
  4. Concise and simple

Q2: How to check if all characters in a string are alphanumeric?

Answer: isalnum(): In python, we can use the "isalnum()" method to check whether all the characters are alphanumeric or not in a string variable.

Q3: Name the built-in types available in Python?

Answer: We have Mutable and Immutable as built-in types in python, listed as below:

a) The mutable ones include:

  • List
  • Sets
  • Dictionaries

b) The immutable types include:

  • Strings
  • Tuples
  • Numbers

Q4:  Explain the difference between a list and a tuple?

Answer: The list is mutable while the tuple is not. Tuples can be hashed as in the case of making keys for dictionaries.

read more about Tuples in python...

Q5: What is the use of %s in python?

Answer: "%s" is a format specifier which transmutes any value into a string.

Q6: What is a pass in Python?

Answer: No-operation Python statement refers to pass.

Q7: How are files deleted in Python?

Answer: To delete a file in Python:

  1. Import OS module
  2. Use os.remove() function

Q8: What is pep 8?

Answer: Python Enhancement Proposal or pep 8 is a set of rules that specify how to format Python code for maximum readability.

Q9: What is [::-1} used for?

Answer: [::-1} reverses the order of an array or a sequence. However, the original array or the list remains unchanged.

Q10: What is Numpy?

Answer: NumPy stands for "Numerical Python".

It is used for efficient and general numeric computations on numerical data saved in arrays. E.g., sorting, indexing, reshaping, and more.

Q11: What is Scipy?

Answer: SciPy stands for "Scientific Python".

This module is a collection of tools in Python used to perform operations such as integration, differentiation, and more.

Q12: Explain how to delete a file in Python?

Answer: Using a command os.remove(file name / file path) or os.unlink(file name / file path).

Q13: How can you access a module written in Python from C?

Answer: If we need to access the logic from a module written in the programming C we can use the "PyImport_ImportModule" function with a parameter name as the module name like below:

Module = =PyImport_ImportModule("<modulename>");

Q14: What is slicing?

Answer: Slicing is a technique that allows us to retrieve only a part of a list, tuple, or string.

Q15: How do you reverse a list?

Answer: We have a list of built-in functions available with the "List" collection and from them using the reverse() method we can reverse the list.

Check your Python Skills with:

Python Multiple Choice Questions And Answers

A to Z Full Forms and Acronyms

Related Article