Programming Assignment for Beginner ( Programming + Theoretical Problems)

Instructions for the Assignment:

  1. Don’t copy the code from anywhere.
  2. Try to solve one problem in multiple ways.
  3. Don’t try to solve the problem just for the sake of completion but try to understand the logic behind the solution.
  4. Create the GitHub account and share the code in one of the Git Repository.
  5. You can use any language of your choice to solve the problems.

If you solve all the problems by following the above steps, you are good to go to the next level.

Programming Problems:

  1. Write a program to add and subtract the two numbers and print the output.
  2. Write a program that will take a number as input and based on the value of that number either it will print the addition or subtraction of these two numbers (Ex. if the initially entered number is 0 then perform addition else perform subtraction and print the output).
  3. Write a program to calculate the simple interest given the amount, interest rate, and time.
  4. Write a program to check whether a number is even or odd.
  5. Write a program to find out the maximum and minimum of three numbers.
  6. Write a program to check if a character is a vowel or consonant.
  7. Write a program that will perform the basic operations of a calculator(+, -, *, /) (User will provide the input to perform a particular action).
  8. Write a program to print the count from 1 to n (n can be any integer number).
  9. Write a program to print the table of any given integer number x.
  10. Write a program to calculate the binary representation of an integer and float.
  11. Write a program to calculate the integer value representation of an
  12. Write a program to print the patterns given in the below google doc: Different Pattern Problems for Beginner
  13. Write a program to find the LCM and HCF of two integer numbers.
  14. Write a program to check if a character is there in a string or not.
  15. Write a program to count the occurrence of every character in a string.
  16. Extract vowel and consonant in a separate string and print both.
  17. Write a program to check if a given number is prime or not.
  18. Write a program to print the elements of an array.
  19. Write a program to find out the sum of an array.
  20. Write a program to check if a string is a palindrome or not.
  21. Write a program to convert the string from lower case to upper case and vice versa (Suggestion: use the concept of ASCII values).
  22. Check if the given string is a permutation of another given string.
  23. Print the word and its position of the second most repeated word in a sequence.
  24. Write a program to check if a number is a power of 2 without using a loop (Hint: use the concept of bit).
  25. Write a program to check if a number is divisible by 2 (Suggestion: don’t use loop but try to solve using bit).
  26. Search an element in an unsorted array.
  27. Write a program to sort the elements of an integer array.
  28. Write a program to sort an array of 0’s, 1’s, and 2’s only.
  29. Search an element in a sorted array and return (Use Binary Search for searching).
  30. Write a program to find out the Union and Intersection of two arrays (array might be sorted or unsorted).
  31. Write a program to find out the two elements a and b in an array such that a+b = k.
  32. Write a program to sort the elements of an array using merge sort and quick sort (Don’t use the library implementation).
  33. Create a 2-d metric of integer elements and print its elements (row-wise and column-wise).
  34. Add two 2-d metrics and print the sum.
  35. Multiply two 2-d metrics and print the multiplication.
  36. Search an element in a 2-d metric, and print the position of the element.
  37. Rotate the 2-d metric by 90 degrees or find out the transpose of a metric.
  38. Access the elements of a 1-d and 2-d array using the reference of the first element of the array(For a better understanding, use C/C++).
  39. How do malloc, realloc, and calloc works, write a program to dynamically allocate the memory (For better understanding, use C/C++).
  40. Use malloc to declare a 1-d array of size n and reverse the elements of this array.
  41. Create a structure to store the student details in an array and print the details of all the students.
  42. Write a program to create a file. Once you create the file, write something to this file, and print whatever you have written to the file.
  43. Find the sum of all the integer elements written in a file (integers are separated by “,”, there might be multiple lines in the file).

Theoretical problems:

  1. What is an operating system?
  2. What is the difference between low-level language and high-level language?
  3. Why do we need to learn c/c++ in 2021?
  4. What is a compiler?
  5. What are the header files in any language, why do we need them?
  6. What is a switch statement?
  7. What is the size of int, char, float, etc?
  8. What are the if-else statements?
  9. What is the difference between for, while, and do-while loop?
  10. How does operator precedence work in any language?
  11. What is a string?
  12. What is the difference between mutable and immutable strings?
  13. What is an array? Why do we need an array?
  14. What is a pointer?
  15. How can we access the elements of an array using a pointer?
  16. What is the difference between pointer and reference?
  17. What is the difference between call by value and call by reference?
  18. What are malloc, alloc, and realloc?
  19. What is free and how does it work?
  20. What is the meaning of dynamic memory allocation?
  21. Why do we need to free the dynamically allocated memory?
  22. What is structure and why do we need structure?
  23. How can we access the elements of a structure?
  24. How does file handling work in c/c++?
  25. Can you provide some examples of unsafe operations on a file?

How to Learn Python Without Joining any Online or Offline Course in 4-5 Days?

These days everyone is trying to enter into the machine learning or data science field. Python programming language is one of the most crucial parts of this journey. In this post, we will discuss how one can learn python for data science or machine learning.

The Best Way to Learn Python - 10 Resources To Get Started Learning

If you talk to some educator who is comfortable with python, he will suggest you some books or youtube video lectures. But In my opinion, if you are comfortable in one programming language, you need not buy any book or watch some video lectures to learn python. I will highly suggest you follow this post rigorously, and you will be comfortable with python in just 4-5 days. So let’s start our python journey.

First, you have to install python in your system. You can use any python editor of your choice. I will suggest you use juypter notebook. You can install it by watching this youtube video: Install Juypter Notebook

Now you have to solve the following problems. These problems will cover almost all the topics that are required for your data science journey.

  • Write a program to find the sum of two numbers using python.

Hint: https://www.geeksforgeeks.org/taking-input-in-python/

Learning: Take input from the keyboard, print the output on the screen.

  • Make a calculator using a simple if-else statement. It should perform sum, subtract, multiplication, and division operations.
  • Given an integer, print whether the number is odd or even.

Hint: https://www.geeksforgeeks.org/python-if-else/

Learning: Use of multiple if-else statements, taking input from the keyboard, printing output on the console.

  • Write a program (using for as well as while loop) that will take some integer as input and will print the table of that number.
  • Write a program to check if the given number is prime or not. U)

Hint: https://www.geeksforgeeks.org/loops-in-python/

Learning: In the above two problems, you will learn the use of for and while loop in python.

  • Write a program to count the number of characters in a string. 
  • Write a program to count vowel and consonant in a string.

Hint: https://www.geeksforgeeks.org/python-strings/

Learning: You will learn how you can take the string as input and access every character of that string.

  • Write a program that will take a list of integers as input and calculate the sum of all the elements.
  • Write a program to search an element in the list.
  • Write a program to count how many times a particular element has occurred in the list.
  • Write a program to remove all the duplicate elements from the list.

Hint: https://www.geeksforgeeks.org/python-list/

Learning: In the above problems, You will learn how to take a list as an input and access the elements of that list.

You May Like: Everything you need to know about machine learning syllabus to become a data scientist

  • Write a program to count the number of occurrences of each word in a sentence (use dictionary to solve the problem).
  • Write a program to calculate the occurrence of each integer in a list.

Hint: https://www.geeksforgeeks.org/python-dictionary/

Learning: In the above two problems, you will learn the use of a dictionary in python.

  • Read the data from a text file containing comma-separated integers, and save the sum of all the integers in a text file. (you can create the files yourself)
  • Extract all the even integers from the file, and store them in a new text file.
  • Similarly, extract all the odd integers from the file, and store them in a new text file.

Hint: https://www.geeksforgeeks.org/reading-writing-text-files-python/

Learning: reading a text file, saving the results in a text file.

Once you solve all the problems given above, you are good at starting your machine learning or data science journey. Rest of the advanced topics, you can learn during your data science journey.

I will suggest to create a GitHub repository and keep the solution of all the problems in that repository.  

Share the Link of your GitHub repository in the comment section. I will provide you some advanced level questions once you are done with the above-given problems.

You May Like: How to prepare data structure and algorithms for machine learning or data science interview?