Skip to content

gabriel-guelfi/mdc-test

Repository files navigation

MDC Tests and Exercises

This is a gathering of exercises proposed for the intent of testing my skills in logics and programming languages.

Enunciations:

The Test is composed by 8 exercises. The exercises's enunciations are the following:

  1. Exercise 1: Simple Calculator: Create a calculator that takes two numbers and an operator (+, -, *, /) and returns the result of the operation.

  2. Exercise 2: Prime Numbers: Write a function that checks whether a number is prime or not. Then create a program that prints the first 10 prime numbers.

  3. Exercise 3: Factorial: Write a function to calculate the factorial of a number. Next, create a program that allows the user to enter a number and displays the corresponding factorial.

  4. Exercise 4: Palindrome: Create a function that checks whether a word is a palindrome (that is, whether it reads the same backwards and forwards). The program must ask the user for a word and inform whether or not it is a palindrome.

  5. Exercise 5: Table: Create a program that receives a number from the user and displays the table of that number, from 1 to 10.

  6. Exercise 6: Vowel Counter: Create a function that counts the number of vowels in a string. The program should ask the user for a sentence and display how many vowels it has.

  7. Exercise 7: Grade Average: Create a program that takes a student's grades in three different subjects and calculates the average of the grades. Then display the calculated average.

  8. Exercise 8: Interest Calculation: Create a function that calculates the final value of an investment based on initial capital, interest rate, and investment time (in months). The program must prompt the user for these values and display the final value.

Languages used:

The test is for an opportunity as a PHP developer, but, as I have interest in work with Python, as well, I chose to use Python in half of the exercises. The other half is written in PHP.

Requirements:

  • PHP 7+
  • Python 3

Running the scripts:

To execute the exercises written in PHP, from a CLI, go to the root directory of this gathering and run:

php {nameOfTheExerciseFile}.php

To execute the exercises written in Python, from a CLI, go to the root directory of this gathering and run:

python3 {nameOfTheExerciseFile}.py

Furthermore:

I wrote these scripts using the VSCode IDE, on a Linux Ubuntu 20.04, with PHP 7.4 and Python 3.8 installed on the host.

I didn't use docker nor any kind of encapsulated environment or virtualization.

I haven't tested the scripts in other OS.

About

This is a gathering of exercises proposed for the intent of testing my skills in logics and programming languages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published