Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Programming Questions

Uploaded by

Priya g Kukadi
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programming Questions

Uploaded by

Priya g Kukadi
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Program to compare strings?

Program to search last occurance of a substring inside a string?


Program to remove a particular character from a string?
Program to replace a substring inside a string by another one ?
Program to reverse a String?
Program to search a word inside a string?
Program to split a string into a number of substrings ?
Program to convert a string totally into upper case?
Program to format strings?
Program to concatenate two strings?
Program to count the number of words in a string?
Program to count the total number of occurrences of a given character in a string without using any loop?
Program to count the number of occurrences of each character in a string?
Program to remove all white spaces from a string?
Program to find duplicate characters in a string?

Program to check whether one string is a rotation of another?


Program to check whether two strings are anagram or not?
Program to reverse a given string with preserving the position of spaces?
Program to reverse each word of a given string?
Program do you convert string to integer and integer to string in java?
Program to find the percentage of uppercase letters, lowercase letters, digits and special characters in a given string?
print("Hello {}, your balance is {}.".format("Adam", 230.2346))

int count = s.length() - s.replace("a", "").length();

Hash Map
String s3 = s1 + s1;
MahendraSinghDhoni, DhoniMahendraSingh, SinghDhoniMahendra if(s3.contains(s2))
*
1. Program to function to find the Max of three numbers.
2. Program to function to sum all the numbers in a list.
Sample List : (8, 2, 3, 0, 7)
Expected Output : 20
3. Program to function to multiply all the numbers in a list.
Sample List : (8, 2, 3, -1, 7)
Expected Output : -336
4. Program to program to reverse a string.
Sample String : "1234abcd"
Expected Output : "dcba4321"
5. Program to function to calculate the factorial of a number (a non-negative integer). The function accepts the number as
6. Program to function to check whether a number is in a given range.
7. Program to function that accepts a string and calculate the number of upper case letters and lower case letters.
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12
8. Program to function that takes a list and returns a new list with unique elements of the first list.
Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
9. Program to function that takes a number as a parameter and check the number is prime or not.
Note : A prime number (or a prime) is a natural number greater than 1 and that has no positive divisors other than 1 and itse
10. Program to program to print the even numbers from a given list.
Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Expected Result : [2, 4, 6, 8]
11. Program to function to check whether a number is perfect or not.

According to Wikipedia : In number theory, a perfect number is a positive integer that is equal to the sum of its proper positi
the number itself (also known as its aliquot sum). Equivalently, a perfect number is a number that is half the sum of all of its

Example : The first perfect number is 6, because 1, 2, and 3 are its proper positive divisors, and 1 + 2 + 3 = 6. Equivalently,
divisors: ( 1 + 2 + 3 + 6 ) / 2 = 6. The next perfect number is 28 = 1 + 2 + 4 + 7 + 14. This is followed by the perfect numbers
12. Program to function that checks whether a passed string is palindrome or not.
Note: A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.
Each number is the two numbers above it added together
Click me to see the sample solution
14. Program to function to check whether a string is a pangram or not.
Note : Pangrams are words or sentences containing every letter of the alphabet at least once.
For example : "The quick brown fox jumps over the lazy dog"
Click me to see the sample solution
15. Program to program that accepts a hyphen-separated sequence of words as input and prints the words in a hyphen-se
Sample Items : green-red-yellow-black-white
Expected Result : black-green-red-white-yellow
Click me to see the sample solution
16. Program to function to create and print a list where the values are square of numbers between 1 and 30 (both include
Click me to see the sample solution
17. Program to program to make a chain of function decorators (bold, italic, underline etc.) in Python.
Click me to see the sample solution
18. Program to program to execute a string containing Python code.
Click me to see the sample solution
19. Program to program to access a function inside a function.
Click me to see the sample solution
20. Program to program to detect the number of local variables declared in a function.
Click me to see the sample solution
Program to Check Whether a Number is Even or Odd
Program to Check Whether a Character is Vowel or Consonant
Program to Find the Largest Number Among Three Numbers
Program to Find all Roots of a Quadratic Equation
Program to Check Leap Year
Program to Check Whether a Number is Positive or Negative
Program to Check Whether a Character is an Alphabet or not
Program to Calculate the Sum of Natural Numbers
Program to Find Factorial of a Number
Program to Generate Multiplication Table
Program to Display Fibonacci Sequence
Program to Find GCD of two Numbers
Program to Find LCM of two Numbers
Program to Display Characters from A to Z Using Loop
Program to Count Number of Digits in an Integer
Program to Reverse a Number
Program to Calculate the Power of a Number
Program to Check Whether a Number is Palindrome or Not
Program to Check Whether a Number is Prime or Not
Program to Display Prime Numbers Between Two Intervals
Program to Check Armstrong Number
Program to Display Armstrong Number Between Two Intervals
Program to Display Factors of a Number
Program to Make a Simple Calculator Using switch...case
Program to print below patterns

Floyd's Triangle
Program to Display Prime Numbers Between Intervals Using Function
Program to Check Prime or Armstrong Number Using User-defined Function
Program to Find the Sum of Natural Numbers using Recursion
Program to Find Factorial of a Number Using Recursion
Program to Find G.C.D Using Recursion
Program to Convert Binary Number to Decimal and vice-versa
Program to Convert Octal Number to Decimal and vice-versa
Program to Convert Binary Number to Octal and vice-versa

You might also like