Attempt the following question in a maximum of 5 hours
IIT Roorkee
Question 1
Tree with grep support
The program will be given a folder named (optional, if not passed assume cwd). The program will print something like this:
$ tree
.
|-- README.md
|-- closure
| |-- currencySymbols.js
| |-- datetimeSymbolsExt.js
| |-- datetimesymbols.js
| |-- numberSymbols.js
| `-- pluralRules.js
|-- e2e
| |-- i18n-e2e.js
| |-- localeTest_cs.html
| |-- localeTest_de.html
| |-- localeTest_en.html
| |-- localeTest_es.html
| |-- localeTest_sk.html
| |-- localeTest_zh.html
| `-- runner.html
|-- generate.sh
|-- run-tests.sh
|-- spec
| |-- closureI18nExtractorSpec.js
| |-- converterSpec.js
| |-- parserSpec.js
| `-- utilSpec.js
|-- src
| |-- closureI18nExtractor.js
| |-- closureSlurper.js
| |-- converter.js
| |-- parser.js
| `-- util.js
`-- update-closure.sh
4 directories, 26 files
An optional second parameter supports filtering the tree with grep like filter, only matching nodes. Eg:
$ tree . src
.
`-- src
|-- closureI18nExtractor.js
|-- closureSlurper.js
|-- converter.js
|-- parser.js
`-- util.js
It should be possible to use arbitrary regex expression for filtering.
Question 2
Write a Key Server which is capable of accepting three calls: /generate, /validate and /delete.
The /validate and /delete accept a single http parameter "key" each, and return the response in plain-text.
Once generated a key is valid for only 60 seconds.
Output:
/generate call:
{NEW_KEY}
/validate call:
Response for valid key:
{KEY}:VALID
Response for invalid key:
{KEY}:INVALID
/delete call:
{KEY}:DELETED
IIT Delhi
Question 1
You will need to poll an HTTP endpoint (provided to you) and log the response code in a log file, with the date and corresponding response code. In case of error response code, the date and response code should be pushed to a UDP server in same format as logged in the file.
Health check URL should be configurable via a command line argument.
Ex: ./monitor http://www.google.com/
File log format:
Date: Fri Oct 28 18:59:24 IST 2014 Response: 200
Error push format:
Date: Fri Oct 28 18:59:24 IST 2014 Response: 500
Question 2
Program a UDP server that reads string data in following format:
Kind: “valid", Data: "Awesome Data"
Kind: “invalid", Data: "Bad Data"
If "Kind" is equal to "valid" you accept and push the data in the valid.log file, otherwise push into the invalid.log file.
Note:
You are free to use the Internet to research the problems. In case you face any issues, please don't hesitate to ask.Upload your answers below
Before uploading please ensure that you follow the scheme below:
Please include a README file with details like compiler used, libraries required and instructions on how to run the code.
You can upload answer to any of the questions any time within 5 hours
Create a directory with name as "your_name-DDMMYY_Qnumber" where DDMMYY is the date and Qnumber is question number.
Put your solution in this directory and include a readme file.
Zip/tar the diretory "your_name-DDMMYY_Qnumber" and upload the entire zip here.
Please note that other than zip and tar.gz all other formats of archiving will be rejected
Example: For someone named Aragorn, Aragorn-31122012_Q1.zip, Aragorn-31122012_Q2.tar, Aragorn-31122012_Q3.tar.gz are valid answer archives.
No comments :
Post a Comment