So far, I have interviewed 5 10 companies...
The company for this interview task is a listed company.
The task is in English (translation provided below):
You're given a task of writing a simple program where a user will be able to perform some basic spreadsheet operations (i.e. sum).
In a nutshell, the program should work as follows:
- Create a new spreadsheet
- Add numbers in different cells and perform some calculations on top of a specific row or column
- Quit
You can write a simple program where a user can execute some basic spreadsheet operations (i.e. SUM).
In summary, the program should work as follows:
- Be able to create new spreadsheets
- Add numbers in different cells and perform calculations on specific rows or columns
- Be able to exit
Command | Description |
C w h |
Should create a new spreadsheet of width w and height h (i.e. the spreadsheet can hold w * h amount of cells). 应该创建一个宽度为w、高度为h的新电子表格(即电子表格可以容纳w*h的单元格数量) |
N x1 y1 v1 |
Should insert a number in specified cell (x1,y1). 应在特定单元格中插入数字(x1,y1) |
S x1 y1 x2 y2 x3 y3 |
Should perform sum on top of all cells from x1 y1 to x2 y2 and store the result in x3 y3. 应该在x1 y1到x2 y2的所有单元格上执行求和,并将结果存储在x3 y3中 |
Q |
Should quit the program. 退出程序 |
You can write a console or browser application that will provide the interactive user experience in C# or JavaScript, mentioned in the problem statement.
You can consider your choice of testing framework.
Assume each cell will allocate at most 3 characters, thus numbers given here should be right justified accordingly.
Please provide a readme document or text file, along with the submitted code, detailing the instruction of running the application and tests, design considerations, etc.
The code is required to be hosted in a private repository in Bitbucket. Bitbucket allows users to create free private repositories.
除了代码质量,我们还将检查您如何提交代码(即频率、提交注释的质量、提交的代码的质量单位等)
The following assessment criteria will be considered on the submitted code:
Code quality (whether it is following best practices with regard to design principles, patterns, algorithms).
If the program is validating user data and considering edge cases.
Is the program tested accordingly.
- - - - - - - - -
That is to design a program that can capture user input, create spreadsheets, and handle cell contents. This is not referring to Excel spreadsheets.
Requirements:
- Be able to handle the commands listed above and complete the functionality logic. Also, be able to recognize and handle invalid commands.
- Avoid exceptions and properly handle the program.
- Be able to enforce spreadsheet boundaries.
- Correctly handle user commands, ensuring that when user inputs invalid or out-of-bounds commands, the program does not crash.
- Each cell can have only three characters; if there are fewer than three characters, it should be left-aligned.
The program I implemented is as follows (GIF animation).
Effectively controls and correctly recognizes commands.
Project address:
https://github.com/whuanle/GenerateTable
The README.MD file uploaded by the author is in English, just translate it. The main issue has also been explained here.
The project uses StyleCop.Analyzers code quality review tool to audit code quality.
No matter how you input, the program will not crash due to your erroneous commands.
Designed with a high cohesion, low coupling approach to avoid functional and if/else style programming.
Requirements:
VS 2017
.Net Core (Latest 2.2, compatible with different versions)
文章评论