Cracking Python Interview Questions On Programming
Cracking Python Interviews: Automation and Development ( 12 hrs of python interview questions on programming)
Description
Welcome to Cracking the Python Interview
This course is from a software engineer who has managed to crack interviews in around 16 software companies.
Sometimes, life gives us no time to prepare, There are emergency times where in we have to buck up our guts and start bringing the situations under our control rather then being in the control of the situation. At the end of the day, All leave this earth empty handed. But given a situation, we should live up or fight up in such a way that the whole action sequence should make us proud and be giving us goosebumps when we think about it right after 10 years.
This course covers all python programming interview questions extensively and will help you to crack all python interviews related to programming
This course will help you to crack python interviews to get your next python automation or development job. This course will teach you how to utilize your python programming skills in your next role as a python automation engineer and developer.
Anybody who completes this course, in a mere 12 to 13 hours of journey in this course, he or she will able to gain up to 3 years of experience in python coding
The problem faced by most them is it is difficult for them to clear python automation or development interviews. Because in interviews, all can answer questions expecting one line answers in python. But most of them lose confidence when they are asked to write programs during interviews. Taking up this course will help you to develop and boost your programming skills especially during interviews. Understanding and learning every program here in this course will give you a lot of confidence to face the interviewer.
Sometimes, Even though people manage to clear the interviews, due to poor programming skills, it is difficult for them to survive in the organization. This course comes in handy during this situation. Apart from helping the students to clear the interviews, this course puts in great effort to explain each and every program in the course. Each and every line in these programs are explained to much greater depths.
This course covers the following:
Advanced and Basic Python Interview questions on Programming
Unit and Api Testing Module in Python
Static Code Analyzer Tool for Python
Code Coverage Tool for Python
Course on How to sell yourself in Automation Face to Face Interviews (This has Tips, Tricks and Project ideas to clear Automation Interviews. This involves 10 Face to Face Interview case studies of Automation Interviews )
The following programming Questions are answered in the course:
1. How is char, integer, float and a string variable created and printed in python
2. Create a Tuple with values belonging to a single datatype. print the values
3. Create a Tuple with values belonging to mixed datatypes. print the values
4. Create a Tuple which contains the following:
- a string
- a Sub List of values belonging to a single data type
- a Sub Tuple with values belonging to a single data type
5. Explain the concept of Tuple Packing
6. Explain the concept of Tuple Unpacking
7. Define a tuple which contains a string value. When queried, the tuple should be of type 'class str‘.
8. Define a tuple which contains a string value. When queried, the tuple should be of type 'class tuple‘.
9. Can we define a tuple with out the conventional usage of the parenthesis
10.Given a tuple:
my_tuple = ('p','z','r','q','i','t’), If we print my_tuple[6], does it print '0', "" or does it throw an error.
11.Given a tuple:
my_tuple = ('p','z','r','q','i','t’), If we print my_tuple[2.0], does it print 'r' or will it throw an error
12.Given a tuple:
my_tuple = ('p','z','r','q','i','t’)
print 't' and 'p' parsing from the other side of the tuple
13.Given a tuple:
my_tuple = ('a','l','g','o','r','i','t','h','m')
Using the concept of slicing, print - 'l', 'g', 'o‘
14.Given a tuple:
my_tuple = ('a','l','g','o','r','i','t','h','m')
Using the concept of slicing, print – ‘a', ‘l’
15.Given a tuple:
my_tuple = ('a','l','g','o','r','i','t','h','m')
Using the concept of slicing, print – ‘h', ‘m’
16.Given a tuple:
my_tuple = ('a','l','g','o','r','i','t','h','m')
Using the concept of slicing, print the whole tuple
17.Given a tuple:
my_tuple = ('a','l','g','o','r','i','t','h','m')
- delete the element at the 3rd index, print the tuple
- delete the whole tuple
18.Define a tuple having a list of 2 integers in it.
modify the first element in the list and print the Tuple
19.Can tuples be reassigned
20.Using print statement do the following:
- output the concatenation of two tuples
- using an example tuple in the print statement, print the word 'World' 3 times
21.Check whether the given element is present in a tuple or not
22.Write a program in 2 lines:
Using a for loop and a tuple to print the below:
hello earth
hello mars
23.Can we convert tuples to lists and vice versa ?
24. Write a program to print a new list which contains all the first characters of strings present in a list.
list_states =[" Madhya Pradesh", "Karnataka", "Chennai", "Goa“, "Delhi"]
25. Write a program to replace each string with an integer value in a given list of strings. The replacement integer value should be a sum of Ascci values of each character of the corresponding string.
list_rivers =["Ganges", "Godavari", "Brahmaputra", "Narmada", "Yamuna", "Mahanadi", "Kaveri", "Tapti"]
26. Write a program which prints all duplicated values in a list
27. Write a program to print True if the first element or last element is divisible by 4 in the given list.
28. Write a program to print True if the first and last elements are equal and odd numbers in the given list.
29. Write a program to print True if the sum of the first and last elements are equal from the given two lists.
30. Write a program to print the sum of all the elements in the given list.
31. Write a program to sort a list of integer elements
32. Write a program to print a new list by doing a left rotate on the given list.
Ex: input: [4, 5, 6, 7] output: [5, 6, 7, 4]
33. Write a program to find the maximum number from the given list of numbers and replace all the numbers from the list with the maximum number.
34. Given two lists x and y, print two new lists as output which includes all the elements of x and y except for the first and last elements.
35. Given a list, Write a program which prints all elements which are multiples of 4.
36. Given a list
colours1 = ["red", "green"] with the help of a new list,
modify the list colours1, such that
colour1 = ["red", "blue" ]
37. Given a list
list1 = ['a','b','c','d‘] with the help of 'slice' construct and a new list, make changes in list1, such that list1=['a','x','c','d']. Verify if the original list is modified
38. Given a list, lst1 = ['a','b',['ab','ba']] with the help of 'slice' construct and a new list, modify lst1 such that
lst1=['a', 'b', ['ab', 'd']]
39. Given a list
lst1 = ['a','b',['ab','ba']]
Use the function ‘deepcopy’ and a new list to make changes in the lst2. Verify if the list is modified
40. Given a list
lst1 = ['a','b',['ab','ba']]
Use the function ‘copy’ and a new list to make changes in the lst2. Verify if the list is modified
41. Convert a integer to string
42. Write a pgm to compare two string using
- str() and eval() functions
43. Write a pgm to compare two string using
- repr() and eval() functions
44. Write a program to reverse a string
45. Write a program to print a new string which contains 4 copies of the last three characters from the given string.
46. Write a program to print the output string which contains last half + first half of the given string. The given string is of even length.
47. Given a string, print the output string by removing the first and last character of the string.
48. Given a string, Write a program which rotates left 2 and prints the output as below.
Ex: input: Hello
output: lloHe
49. Concatenate two given strings by omitting the first character
50. Write a program to count the number of occurrences of each character in a given string
51. Write a program to convert all the vowels to uppercase for the given input string.
52. Write a program to reverse the given input list
53. Write a program to count number of occurrences of vowels in a given string.
54. Write a program to convert lower case to upper case letter?
55. Write a program to print the longest length string from given input list of strings.
56. Write a program to find if a given number is prime or not
57. Write a program to find the factorial of a given number
58. Write a program to construct two dimensional array and print the same.
59. Write a program to convert a number to base 10,
base 2 , base 8 , base 16 number systems
60. Create a directory with name “newdir” and create a file “tempo” in the new directory “newdir” .
61. Rename a file in a particular directory
Take the backup before you rename the files.
62. List all the files from a given path and verify the file test.txt file exists or not? If the file does not exist create it.
63. Write a program to count each word from the given file
64. Write a program to retrieve the words XYZ and ABC from a given file
65. Write a program to get some keywords from a file.
66. Get the current working directory and navigate to all the directories in the file.
67. Remove all the empty directories from a given path
68. Get file size, inode, owner of a each file in a given path
69. Get the file permissions of all files in a given path and change all the file permissions to 666
70. Execute standard Linux commands using python programming
71. Create a helloworld. py file and run this program by invoking it in another python file.
72. Create a helloworld. py, run this program in one terminal and kill helloworld. py using another program
73. Get system free, used , total memory
74. Redirect the output of the file
75. Write a more optimized program to display the contents in the text file
76. Write a program to reverse the contents of the file
77. Get a list of all the current running services on your system
78. create two modules one. py and two. py. Define a function in one. py and call it from two. py. Design the one. py module in such a way that:
- After importing, It can help two. py to call and execute the function defined in it
- When one. py is run as a single script, It should execute successfully with out depending on the other module
79. Given a string containing months, dates and years, Write a regular expression to match the month, date and print them accordingly
String: "July 24 2016, September 9 2016, Dec 12 2016“
80. Given a string containing months, dates and years, Write a regular expression to match the month and print them accordingly
String: "July 24 2016, September 9 2016, Dec 12 2016“
81. Given a string containing names and age of a list of people, Write a regular expression to match the name, age and print the starting and ending positions of all the matches in the string.
String: "Tom 25, Abel 26, Isabella 32"
82. Given a string containing months, dates and years, Write a regular expression to match the month, date and print them as
Input: "July 24 2016, September 9 2016, Dec 12 2016“
Output: 24 of July 2016, 9 of September 2016, 12 of Dec 2016
83. Use the ‘re’ regular expression compilation feature and replace 'Hello Sir' with 'Hello John‘
84. Using Regular Expressions. Of the below statement:
"girls are prettier than boys"
print the below strings:
'girls' 'prettier
85. Write a regular expression to match email address and ip address
86. Given a string str="hello worldello ello"
Replace the substring 'ello' with substring 'HIII' and return the number of replacements successfully done
87. Get all the count values from the file ‘comments.xml’ and print the sum of all the count
88. Get only university names from the file ‘gjson.json’
89. From the file comments.json, read all the data display the information based on the input name given
90. Create a HTML table using python. Add the below section headers in a row
TestID Test Name Test Steps Expected_Output Actual_Output Results Remarks
91. Create a class with a class variable and a member function. Print the value of the class variable
Through the class name, check whether the member function is bound or unbound
92. Create a class with a class variable and a member function. Create a object of the class and execute the following: Print the value of the class variable using the object Through the object, check whether the member function is bound or unbound
93. Explain the difference between Class and Instance Variables
94. How we can declare constructor and destructor in python
95. Explain the instance method
96. Write an external function out of the class which will give us the count of the number of objects of the class
97. Write an external function out of the class which will use the object of the class to give the count of the number of objects of the class
98. Define a member function of the class which when called will always take class as the first argument and returns the count of the number of objects of the class
99. Explain the application of a static method
100. How do you find methods or attributes of a object
101. Explain the concept of finally
102. Explain the concept of zip
103. Explain the below:
Property
Property decorators
Property setters
Property getters
104. Print numbers in a list with out using loops
105. With the aid of __iter__ function, develop your own number printing function without using loops. print the numbers in straight order
106. With the aid of __iter__ function, develop your own number printing function without using loops. print the numbers in reverse order.
107. Explain the concept of yield function in generators
108. Using the yield construct, write a program to find the pattern in a file and print the corresponding lines
109. Define a first function. Have a nested function called second function in first function and call the second function through the variable
110. Facilitate a log such that
Before entering the function, a log 'Before the function call' is printed
After the function is over, a log 'After the function call' is printed
conditions: The log printing function should be generalized such that it can execute before and after any function.
The executing function should be independently called in the program
112. How split and join methods works in python
113. Create a module in python ?
114. How you will share the global variables across the modules
115. Create a package in python
116. Explain the concept of lambda2.
117. Given a list
my_list = [1, 5, 4, 6, 8, 11, 3, 12]
print the output as: [4, 6, 8, 12]
program on below conditions:
- should not use any loops
- should not use user defined functions3.
118. Given a list
my_list = [1, 5, 4, 6, 8, 11, 3, 12]
print the output as: [2, 10, 8, 12, 16, 22, 6, 24]
program on below conditions:
- should not use any loops
- should not use user defined functions
119. Given a list
my_list = [1, 2, 3, 4]
print the output as: 24
program on below conditions:
- should not use any loops
- should not use user defined functions
120. Concatenate and print the below lists with out using tempervory list or a variable
list1 = ['A','B','C']
list2 = [10,20,30]
121. Write a single line of code to print the square of all the numbers for a range of 10 numbers
122. Write a single line of code to multiply every element of a list by three and assign it to a new list
123. Write a single line of code to make a new list by taking the first letter of each word from the given list
124. Write a single line of code to extract all the numbers from a string
125. Explain the use of ‘pass’ in python
126. Write a program which will open the file, write the contents but will not explicitly close the file.
The program should execute successfully
127. Write a program which will open the file, write the contents but will not explicitly close the file.
The program should execute successfully
128. What is inheritance
129. What is multiple inheritance
130. What is multilevel inheritance
131. Numpy
132. Write a program to do the following:
create a new test suite
create a new test case
add the test suite
add the new test case to the test suite
run the test suite
133. Write a program to do the following:
- create a new test suite
- create a new test case
In an alternate way do the following:
- add the test suite
- add the new test case to the test suite
- run the test suite
134. Write a pgm to run a test suite having 2 testcases
135. Write a pgm to explain the concept of setup and teardown apis
136. Write a pgm which creates a testsuite with the test case that does the following test validations:
- checks if the element is true or false
- checks if the both the elements are equal or unequal
137. Write a pgm which creates a testsuite with the test case that does the following test validations:
- checks if an element belongs to a given class
138. Write a pgm which creates a testsuite with the testcase that does the following test validations:
checks if an element is greater then the other element
checks if an element is less then the other element
checks if an element is greater then or equal to the other element
checks if an element is less then or equal to the other element
checks if an element is almost equal to the other element
checks if an element is almost not equal to the other element
139. Write a pgm which creates a testsuite with the testcase that does the following test validations:
checks if a string is a substring of another string
checks if a string is not a substring of another string
checks if one dictionary is a subset of another dictionary
checks if both dictionaries are equal
checks if both lists are equal
checks if both tuples are equal
checks if both sets are equal
140. Write a pgm to run a testsuite having 2 testcases. Run only the first testcase and have a mechanism to skip running the second testcase
141. Write a pgm to run a testsuite having 2 testcases. Run both the testcases and have a mechanism to skip running the second part of the 2nd testcase while the first part being run
142. Write a pgm to run a testsuite having 2 testcases. Run only the first testcase and have a mechanism such that based on a given condition skip running the second testcase
143. Write a pgm to run a testsuite having 2 testcases. Force the second testcase to fail
144. Write a pgm to run a testsuite having 2 testcases. demonstrate the use of unittest.TextTestRunner() function
145. Write a pgm to run 2 testsuites with 2 testcases each
146. Write a unit test program to test the basic add functionality of the calculator program
147. Write a sample add pgm and run the static code analyzer and fix the errors
148. How can i customize my pylint checker to override the python coding standards by following my personal coding style
having my own variable name styles
having my own constant name styles
having my own module name styles
having my own function name styles
149. Define a class and run the static code analyzer and fix the errors
150. How to get the details of specific messages of pylint
151. Generate the static code analysis report in the colorized format
152. Use the static code analyzer to detect bad names in the code
153. In the code using the static code analyzer convert bad names to gud names
154. Define the maximum line length in the code
155. Set the indent string
156. code coverage
157. how to sell yourself in automation interviews
What You Will Learn!
- Answering Approach to python programming interview questions
- Confidence in resolving the python programming questions in the interviews. Confidence in clearing interviews.
- Ability to explain each and every line in the python program
- Ability to understand each and every line of the python code base
- Anybody who takes up this course will be able to crack python interviews on programming
Who Should Attend!
- All Manuel testers preparing for python interviews and looking forward to change their careers to python automation and development
- All Automation engineers preparing for python interviews and looking forward to change jobs
- All Fresh graduates preparing for python interviews to start their career in python
- All python developers preparing for python interviews to change jobs