As per this blog post, I hope to provide 20 questions for beginners, and intermediate programmers, that will help in achieving some level of confidence in skills with programming languages and frameworks.
Each question will require a practical solution, and the concepts you're expected to have mastered by the time you accept it, will be given in detail.
This is not an list of algorithm exercises.
See answers.
Find the questions below:
Request the user's first name, last name and age. Print out Welcome, <First-Name> <Last-Name> (<Age>)
in a new line. See Variants.
Ask the user to press any key.
Display any 3 random space-separated digits between 0-9 e.g. 6 2 7
.
If any of them is 7
, output "Congratulations!"
.
Else, output "Try again! Better luck next time."
.
Repeat. See Variants.
Ask the user to enter a word.
Print out the word in reverse.
Repeat. See Variants.
Output a random word. Ask the user to type in the reverse.
-
If the user is correct, output ✅
-
Else, output ❌
Repeat. See Variants.
Output:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
Enter an option:
-
If the user enters
1
, ask the user to"Enter a celsius value:"
. -
Else, ask the user to
"Enter a Fahrenheit value:"
.
Convert the entered value to celsius or fahrenheit accordingly. See More.
Using a for/while loop, write a program that prints out a simple multiplication from 2 - 12. E.g.
2 3 4 5 6 7 8 9 10 11 12
4 6 8 10 12 14 16 18 20 22 24
6 9 12 15 18 21 24 27 30 33 36
...
24 36 48 60 72 84 96 108 120 132 144
Write a program to read a txt file, line by line, and output each line to the screen. See Variants
Write a program to read two txt files, line by line, concatenate each line pair for both files, and output the concatenated result to the screen. See more
Write a program that will output a random RGB color e.g. rgb(252, 160, 72)
.
Write a program that will output a random RGB color e.g. #fca048
.
Write a program to read a list of file paths, and output the extension for each.
Ask the user to enter a salary amount.
-
If the salary is < 50,000, output
"Basic Earner"
. -
Else, if the salary is less than 200,000, output
"Mid Earner"
. -
Else, output
"High Earner"
.
Ask the user to enter a salary amount.
-
If the salary is < 50,000, output
Tax: 5 / 100 * salary
. -
Else, if the salary is less than 200,000, output
Tax: 10 / 100 * salary
. -
Else, output
Tax: 15 / 100 * salary
.
Ask the user to enter a number.
Print out the entered number in words.
E.g. 30,456 becomes "Thirty thousand, four hundred and fifty six"
.
Request the Principal.
Request the Rate.
Request the Time in Years.
Calculate and output the simple interest. (P * R * T / 100
).
For each year, calculate and output the compound interest.
Write a program to convert from base n to decimal (base 10).
Request the value of n.
Request the number value (integer).
Convert to base 10, and output the result.
Write a program to convert from decimal (base 10) to base n.
Request the value of n.
Request the decimal value.
Convert to base n, and output the result.
Write a program to read a CSV file of student IDs, names, and scores, and for each student, output their name, ID, average score and CGPA in the following format:
<name> (<id>): <average-score> <cgpa>
Read student names, line by line, from a file.
For each name, ask if the student is in class.
E.g. Is Bisi in class? [yes/no]
Let the user input either yes
or no
.
Write a love calculator program that calculates a love percentage, using two names. See More.
looking to contribute? checkout the contributing guide