Arich Infotech Cts Interview Questions

8 What are dataframes?

A dataframe refers to a two dimensional mutable data structure or data aligned in the tabular form with labeled axes(rows and column).


  • data:It refers to various forms like ndarray, series, map, lists, dict, constants and can take other DataFrame as Input.
  • index:This argument is optional as the index for row labels will be automatically taken care of by pandas library.
  • columns:This argument is optional as the index for column labels will be automatically taken care of by pandas library.
  • Dtype: refers to the data type of each column.
  • 1 What are functions in Python?

    A function is a block of code which is executed only when a call is made to the function. def keyword is used to define a particular function as shown below:

    Output: Hi, Welcome to Intellipaat

    7 What advantages do NumPy arrays offer over (nested) Python lists?

    Nested Lists:

  • Python lists are efficient general-purpose containers that support efficient operations like insertion,appending,deletion and concatenation.
  • The limitations of lists are that they don’t support “vectorized” operations like element wise addition and multiplication, and the fact that they can contain objects of differing types mean that Python must store type information for every element, and must execute type dispatching code when operating on each element.
  • Numpy:

  • NumPy is more efficient and more convenient as you get a lot of vector and matrix operations for free, which helps to avoid unnecessary work and complexity of the code.Numpy is also efficiently implemented when compared to nested
  • NumPy array is faster and contains a lot of built-in functions which will help in FFTs, convolutions, fast searching, linear algebra,basic statistics, histograms,etc.
  • 4 Differentiate between NumPy and SciPy?

    NumPy SciPy
    NumPy stands for Numerical Python SciPy stands for Scientific Python
    It is used for efficient and general numeric computations on numerical data saved in arrays. E.g., sorting, indexing, reshaping, and more This module is a collection of tools in Python used to perform operations such as integration, differentiation, and more
    There are some linear algebraic functions available in this module, but they are not full-fledged Full-fledged algebraic functions are available in SciPy for algebraic computations

    4 Explain the use of the ‘with’ statement and its syntax?

    In Python, using the ‘with’ statement, we can open a file and close it as soon as the block of code, where ‘with’ is used, exits. In this way, we can opt for not using the close() method.

    6 Can you write an efficient code to count the number of capital letters in a file?

    The normal solution for this problem statement would be as follows:

    with open(SOME_LARGE_FILE) as countletter:

    To make this code more efficient, the whole code block can be converted into a one-liner code using the feature called generator expression. With this, the equivalent code line of the above code block would be as follows:

    count sum(1 for line in countletter for character in line if character.isupper())

    2 How can you randomize the items of a list in place in Python?

    This can be easily achieved by using the Shuffle() function from the random library as shown below:

    Output: [‘Loves’,’He’ ,’To ,’In’, ‘Python’,’Code’]

    5 What does *args and **kwargs mean?

  • .*args: It is used to pass multiple arguments in a function.
  • **kwargs: It is used to pass multiple keyworded arguments in a function in python.
  • Want to know about the real-world uses of Python? Read our detailed blog on Python Project ideas now.

    I.T.MNC Placed Train & Hire Candidate Speaks about Arich Infotech

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *