0% found this document useful (0 votes)
2 views6 pages

Assignments BasicProgramming Extra

The document outlines a series of programming assignments that cover various topics such as finding the sum of digits, checking for prime factors, and determining if strings are palindromes or anagrams. It includes tasks related to arrays, strings, and mathematical computations like Fibonacci numbers and matrix operations. Each assignment provides hints to guide the implementation of the required programs.

Uploaded by

resume.ansh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Assignments BasicProgramming Extra

The document outlines a series of programming assignments that cover various topics such as finding the sum of digits, checking for prime factors, and determining if strings are palindromes or anagrams. It includes tasks related to arrays, strings, and mathematical computations like Fibonacci numbers and matrix operations. Each assignment provides hints to guide the implementation of the required programs.

Uploaded by

resume.ansh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Sr. No.

Assignment Questions
1 Write a program to find sum of digits of a number. Hint - n=245 then sum is 2+4+5

2 Write a program to check whether a given number is power of 2 or not. Hint - 12 is


not power of 2 where 16 is power of 2 i.e. 24 = 16

3 Write a program to find prime factors of an integer. Hint - 2, 3, 4, 6 can divide 12


but only 2 and 3 are prime.
4
Write a program to check if a string is palindrome or not.
Write a program to check if two String are Anagram. E.g. army and mary. Hint: Two
5 strings are called anagram, if they contain same characters but on different order.

Write a program to find all pairs in array of integers whose sum is equal to given
6 number. E.g. if input integer array is {2, 6, 3, 4, 5, 9, 11} and given sum is 9; output
should be: 6, 3 & 4, 5.

7 Write a program to check if a given number is binary or not. Hint - the number
should contain only digit 0 or 1 ex. 011010 is binary number

8 Write a program to find all prime numbers upto the given number. Hint - if n = 25
then find prime numbers between 1 and 25
9
Write a program to find duplicate character(s) in a string.
10
Write a program to find all the non-duplicate character(s) in a string.

11 Write a program to find all permutations of a string. - Hint - if str = “abc” then its
permutations are “abc”, “acb”, “bac”, “bca”, “cab”, “cba”

12 Write a program to replace all whitespaces in a string with ‘%20'. Hint - if str =
“today is monday” then new string is “today%20is%20monday”
13
Write a program to print factorial of a number.
Write a program to check for balanced parantheses in an expression. Given a string
containing brackets '(', ')', '{', '}', '[', ']'; the brackets must close in correct order. Hint
14 - “3+4*(7+{22}*98-3/(45+3))” is balanced while “3+4*(7+{22)*98-3/(45+3})” is not
balanced.

Write a program to toggle character casing i.e. convert upper case characters to
15 lower case & lower case characters to upper case. Hint - if str = “India is Great” in
new string should be “iNDIA IS gREAT”

16 Write a program to find the largest number that can be formed by changing digits at
atmost p places in the number n . — Hint - if n= 45395 and p = 2 then by replacing
2 digits from start with 9 we get new biggest possible number 99395
17 Write a program to find number of times a text can be printed using the provided
string. - Hint -

1
Write a program to compute Nth Fibonacci number. E.g. if entered number is 5;
output should be 3. Hint: Fibonacci series is series of natural number where next
18 number is equivalent to the sum of previous two number.
Note: Assume seed values fib(0) = 0 & fib(1) = 1. Hint f(7) = 0,1,1,2,3,5,8,13

19 Write a program to print Binary Equivalent of an Integer

Write a program to return highest number of times a character has occurred in a


20
string. - Hint if str = “goodmorning everyone” then “o” is the answer as it is
repeated highest number of times
21
Write a program to count number of Vowels & Consonants in a sentence.

22 Write a program to find two Elements in an array or list such that their Sum is
Closest to Zero. Hint - [3, 7,1,6 , 23, 55, 11] and is 3,1 because their sum is smallest

23 Write a program to find Largest & Smallest Word in a String. Hint - if str = “We live
in one of the greatest country in the world” then “in” is the smallest word and
“greatest” is largest word

24 Write a program to find Median of Elements after Merging 2 Arrays or list - Hint
create third array by merging two arrays then apply process to find median
25
Write a program to calculate Addition or Subtraction of 2 Matrices.

2
Status Effort (Hrs) Start Date End Date

3
4
Not Yet Started

In Progress

Sent for Review

Review Inputs Received

Rework In Progress

Sent for Review Post Rework

Completed

5
6

You might also like