You are on page 1of 8

 

 
 
Basic Programs for Practice 
 
Practicing Loops 
 
1. Write a program to find the sum of series 1+2+3..+N. 
2. Write a program to print A,B,C,D,E..Z,A,B,C 
3. Write a program to print A,1,B,2,C,3....N 
4. Write a Program to find the sum of series 1^2+2^2+3^2...+N^2. 
5. Write a Program to find the sum of series 1^1+2^2+3^3...+N^N 
6. Write a Program to find the sum of series 1+X+X^2/2!+X^3/3!...+X^N/N! 
7. Write a program to find the sum of series (1+(1+2)+(1+2+3)+...till N) 
8. Write a program to find the sum of series 1/2-2/3+3/4-4/5+5/6...+N/N+1 
9. Write a Program to the find sum of series 5^2+10^2+15^3+.....N^2 
10. Write a program to find the sum of series 1+(1+3)+(1+3+5)+....+n 
11. Write a Program to Find the sum of series 1+11+111+1111.....+N. 
12. Write a Program to Find the sum of series  1/2+2/3+3/4+4/5.....+(N-1)/N. 
13. Write a Program to Find the sum of series 1³+2³+3³+4³.....+N³. 
 
 
 
 
 
 
 

 
 

 
Practicing Nested Loops 
 
 
1  1  A 
1 2  2   3  B B 
1 2 3   4   5   6  C C C 
1 2 3 4   7   8   9 10  D D D D 
1 2 3 4 5  11 12 13 14   E E E E E 
*  1  A 
* *  2 2  B C 
* * *  3 3 3  D E F 
* * * *  4 4 4 4  G H I J K 
* * * * *  5 5 5 5 5   
 
* * * * *           *  * * * * * * * * * 
* * * *        * * *    * * * * * * * 
* * *       * * * * *      * * * * * 
* *    * * * * * * *        * * * 
*  * * * * * * * * *          * 
           1  Z Z Z Z   
         1   1        Z   
       1   2   1     Z  * * * * * 
     1   3   3    1  Z Z Z Z  * * * * * 
   1  4    6   4   1    * * * * * 

 
 

 1  5   10   10  5   1  O O O O   * * * * * 


  O        O   
  O        O  1 1 1 1 
M           M  O O O O  2 2 2 2 
M M   MM    3 3 3 3  
M     M   M  H        H  4 4 4 4 
M            M  H H H H   
  H HH H  1   2    3   4 
E E E E   H        H  8   7    6   5 
E    9 10  11  12 
E E E E  O O O O   16 15 14 13 
E  O        O 
E E E E  O        O 
      O O O O 
                
 
Print Zoho when N=4 

 
 

 
 
Practicing Array: 
 
1. Sum, Average of Numbers in Array (First do it without Array) 
2. Insert a number , delete a number in specific index in an Array 
3. Insert a number , delete a number in Sorted Array 
4. Remove duplicate numbers  
5. Combine two sorted arrays 
6. Shuffle a sorted array 

 
 

7. Find all combination of four elements of a given array whose sum is equal to a given value. 
8. Rotate Arrays by few positions left and right 
9. Add two 150 length Integer numbers using array 
10. Separate even and odd numbers of a given array of integers. Put all even numbers first, and then odd numbers 
11. Find maximum product of two integers in a given array of integers. 
12. Search a number from Sorted and UnSorted array 
 
Practicing 2D Array and 3D Array: 
 
1. Implement Matrix Addition,Multiplication and Transpose 
2. Print Sum of both diagonal element in matrix 
3. Print elements present in postition of any pattern in that matrix 
4. Print sum of 
a) Upper Diagnol , Lower diagnol of Matrix 
                        b) Q1 , Q2 ,Q3, Q4 partitions of marix  
      5. Check if two matrix can be made equal by changing rows and columns 
      6.Visualize 3D matrix. Enter Names of Students in Each matrix cell 
7. Print Martrix in Spiral order 
 
Practicing Character Array or Strings 
 
1. Program all inbuilt string functions such a 
length,substring,toLower,isUpper,reverse,split,contains,containsIgnoreCase,StartsWith,EndsWith etc 
2. Sort All Characters in given Strings 
3. Count No of Palindromes in String 
4. Print all combination of characters in the given word 

 
 

5. Expand given string example: a4b723 -> aaaabbbbbbb333 and do vice versa 
6. Replace High frequency Vowel by * , Eg: ILOVEZOHO -> IL*VEZ*H* 
7. Print words that start and end with Vowel in Given line 
8. Roman Letter to Number (DCLXVI , Its integer value is : 500 + 100 + 50 + 10 +5 + 1= 666) and vice versa 
9. Convert number to word of 4 digit numbers 
10. Check and convert given string to any Palindrome string (iiccv -> civic ;  carrace-> racecar)  
 
Sorting 
 
1. Sort given Integers in Insertion,Selection,Merge,Bubble ,Quick sorts 
2. Given a alphanumeric string. Sort the positions of Numbers alone 
3. Sort Given set of names in ascending order 
4. Find a sub array whos sum matches given number N 
 
Practicing using Methods / Functions 
 
1. Understand function its different parameters and return type 
2. Pass a Integer,Char,Float,String,Pointer,Struct to funtion and return it 
3. Program to compute Sum of integers in array using Recursive function 
 
User Defined Datatype 
 
1. Given Name,Roll no and Marks(M 1-6) of 6 Subjects for 10 students .  
1. Do above problem without using any user defined datatype 
2. Sort students based on Roll No 
3. For above , Search and print student names for given roll number 

 
 

4. For Students Sort students by marks of total subject 
5. For Students in same marks sort by marks obtained by M1 subject 
6. For Students in same M1 marks roll number 
     2.  Perform Insertion,Deletion of record based on Employee(EmpID,Name,Dept)  also auto generate EmpID 
3. Create a datatype 'College' to store Name of College,College RegID and Address. Store Address as Seperate datatype 
[Nested Structure] 
4. Create a Datatype train compartment where Each compartment contains CoachName,No of Passengers,No of Freeseats 
etc and a link to next Compartment [Self referential structure] 
 
 
Introduction to Files 
 
1. Print no of words, no of lines,length of words in a text file 
2. Do the program under "User Defined Datatype" using Files 
3. Copy alternative lines and alternative words into a new text file 
4. Delete a Student object from a File 
5. Print all filenames in a folder, delete a file 
6. Remove given word from a text file 
 
Understanding Algorithms 
 
For All above  students are expected to analyse their code based on Asymptotic Analysis, Worst, Average and Best 
Cases,Analysis of Loops, Solving Recurrences and ‘Space Complexity’  etc 
 
 
Practicing Data Structures 

 
 

 
1. Understanding Stack,Queues, Circular Queues and Tree.  
a. a) Perfrom Inserting and Deletion in above structure 
b. b) Implement in Arrays,Single Linked list and Double linked list 
2. Reverse a Single Linked List 
3. Merge two already sorted linked list 
4. Perform Preorder, Inorder and Postorder traversal using Array and Linkedlist 
5. Calculate height and width of a tree 
6. Implement queue using stack 
7. Understanding about Heap and perform Inserting and Deletion 
 
 
Introduction to OOPS 
 
1. Understand Object and Function 
2. Understand the need of Polymorphism,Abstraction,Inheritance and Encapsulation 
3. Identify attribute and function of Bike,Tree,Bird,Dog,Pen,Laptop,Teacher,Board,Ant,Electicity,Rain,Boat etc 
4. Understand Coupling Cohesion Association Aggregation Composition relationship between object 
5. For all programs written so far, pick any 5 big programs and identify how they can be written better using Classes and Objects 
 
Part B : Advanced Problems - Overview 
 
Introduction to WebServers, Client and Server, Network,HTTP Calls,GET,PUT,POST,Session,Cookies,HTML and CSS, Database 
Simple Select,Insert,Delete and Update queries, Database Keys 

You might also like