0% found this document useful (0 votes)
5 views3 pages

CSE Interview Programs

The document contains a series of Python programs designed for B.Tech interviews, covering topics such as determining even or odd numbers, checking for prime numbers, and identifying palindrome numbers. It also includes programs for calculating factorials, generating Fibonacci series, reversing strings, finding the largest element in an array, implementing bubble sort, performing linear search, and checking for Armstrong numbers. Each program is presented with its corresponding code snippet and a brief description of its functionality.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

CSE Interview Programs

The document contains a series of Python programs designed for B.Tech interviews, covering topics such as determining even or odd numbers, checking for prime numbers, and identifying palindrome numbers. It also includes programs for calculating factorials, generating Fibonacci series, reversing strings, finding the largest element in an array, implementing bubble sort, performing linear search, and checking for Armstrong numbers. Each program is presented with its corresponding code snippet and a brief description of its functionality.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CSE B.

Tech Interview Programs with


Answers
1. Even or Odd Number
Program (Python):
num = int(input("Enter number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")

2. Prime Number
Program:
num = int(input("Enter number: "))
if num > 1:
for i in range(2, num):
if num % i == 0:
print("Not Prime")
break
else:
print("Prime")
else:
print("Not Prime")

3. Palindrome Number
Program:
num = input("Enter number: ")
if num == num[::-1]:
print("Palindrome")
else:
print("Not Palindrome")

4. Factorial
Program:
num = int(input("Enter number: "))
fact = 1
for i in range(1, num+1):
fact *= i
print(fact)

5. Fibonacci Series
Program:
n = int(input("Enter n: "))
a, b = 0, 1
for i in range(n):
print(a, end=" ")
a, b = b, a + b

6. Reverse a String
Program:
s = input("Enter string: ")
print(s[::-1])

7. Largest Element in Array


Program:
arr = list(map(int, input().split()))
print(max(arr))

8. Bubble Sort
Program:
arr = [5, 3, 8, 4]
for i in range(len(arr)):
for j in range(0, len(arr)-i-1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
print(arr)

9. Linear Search
Program:
arr = [1,2,3,4,5]
key = int(input("Enter key: "))
if key in arr:
print("Found")
else:
print("Not Found")
10. Armstrong Number
Program:
num = int(input("Enter number: "))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
if num == sum:
print("Armstrong")
else:
print("Not Armstrong")

You might also like