Jump to content
Forumu Destekleyenlere Katılın ×
Paticik Forumları
2000 lerden beri faal olan, çok şukela bir paylaşım platformuyuz. Hoşgeldiniz.

Guzelinden mulakat sorusu


di

Öne çıkan mesajlar

Su asagidaki gibi bi task geldi mulakat niyetine. Isin ilginci ne job spec var ne de skill set. Sadece bu.

Ben istenenin bir nevi report tool oldugunu varsaydim, 1 milyon satiri 2 saniyenin altinda isleyen, totalde 650kb memory kullanan bisey yaptim gonderdim ama begenmediler heralde.

Varsa kendini denemek isteyen buyrun;


The following problem should take approximately 2 hours to complete the full solution. The submitted code should be of the quality we can expect during a normal working week.

Using maven or ant is not a requirement; however you are welcome to do so. Please provide instructions on how to run the application from the command line.

There is no requirement to cater for invalid input. As you will not have the opportunity to clarify requirements, feel free to note any assumptions in your submission.

You are welcome to use any external libraries you want. Include them in your submission. *hint: there are libraries that do file io.

There are no tricks or gotchas: only implement the functionality described below. It is a simple problem to solve, but code quality is as important as solving the problem itself.

Problem: Calculator
Write some code to calculate a result from a set of instructions. Instructions comprise of a keyword and a number that are separated by a space per line. Instructions are loaded from file and results are output to the screen. Any number of Instructions can be specified. Instructions can be any binary operators of your choice (e.g., add, divide, subtract, multiply etc). The instructions will ignore mathematical precedence. The last instruction should be “apply” and a number (e.g., “apply 3”). The calculator is then initialised with that number and the previous instructions are applied to that number.

Examples of the calculator lifecycle might be:

Example 1.

[Input from file]
add 2

multiply 3

apply 3

[Output to screen]
15
 
[Explanation]
(3 + 2) * 3 = 15
 
Example 2.

[Input from file]
multiply 9

apply 5

[Output to screen]
45
 
[Explanation]
5 * 9 = 45

Example 3.

[Input from file]
apply 1

[Output to screen]
1




Hatta yaparsaniz nasil yaptiniz, varsayimlariniz ne oldu onlari da yazin ki gelissin guzellessin.
Link to comment
Sosyal ağlarda paylaş

Gotumden oyle uydurdum iste. =]

Yani bir isteneni yapmanin bir suru yolu var. Gidip procedural gidebilirsin, oop'nin dibine vurup interface'lerden dalip FileIO, Calculator class'larini yaratip oyle devam edebiirsin. Haliyle senaryo olarak dedim ki report tool olsun bu, dusuk memory consumption ile hizli calismasi gereksin. Ona gore kodladim.

Bir de oop ile nasil yapardim ayni isi onu yaptim basitce. O kadar.
Link to comment
Sosyal ağlarda paylaş

bodoslama bakinca bir txt dosyasini bi sekilde okuyup, output veren program yazin demisler, sinirlamada yok 1milyon satirda olabilir 3 satirda sanirim.

iyide nasi magic bi kod yazabilirsinki (2 saatte demis adamlar bide) adamlar sasirsinlar orasini anlayamadim sdfsdf

di senin kodu araklayip, calistirmis olmasin adamlar :)
Link to comment
Sosyal ağlarda paylaş

LethE said:

böyle bişi anladım ben.
fonksiyon(a):
read next line
split string s1 s2.
if s1=apply
a = s2
return a
endif
else
fonksiyon(a)
switch case add/sub/mult/div
return a;
endfonksiyon


main:
open file
a=0
fonksiyon(a)


Senin kod sadece apply satirini yazdiriyo su halde. =P
Link to comment
Sosyal ağlarda paylaş

×
×
  • Yeni Oluştur...