Вы находитесь на странице: 1из 5

Name and surname:

Number:

Study programme:

1. exam

Skupina A

Programming I

Navodila:
 exam consists of four tasks, which are worth a total of 100 points
 time is 63 minutes 17 seconds
 Literature is not permitted, only one A4 sheet written by hand
 prohibited use of electronic media
 submit answers and original sheet

FAMNIT, Koper, 30.01.2013


1. Task – OOP (30 points)

Janez and Joše have decided to draw up an application for the management of paid invoices.
They agreed that Jože will build a module to store documents, Janez will implement the user
interface.

a) Help them to prepare the appropriate interface! Storage module should have three functions:
String read (int iddokumenta)
int regulations (String text)
delete(int iddokumenta)  (10 points)

b) Implement the interface in a class! (10 points)

c) Define an interface? What it is used for? (5 points)

d) Describe the principle of black box! (5 points)

2
2. Task – Strings and loops

Write a method that counts the number of consonants in the input word. (20 points)

Signature of the method:

int prestej(String beseda)

Example:
Banana --> 3
Hruška --> 4

3
3. Task – Recursive data structures (20 points)

Let's look at a specific triary tree (three branches in each node)! The first subtree contains
elements that are smaller than the current item. Second, medium, subtree contains the elements
of the current element, but less than its square. The third subtree contains all other elements.

a) Write a method to insert a new element into a tree! (20 points)

b) What is recursion? (5 points)

c) List the basic parts of recursive functions! (5 points)

4
4. Task – loops (20 points)
Write a method (void square(int a)), which draws the following figure: square size axa, each row
contains numbers from 1 to a, written consecutively.

Example for a=6:

123456
123456
123456
123456
123456
123456

Вам также может понравиться