TCS
Company
Programming
Data Analysis of Process
Mr. Chintamani is Run Manager of one of the Finance Project. Due to some technical issue, he has observed that one core finance process is failing from past few months which causes a lot of rework and adjustments in ledgers. Chintamani has decided to do data analysis which will help him to find tenure and frequency of the error. He has asked Run team to closely monitor the system during the tenure.
Chintamani has monthly log of the finance process and he wants an automated technical process which can give day-wise number of failures that occurred during the month. Thus by doing data analysis he can take an action at the earliest. Your task is to write a program to read monthly log of the finance process and display day-wise total count with a keyword given as an input.
Input Format:
First line contains Keyword - Keyword to search in log file for analysis
Second line contains File Name - Name of monthly process log, where file contains date-wise log
Output Format:
Print the date-wise count of keyword, where first field is date and second field is total count of the keyword, delimited by whitespace
Constraints:
Log File should contain text data only and log file should contain date-wise logs of the process. Each log is on a separate line.
Keyword can be in alphanumeric format and input should allow space character also.
All counts should be in a separate line according to the date.
Example content of the file is shown below
2015-04-01 08:21:25 StandardWrapper[/admin:invoker]: error in Loading container servlet invoker
2015-04-02 01:46:09 WebappLoader[/admin]: in deploy JAR /WEB-INF/lib/struts.jar to F:ApacheTomcat 4.1webapps..serverwebappsadminWEB-INFlibstruts.jar1
2015-04-03 01:46:09 WebappLoader[/admin]: error in deploy JAR /WEB-INF/lib/struts.jar to F:ApacheTomcat 4.1webapps..serverwebappsadminWEB-INFlibstruts.jar2
2015-04-03 01:46:09 WebappLoader[/admin]: error in deploy JAR /WEB-INF/lib/struts.jar to F:ApacheTomcat 4.1webapps..serverwebappsadminWEB-INFlibstruts.jar2
Read Solution (Total 0)
TCS Other Question
Data Decryption
Data is encrypted in order to maintain security. Encrypted data format and corresponding decryption procedure is described below.
A Data Record consists of exactly two lines. Each Record has exactly two 'F' characters. The first 'F' character acts as field delimiter. The second 'F' character marks the end of the Record. First 'F' characters can be present in either of the two lines. However, the second 'F' is always present only in the first line. Also, since the second 'F' character marks end of the record, it is always the last character of the first line.
The decryption procedure is explained using an example Record
13F6803F
2457959
Note the following things
The Record is comprised of two lines
The Record has 2 'F' characters
The second 'F' character appears as the last character in first line
The length of the first line is one character more than the length of the second line
Other than 'F's, the lines can contain only numeric characters
Data has to be read in following order from left to right
Read first character of first line
Then, read first character of second line
Then, read second character of first line
Then read second character of second line
So on and so forth in zig-zag manner until the first 'F' character is encountered
Replace the first 'F' by | (pipe) symbol
So the first field which is now decrypted is 1234, based on the example above
Continue reading rest of the record by following steps 1 - 4
When second 'F' character is encountered, the record is said to be completely read and we have obtained our second field value as 567890539
Your task is to decrypt set of records. The Input and Output sections below specify how the input has to be read and how the output has to be written.
Input Format:
File Name, where file contains records (recollect that each Record is comprised of 2 lines)
Output Format:
Print the decrypted data delimited by pipe symbol ('|')
Constraints:
There can be maximum 100 records in the input file
The Record length including characters in both lines may not exceed 25
Cliff and Radar
Two cliffs of lengths X and Y join at one end and enclose a body of water. The angle between the cliffs, phi, is known. A radar is installed at the point where the cliffs are joined. It has a range of m where m < X and m < Y. Calculate the area of the water enclosed between the cliffs which cannot be scanned by the radar and the distance between the end points of two cliffs.
Fig:Cliff and Radar
Input Format:
First line contains length of cliff AB, denoted by X in meters
Second line contains length of cliff AC, denoted by Y in meters
Third line contains range of radar, denoted by m in meters
Fourth line contains angle BAC in degrees, denoted by Φ (phi)
Output Format:
On first line, print the area enclosed between the cliffs that cannot be scanned by the radar in square meters
On second line, print the distance between end points of two cliffs in meters
Constraints:
X > 0
Y > 0
0 < m < X and 0 < m < Y
Φ (phi) > 0
Calculations should be done upto 11-digit precision, but output values should be printed upto 5 decimal places