Programming 0

Qn - 1

Given a string, count the number of times each letter occurs in the string.

Then, reverse the string using a for loop. 


Note: Solve this question in python, without using any built-in functions/libraries.

Topics learned: strings, if-else, for-loop, lists, nested for-loop

Qn - 2

Given a list of integers, sort it in ascending order without using any inbuilt functions. 

Search for a key element (which the user will input) and print the "index" of the element from the list if it is in the list, else print -1.


Note: Solve this question in python.

Topics learned: lists, sorting, searching 

Qn - 3

Print a 5*5 pyramid with "*" using for loops.

Expected output:     

    *

   * *

  * * *

 * * * *

* * * * *


Note: Solve this question in python.

Topics learned: nested for-loop, printing

Qn - 4

Implement a "shift" cipher with shift value 13, implement encrypt() and decrypt() functions to encrypt and decrypt messages with this cipher. (Similar to "Caesar Cipher")

Example:

plaintext = "Hello, this is a plaintext"

encrypted_text = encrypt(plaintext)

print(encrypted_text)

Output:

Uryyb, guvf vf n cynvagrkg


Note: Shift uppercase with uppercase characters only, and lowercase with lowercase characters only 

Note: Solve this question in python.

Topics learned: ascii/text conversion, for-loop, modulus

Qn - 5

Initialise 2 integers with any values you want in your main() function. 

Calculate the product of the two integers without using the multiplication operator (*). Use loops instead.


Note: Solve this question using C.

Topics learned: for-loop, while-loop, I/O

Qn - 6

From your main() function, call 3 different functions to calculate the area, perimeter & volume of a Cone, Sphere and Cuboid.


Note: Solve this question using C.

Topics learned: Operators, I/O, function declaration & definition

Qn - 7

Given a string, count the number of vowels in it. String must be taken as input from the user.


Note: Solve this question using C.

Topics learned: Strings/character arrays, if-else, for-loop 

Qn - 8

Given an array of 10 integers (which you can define by yourself), find the number of occurrences of a given key element (which must be pased as a "Command Line Argument"). 

Also, find the minimum and maximum element present in the array.


Note: Solve this question using C.

Topics learned: Arrays, if-else, for-loop, while-loop, command line arguments