Sunday 31 May 2015

Python Interview Questions

Software testing - Questions and Answers - Python Interview Questions
  1. Question: How Python can be used in software testing?
    Answer:
    1. To generate test data; parse test results; generate reports; testing API calls etc.
    2. Python to extract requirements from a Word document.
    3. For testing tasks automation, setting up environments for tests, extracting performance data, etc...
    4. Testers use Python extensively in many companies with Selenium for test automation.
    5. For writing desktop applications used by testers.
    6. Test data manipulation.
    7. To build test environment
    8. Testing with IronPython on .NET
  2. Question:What Python frameworks do you know?
    Answer:Framework called Web2py, PAMIE (Python automation Module for I. E.), The py.test framework
  3. Question:What tools that helps Python development do you know?
    Answer:There are good tools for helping Python development such as Notepad++ with the PyNPP plugin and Eclipse with PyDev and PyUnit.
  4. The following is displayed by a print function call:
    yesterday
    today
    tomorrow
    Please write an example of a print function.
    Answer: print('yesterday\ntoday\ntomorrow')
  5. The following is displayed by a print function call:
    hello-how-are-you

    Please write an example of a print function.
    Answer: print('hello' + '-' + 'how' + '-' + 'are' + '-' + 'you')
  6. Question: What does the expression len('') evaluate to?
    Answer: 0
  7. Considering the following code:
    s = 'catandapple'
    Write an expression that evaluate to 'apple'.
    Answer: s[-5:]
  8. Question: Write an expression that evaluate to True
    Answer: len('aaddgg') == 6
  9. Question: Write the code that calculate the sum of even numbers from x1 till x2
  10. Question: What are "tuples"
    Answer: Tuples are immutable sequences: they cannot be modified. Tuples use parentheses instead of square brackets: tup = ('test', 5, -0.2)
  11. Question: What are the rules for legal Python names?
    Answer:
    1. Names must start with a letter or _.
    2. Names must contain only letters, digits, and _.
  12. Question: What is the dictionary tipe in Python?
    How to Access Information From Dictionaries and Modify it?
  13. To display a value in the console, what Python keyword do you use? (Print)
  14. Python file names traditionally end in what characters after a period? (.py)
  15. An if statement can have how many elif parts? (Unlimited, i.e., 0 or more)
  16. How many control objects are allowed in a frame? (Unlimited, i.e., 0 or more)
  17. When you enter text into an input field and press enter, the text is passed to the input field's event handler.
    What is the data type of the text? (string)
  18. What does the draw handler parameter represent? (The canvas)
  19. What happens if you draw text outside the canvas coordinates?
  20. You want a timer to create exactly 1000 events. Suggest any solutions.
    (Have a global counter for the number of timer calls. In the timer handler, increment the counter. In the timer handler, check the count and possibly stop the timer.)
  21. How many timers can you have running at once? (Unlimited)
  22. Give example of list - [1, 2, 3]
  23. Give example of Tuple - (1, 2, 3)
  24. Which types of data are immutable in Python? (Numbers, Tuples, Strings, Booleans)
  25. Which types of data are mutable in Python? (List)

4 comments:

  1. Hi Tomas Nemeth,


    Great info! I recently came across your blog and have been reading along.
    I thought I would leave my first comment. I don’t know what to say except that I have

    I have made 2 codes and 1 PDF and Lower Spine Dataset from machine learning is used from kaggle.

    In mittal_20_3.py file i have divided the dataset in train and test and found performance of SVM algorithm.

    Now my next task is to improve efficiency of SVM, to do so,

    I have two ways,
    1) Implementing Kernel Trick that is defining new kernel for SVM.
    2) Or making combination of various available kernels and improve efficiency, for that refer attached PDF

    In second .py file i tried to manually code for SVM so that kernel can be code uniquely.

    I would like to optimize the kernel.

    Once again thanks for your tutorial.


    Thanks & Regards,
    Morgan lee

    ReplyDelete
  2. Hi Tomas,

    Gratitude for putting up this prolific article! You truly make everything a cake walk. Genuinely good stuff, saving time and energy.

    totally new here (and quite new in the kingdom of ML) and this is my first question;

    I am using XGBClassifier (latest version) in python training a dataset where the observations (should) have different weights. More specifically in am trying modelling the probability for an insurance policy to have a claim. The insurance policies may be on risk (have insurance cover) for different durations e.g. 1 month, 6-month 1 year creating the need to weight them according to how long they are on risk.

    In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed. Whenever the variable is searched out, this box will be searched, to get corresponding object.

    Is it possible to pass this (N*1) vectors which sums up to 1 to the XGBClassifier? If so, is the implication of this that obs. with weights are more likely to be picked by the sampling algo?

    Hope somebody can enlighten me. Please let me know if I need to clarify something.

    By the way do you have any YouTube videos, would love to watch it. I would like to connect you on LinkedIn, great to have experts like you in my connection (In case, if you don’t have any issues).
    Please keep providing such valuable information.

    Thank you,
    John

    ReplyDelete
  3. I learned World's Trending Technology from certified experts for free of cost. I got a job in decent Top MNC Company with handsome 14 LPA salary, I have learned the World's Trending Technology from python training in btm layout experts who know advanced concepts which can help to solve any type of Real-time issues in the field of Python. Really worth trying Freelance SEO expert in Bangalore

    ReplyDelete