For a Development Engineer interview (like Calsoft, TCS, Capgemini, Cognizant,
etc.), these are the Top 20 Python coding questions you should be able to solve.
1. Reverse a String
PythonRuns=input()
print(s[::-1])
2. Check Palindrome
PythonRuns=input()
ifs==s[::-1]:
print("Palindrome")
else:
print("Not Palindrome")
3. Find Largest Number
PythonRunnumbers= [10, 5, 18, 7]
largest=numbers[0]
fornuminnumbers:
ifnum>largest:
largest=numprint(largest)
4. Fibonacci Series
PythonRunn=int(input())
a, b=0, 1foriinrange(n):
print(a, end=" ")
a, b=b, a+b
5. Factorial
PythonRunn=int(input())
fact=1foriinrange(1, n+1):
fact*=iprint(fact)
6. Prime Number
PythonRunn=int(input())
ifn<2:
print("Not Prime")
else:
foriinrange(2, int(n**0.5) +1):
ifn%i==0:
print("Not Prime")
breakelse:
print("Prime")
7. Count Vowels
PythonRuns=input().lower()
count=0forchins:
ifchin"aeiou":
count+=1print(count)
8. Remove Duplicates
PythonRunlst= [1,2,2,3,4,4]
print(list(set(lst)))
9. Second Largest Element
PythonRunlst= [10,5,20,15]
lst=list(set(lst))
[Link]()
print(lst[-2])
10. Count Frequency
PythonRuns=input()
freq= {}
forchins:
freq[ch] =[Link](ch,0)+1print(freq)
11. Sum of Digits
PythonRunn=int(input())
total=0whilen>0:
total+=n%10n//=10print(total)
12. Swap Two Numbers
PythonRuna=10b=20a, b=b, aprint(a, b)
13. Find Maximum in Dictionary
PythonRund= {'a':10,'b':25,'c':15}
print(max(d, key=[Link]))
14. Sort Dictionary by Value
PythonRund= {'a':3,'b':1,'c':2}
result=dict(sorted([Link](), key=lambdax: x[1]))
print(result)
15. Merge Two Dictionaries
PythonRund1= {'a':1}
d2= {'b':2}
[Link](d2)
print(d1)
16. Count Words
PythonRunsentence=input()
print(len([Link]()))
17. Find Missing Number
PythonRunarr= [1,2,3,5]
n=5missing=n*(n+1)//2-sum(arr)
print(missing)
18. Bubble Sort
PythonRunarr= [5,2,8,1]
foriinrange(len(arr)):
forjinrange(len(arr)-i-1):
ifarr[j] >arr[j+1]:
arr[j], arr[j+1] =arr[j+1], arr[j]
print(arr)
19. Linear Search
PythonRunarr= [10,20,30,40]
key=30foriinrange(len(arr)):
ifarr[i] ==key:
print("Found at", i)
breakelse:
print("Not Found")
20. Binary Search
PythonRunarr= [10,20,30,40,50]
key=40low=0high=len(arr)-1whilelow<=high:
mid= (low+high)//2ifarr[mid] ==key:
print("Found")
breakelifarr[mid] <key:
low=mid+1else:
high=mid-1
⭐ Bonus Questions (Very Frequently Asked)
Two Sum
Anagram Check
Armstrong Number
GCD and LCM
Reverse Words in a Sentence
Find Duplicate Elements
Rotate an Array
Move All Zeros to the End
Longest Common Prefix
Merge Two Sorted Lists
Kadane's Algorithm (Maximum Subarray Sum)
Valid Parentheses
First Non-Repeating Character
Intersection of Two Arrays
Matrix Transpose
Matrix Multiplication
Spiral Matrix Traversal
Remove Even Numbers from a List
Find the Most Frequent Element
String Compression
If you're preparing for Calsoft's Development Engineer interview, mastering
these 20 problems plus the bonus set will cover most of the Python coding
questions commonly asked in fresher interviews.