Travelers have smart cards that behave just like any regular debit card that has an initial balance when purchased. Travelers swipe-in when they enter a metro station and swipe-out when they exit. The card balance is automatically updated at swipe-out.
Sapient Global Market Java Interview Questions and Coding Exercise
Carvia Tech | July 05, 2019 | 3 min read | 5,287 views | sapient interviews
Java Interview Questions
How will you introduce multi-tasking in your java application?
Design a program to search files inside a directory using multi-threading?
How will you implement a LRU timed cache in Java?
There is a folder containing multiple SQL files. Each file’s name contain a sequence number which determines the execution order of that particular SQL script file. Design an API that will take such folder and execute the SQL in correct order.
What is mechanism for inter-thread communication?
Would adding multi-threading to sorting algorithm improve its performance?
In what practical scenario’s multi-threading actually improves the performance of Java application?
What is purpose of a Future? How will you use it?
What is a BlockingQueue?
Sapient Fee calculator: Coding problem in Java
Solution to Sapient Fee Calculator discussed here
Designing Smart Card System for Delhi Metro
Solution to Delhi Metro Smart Card. implement 'Metro Smart Card System' (MSCS) for Delhi city. For application assume there is a single metro line covering 10 stations linearly. The stations name are A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 as shown below. The travel can be in any direction.
Objective of the exercise is to create an automated system that has following functionality:
2.1 Card should have a minimum balance of Rs 5.5 at swipe-in. At swipe-out, system should calculate the fare based on below strategies set at the start of the day. The fare must be deducted from the card. 2.2 Card should have the sufficient balance otherwise user should NOT be able to exit. Weekday – Rs. 7 * (Number of stations traveled) Weekend – Rs. 5.5 * (Number of station traveled if it's Saturday or Sunday) (* there can be more such fare strategies in future)
There is three file contains flight data. File data has in csv format. 1)Write a standalone program to search flight detail from all files depend on criteria 2)Criteria would be departure location,arrival location, flight date. 3)Program should follow\Oops principle. And right unit test case also. 4)Result should be in Ascending or descending order. 5)Data separated with pipe | .
File A has data like below: FLIGHT_NUM|DEP_LOC|ARR_LOC|VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE AF299|FRA|LHR|20-11-2010|0600|4.10|480 AF118|DUB|MUC|21-12-2010|1410|5.40|580 AF371|AMS|MAD|30-11-2010|1210|3.45|320
File B has data like below: FLIGHT_NUM|DEP_LOC|ARR_LOC_VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE BA123|DEL|AMS|12-10-2010|0050|8.00|950 BA412|BOS|CDG|31-12-2010|0210|7.50|800 BA413|BOS|AMS|30-11-2010|1530|7.00|750
File C has data like below: FLIGHT_NUM|DEP_LOC|ARR_LOC_VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE LH348|DEL|AMS|30-11-2010|2325|11.00|1050 LH201|LHR|MEL|21-11-2010|0230|15.30|1400 LH342|VIE|JFK|20-10-2010|1130|14.20|980
Coding Exercise Evaluation Criteria
Code Completeness/ Correctness
Code Structure and quality: Modularity, usage of OO principles, size of classes/functions,
Choice of data structures
Unit Test cases
Coding productivity (more time you take to submit the exercise, lesser you will score)
class/function/variable names, package/class structure
- Sapient Fee Calculator: Coding problem in Java
- Sapient Global Markets important topics in Java
- Sapient - Coding Exercise for Designing Smart Card System for Delhi Metro
Top articles in this category:
- Goldman Sachs Java Interview Questions for Senior Developer
- Top 50 Multi-threading Java Interview Questions for Investment Bank
- Morgan Stanley Investment Banking Java Interview Questions
- Java Concurrency Interview Questions and Answers
- ION Trading Java Interview Questions
- Citibank Java developer interview questions
- UBS Top 10 Java Interview Questions
Find more on this topic:
Interview - Product Companies, eCommerce Companies, Investment Banking, Healthcare Industry, Service Companies and Startups.
Last updated 1 week ago
Recommended books for interview preparation:
- Spring Boot with GMAIL SMTP
- Mandrill emails in Spring Boot Java
- Top 30 Hibernate and Spring Data JPA interview questions
- Generating variable length secure key/secret in Java
- Reverse the bits of a number and check if the number is palindrome or not
- MD5 and SHA256 in Java Kotlin and Android
- Spring Security 5 - There is no PasswordEncoder mapped for the id
- Inter-thread communication in Java
- What are different thread states in Java
- Static method synchronization aka Class Lock in Java
Provide email address to subscribe to this blog.