Preliminary note
This simple self-test has been made in 2001 and contains 7 questions, which are collected to give prospective coumpter science students a feeling for the topics they will deal with during their studies. The questions were formulated in such a way that no skills which have to be learned during the studies are required. It rather depicts basic skills you should have as a computer scientist to complete your studies successfully.
You should take approximately one hour to solve these tasks. If your answers differ very much from the suggested solutions or you have difficulties to find an answer on a question, we recommend you to take a detailed study consultation and maybe reconsider your choice of study. Maybe the self-assessment-test [de] provided on the website of the Faculty of Computer Science can also help you.
Please also be aware that most basic study programmes (Bachelor's programmes) are mainly in German, so please also consider taking the german version of this test. Please be aware too that this test is translated from German to English, so there might be some mistakes in the translation.
Tasks
There are three types of components given.
- "both":
- if there's current at exactly both inputs, the output produces current.
- "one is enough":
- as soon as there's current at one input, the output produces current.
- "reversal":
- if there's current at the input, the output doesn't produce current; if there's no current at the input, the output produces current.
1a) Is the light bulb illuminated in the following circuit?
1b) Which components are needed in the following circuit to ensure the light bulb is illuminated only under the following conditions:
- switch C (as emergency switch) must always be set to Off and
- either switch A and switch B are set to On at the same time
- and/or switches D and E are set to On at the same time.
This task is intended to test logical thinking and the ability to comprehend parallel problems.
It is recommended to mark in the graphic where current is present and where it is not. To do this, you can either use color or place a marker on the corresponding lines (1=current, 2=no current).
Then you look at each of the components from the first inputs (left) to the last output (right) and determine the output assignment based on the values applied to the inputs.
In the following graphic a line with current is marked red, lines without current are black. As a result, the lamp lights up.
Since switch A and switch B must both be switched on at the same time, this is combined into one piece of information with the aid of a both-component, which indicates whether both switches are active.
The same applies to the combination of the current of switches D and E.
The current may now only continue to flow if switch C does not allow current to pass. There is now no component which only produces current when there is current at one input and not at the other. Therefore a trick must be used and the current flow from switch C must be reversed before it is combined with the currents produced by the first two components.
Two new intermediate currents are generated from the reversed C and the two intermediate signals if intermediate signal and the reversed C carry current.
Finally, if one of the last two intermediate signals is active, it is sufficient to make the lamp light up.
There is a group of people. Some know each other well and tell each other every secret, others do not like each other and do not talk to each other. The following persons are known: Guido, Gudula, Wolf, Petr, Peter, Werner, Winfried, Dieter, Wolfgang, Uwe, Hanno, Andreas.
Is it possible that a secret which Guido knows can be told to Hanno, when the following relationships apply?
- Guido only talks with Petr and Gudula
- Gudula only talks with Wolf and Guido
- Wolf only talks to Peter and Gudula
- Petr only talks with Guido, Wolfgang and Peter
- Peter only talks with Wolf, Petr, Wolfgang, Werner, Winfried and Dieter
- Werner only talks with Peter and Winfried
- Winfried only talks with Peter and Werner
- Dieter only talks with Wolfgang, Hanno and Peter
- Wolfgang only talks with Petr, Peter, Uwe and Dieter
- Uwe only talks with Wolfgang and Andreas
- Hanno only talks with Andreas and Dieter
- Andreas only talks with Hanno and Uwe
Also, which is the shortest way (way including the fewest persons) from Werner to Andreas?
This question is intended to test how well one can abstract concrete problems and model the structure hidden behind them.
The persons mentioned here form a network in which the information is disseminated. In computer science, such a structure is called a graph.
The persons represent communication points (nodes) that are either connected or not. The information can only move along a connection (edge).
With this knowledge a picture can be drawn.
In this graphic you can now walk along these edges and mark the path. A possible solution of the first subtask is marked blue. There are more solutions, which are not given here.
The solution of the second subtask - marked in red - can be found intuitively by looking for a path first and then improving it step by step until no better one can be found. This procedure probably does not always lead to the best solution. Which more suitable method can be used will be learned in the course of study. Again, there is a second solution, which you can easily see from the picture.
For a roof truss, wooden beams must be sawn to size. Beams of 10 m length are supplied. The following cuttings are required:
- 1 x 5 metres
- 2 x 2 metres
- 3 x 6 metres
- 4 x 3 metres
- 6 x 1 metre
3a) How many beams of 10 m need to be bought?
3b) Where are the cuts placed?
This task represents an optimization problem for which a solution must be found so that as little wood as possible must be purchased.
An optimal solution for this rather basic problem consists of a process which is very complex. Therefore only an approximation method is presented here, which still gives good results, but does not always produce the best possible result. (But in this example it does).
One should start with the cutting of the larger pieces, so that the smaller pieces can be produced from the remaining pieces.
First sort the cutting orders by size, starting with the largest.
- 3 x 6 metres
- 1 x 5 metres
- 4 x 3 metres
- 2 x 2 metres
- 6 x 1 metre
In the first step, we take a new beam and cut out the largest section to be produced. The rest is laid aside and saved for later.
From now on, we check whether at least one of the remaining pieces is long enough to cut the current section. If there are such remainders, we take the smallest one. Otherwise a new beam is sawn.
This results in the following solution, whereby the order of the sections to be cut is given:
While surfing the internet, you notice that the web pages are not displayed fast enough. You are currently using an Athlon processor with 2.1 GHz, 512 MB RAM and a 56k modem on an analogue telephone connection. How could you achieve that the web pages are displayed faster?
- build in a faster Pentium IV CPU
- build in more RAM
- use a internet modem
- change the provider
- disable loading pictures
As a computer scientist, you often have to solve problems that lie in the area of conflict between business and technology. If you trust too much in keywords or even blindly believe the promises of advertising, you quickly waste a lot of money. At the beginning there should be a thorough consideration why the web pages are not displayed fast enough:
Normal web pages require relatively little effort to calculate their display, whereas extremely complex pages can put a lot of load on the CPU. However, the specified processor is powerful enough to prepare more complex pages - so installing a faster CPU will probably not bring any speed gains.
Something similar applies to the size of the main memory: With 512 MB it is large enough for viewing most websites. Only if other programs that require a lot of memory are executed in addition to the web browser, an expansion can bring speed advantages.
If the computer is fast enough, a too slow "delivery" of the data could slow down the display of the web pages. However, the answer option "install an internet modem" is not a particularly "expert" answer, since the term "internet modem" does not say anything about the actual speed used. The first thing to clarify is what kind of device it is and what it can really do.
In the same way, it is basically not correct to think that another provider would be faster. If the provider delivers the data faster than the modem can transfer it to the computer, a provider change would achieve nothing. Neither can the provider be held responsible if the computer from which the data is to be fetched is not fast enough.
A good advice is to switch off the display of the pictures. You won't see the whole website anymore, but you will have to transfer and display much less data (pictures need much more transfer time than simple text). ;-)
In a house there are three light bulbs hanging in the attic (although it can be assumed that they are working and switched off). The corresponding switches are in the basement due to a design flaw. Unfortunately it is also not known which switch belongs to which light bulb. The house owner - a very lazy computer scientist ;-) - wants to find out with as little effort as possible which switch operates which light bulb.
He is in the basement and wants to climb the long stairs up to the attic only once. How can he still find out the correlation between the switches and light bulbs? No other person helps him, no technical aids are allowed, the cellar has no windows and must not be entered again after leaving.
This task is intended to test how well you are able to fully grasp a situation. Especially with this task it is nice to see that you often overlook important attributes when modeling the world.
It is quite obvious that a light bulb produces light as long as electricity flows through it. But this means that a light bulb can only be assigned to one switch. So there is no possibility to assign the last two switches.
On closer consideration, it is noticeable that a lamp has another attribute that depends on the current flow: the temperature. Light bulbs, through which current flows, become hot. Lamps through which current has recently passed are warm.
This results in a quite simple solution:
- switch on the first two switches
- wait for 2 - 3 minutes
- turn off the second switch
- walk as fast as possible to the attic
- cautiously touch both dark light bulbs and check them for warmth
Thus the following correlation results:
- the burning lamp is switched by switch 1
- the dark but warm lamp is switched by switch 2
- the dark but cold lamp is switched by switch 3
The function of the Fibonacci numbers is defined as following:
Determine the value of f(7).
This question aims at the understanding of recursive representation of mathematical sequences.
The value can be calculated in two ways. One version strictly follows the rules and processes the corresponding recursive calls, the second version builds a table with intermediate values to reduce the calculation effort.
Version 1
The calculation of f(7) is performed as f(6) + f(5) acoording to the rule.
f(6) is f(5) + f(4)
f(5) is f(4) + f(3)
This results in f(7) = ( f(5) + f(4) ) + ( f(4) + f(3) )
⇒ f(7) = [ ( f(4) + f(3) ) + ( f(3) + f(2) ) ] + [ ( f(3) + f(2) ) + ( f(2) + f(1) ) ]
⇒ f(7) = { [ ( f(3) + f(2) ) + ( f(2) + f(1) ) ] + [ ( f(2) + f(1) ) + 1 ] + { [ ( f(2) + f(1) ) + 1 ] + 1 + f(1) } }
⇒ f(7) = ( { [ ( f(2) + f(1) ) + 1 + ( 1 + 1 ) ] + ( 1 + 1 ) + 1 } + { [ ( 1 + 1 ) + 1 ] + 1 + f(1) } )
⇒ f(7) = ( { [ ( 1 + 1 ) + 1 + ( 1 + 1 ) ] + ( 1 + 1 ) + 1 } + { [ ( 1 + 1 ) + 1 ] + 1 + f(1) } )
⇒ f(7) = 13
Version 2
1 | 1 |
2 | 1 |
3 | 2 * |
4 | 3 |
5 | 5 |
6 | 8 |
7 | 13 |
*) From here on we have the sum of the two previous rows.
A programming system consists of the following commands:
OUTPUT x | prints x onto the screen | |
IF x DO y | in case that x contains a true statement, y is executed | |
Go TO x | continues the execution at line x | |
(x and y can be either simple variables, statements or other commands) |
A program consists of numbered lines. These lines contain the above mentioned commands or mathematical expressions of the form variable := expression. A mathematical expression can be, for example: a simple number, a mathematical operation (1+2, 3*x, ...) or a comparison (1<2, 2=x, ...).
How can you realize a program which outputs "Hello Uni" 5 times in a row without simply writing the command OUTPUT "Hello Uni" 5 times.
Writing programs is only one of many skills that a computer scientist must know. In most cases, no industrial programming languages are used, but academic languages that were invented to represent a certain subject.
Before you can write a program, you have to know how you want to solve the problem. This solution is called an algorithm. Once you have determined which language to use, you know which commands you can use for your program.
To output the text 5 times in a row, it is now possible to repeat the output command until you have output enough text. To do this, you use a data memory containing the number of lines already output. Initially, of course, no line is output and the number memory is set to zero.
1 number := 0
Now you can print this text once:
2 OUTPUT "Hello Uni"
Now that you have printed the text once, you have to increase the counter by 1. To do this, take the old counter value, add 1 and save the value again:
3 number := number + 1
Now it may be that you have not yet printed enough lines. If this is the case, you have to go to line 2 again to output the next line from there and increase the number again to be able to compare again afterwards...
4 IF number < 5 DO: GO TO 2
If the number is already greater than or equal to 5, the program does not continue with line 2 and the program is terminated.
The entire program therefore looks like this:
1 number := 0 2 OUTPUT "Hello Uni" 3 number := number + 1 4 IF number < 5 DO: GO TO 2