In the current chapter we will review a practical exam in Programming Basics conducted at SoftUni on December 18, 2016. The problems will give you a good overview of what we can expect on an admission exam in Programming at SoftUni. The exam covers the material studied in the current book and the Programming Basics course at SoftUni.
Traditionally, the admission exam at SoftUni consists of 6 practical problems in programming:
- Simple problems (no conditions).
- A problem with a single condition.
- A problem with more complex conditions.
- A problem with a single loop.
- A problem with nested loops (drawing a figure in the console).
- A problem with nested loops and more complex logic.
Let's examine a real exam topic, the problems it contains and their solutions.
We use the following function to read the data from the console:
By definition, the input data is introduced as four separate rows. This is why we need to execute the previous code four times in total.
This way we solved successfully the first sub-problem.
The next steps is to convert the input data into appropriate types, in order to be able to perform the needed calculations. We select
int as an appropriate type, because the condition of the problem says that the input data must be within a particular range, for which this data type is completely sufficient. We will do the conversion in the following way: