0% found this document useful (0 votes)
30 views

Python Interview Questions-4

The document contains questions about debugging Python programs, the yield keyword, converting between list, tuple, set and string data types, negative indexing, enumerate, random numbers, loops and global variables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Python Interview Questions-4

The document contains questions about debugging Python programs, the yield keyword, converting between list, tuple, set and string data types, negative indexing, enumerate, random numbers, loops and global variables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON QUESTIONS 4

1. How do you debug a Python program?


2. What is <Yield> Keyword in Python?
3. How to convert a list into a string?
4. How to convert a list into a tuple?
5. How to convert a list into a set?
6. How to count the occurrences of a particular element in the list?
7. What is NumPy array?
8. How can you create Empty NumPy Array In Python?
9. What is a negative index in Python?
10. How do you Concatenate Strings in Python?
11. What is the output of the below program?
>>>names = ['Chris', 'Jack', 'John', 'Daman']
>>>print(names[-1][-1])
12. What is Enumerate() Function in Python?
13. What is data type SET in Python and how to work with it?
14. How do you Concatenate Strings in Python?
15. How to generate random numbers in Python?
16. How to print sum of the numbers starting from 1 to 100?
17. How do you set a global variable inside a function?
18. What is the output of the program?
names1 = ['Amir', 'Bear', 'Charlton', 'Daman']
names2 = names1
names3 = names1[:]

names2[0] = 'Alice'
names3[1] = 'Bob'

sum = 0
for ls in (names1, names2, names3):
if ls[0] == 'Alice':
sum += 1
if ls[1] == 'Bob':
sum += 10

print sum
19. What is the output, Suppose list1 is [1, 3, 2], What is list1 * 2?
20. What is the output when we execute list(“hello”)?

You might also like