0% found this document useful (0 votes)
33 views15 pages

Complex Coding Round

The document outlines various programming tasks and projects, including a toll payment processing application, a Tic-Tac-Toe game, an invoice management system, and a lift system. It describes the requirements and functionalities for each project, emphasizing object-oriented design and modularity. Additionally, it includes advanced programming challenges and game design tasks, culminating in a railway ticket reservation system with specific booking and cancellation rules.

Uploaded by

ragul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views15 pages

Complex Coding Round

The document outlines various programming tasks and projects, including a toll payment processing application, a Tic-Tac-Toe game, an invoice management system, and a lift system. It describes the requirements and functionalities for each project, emphasizing object-oriented design and modularity. Additionally, it includes advanced programming challenges and game design tasks, culminating in a railway ticket reservation system with specific booking and cancellation rules.

Uploaded by

ragul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

COMPLEX CODING ROUND

1) This was an application development round. The application


was TOLL PAYMENT PROCESSING .
They insisted us to do it in a object oriented language. First they
asked the design( what are all the classes and objects & what
data structure do you use).
Application description:

 There are „n‟ number of points in a highway out of which


some points collect toll.
 Each toll has its own charging scheme according to the

vehicles and whether or not they


are a VIP user.
 If they are VIP user, 20% discount apply.

 If the vehicle passes 3 toll gates, it has to pay in all the 3 toll

gates according to the


scheme of respective tolls.
There were 4 modules.
1. Given the details of vehicle type, start and
destination……display the total toll paid during
the journey and print the amount after applying the discount.
2. Display the details of all the tolls…..like what are all the
vehicles(vehicle number) passed
that respective toll and the amount each vehicle paid……and the
total amount charged in
that toll.
3. Display the details of all the vehicles …….like what are all
the journeys did it take….the
start and destination of the same……tolls it passed during that
journey….amount paid in
that journey…..and the total amount paid by that vehicle.
4. Assume the highway as a circular path……we have to find
the short route and identify
the tolls between that route and calculate the amount.

2) Implementation of Tic-Tac-Toe game


Rules of the Game
 The game is to be played between two people (in this program
between HUMAN and COMPUTER).
 One of the player chooses „O‟ and the other „X‟ to mark their
respective cells.
 The game starts with one of the players and the game ends when one
of the players has one whole row/ column/ diagonal filled with
his/her respective character („O‟ or „X‟).
 If no one wins, then the game is said to be draw.

Implementation
In our program the moves taken by the computer and the human are
chosen randomly. We use rand() function for this.
What more can be done in the program?
The program is in not played optimally by both sides because the
moves are chosen randomly. The program can be easily modified so
that both players play optimally (which will fall under the category
of Artificial Intelligence). Also the program can be modified such
that the user himself gives the input (using scanf() or cin).
The above changes are left as an exercise to the readers.
Winning Strategy – An Interesting Fact
If both the players play optimally then it is destined that you will
never lose (“although the match can still be drawn”). It doesn‟t
matter whether you play first or second.In another ways – “ Two
expert players will always draw ”.
Isn‟t this interesting ?

3) Advanced programming.
You are given coordinates as input
(0 0 ) (0 1 ) ( 0 2) (0 3) (1 5) (1 4 ) (3 5 )
1. Check if the given points lie in the same line
2. GIven a point find the points on the largest line [in terms of the points
it contain ] passing through that point
Input : 0 1
Output : (0 0 ) (0 1) (0 2 ) (0 3 )
3. Given 2 points find the points in between them.
Input (0 0) (0 3 )
Output : (0 1) (0 2 )
4. Find the number of points in the line with the largest number of points
in it.
5. Given a point print all the lines passing through it [ie for each line
print the points in it ]
4) We were asked to develop a mini-project „Invoice Management‟ with
the following modules :
1. Add a customer
2. Add an invoice
3. Add items to an invoice
4. List all customers
5. List all invoices
6. List all invoices of a customer
7. Display the full details of an invoice

5) Those who have solved 4 or above problems has shortlisted for 3rd
round.It was a gaming round.
Size of the array is given were w is wall, g ground, o ball, numbers are
bricks.
I/p size 7
Number of bricks 6
Position (2, 2)(2, 3)(2, 4)(3, 2)(3, 3)(3, 4)
Ball:5(life)
wwwwwww
w w
w 1 1 1 w
w 1 1 1 w
w w
w w
w g g o g g w
There are three commands St, lt, rt straight, left, right respectively.
If it is st the ball moves straight .if there any brick(1) along the way it hit
it .then brick disappear.ball back to original position.if there is no brick
.it come to initial position.
I/p st
O/p
wwwwwww
w w
w 1 1 1 w
w 1 1 w
w w
w w
w g g o g g w
Ball count:5
I/p lt
O/p
wwwwwww
w w
w 1 1 1 w
w 1 w
w w
w w
w g o g g g w
Ball count:4
(Lt : ball moves diagonally left there is no bricK on the way so it hit the
wall reflect back horizontally there is a brick(3, 2) after hitting it it
moves downwards ball position changed.hence ball count get reduced.
On moving downwards is there any brick that also disappear.)
Same for rt but moves diagonally right.
This is first module.In second module each brick has value for each hit
value get reduced.it disappear only when it become zero.

6) Given an employee date base.


Name, Age, Designation, Department Of ten people.
and Five tasks were given such as
1. Print all employee details.
2. Searching employee details
3. Employees under the given manger name of the department
4. reporting to tree of the given employee name

7)
Lift system
There were 8 modules
1. Display the position of Lift

Lift : L1 L2 L3 L4 L5
Floor: 0 0 0 0 0

2. Assign Lift to the users

Input : 2 5
Output : L1 is assigned
Lift : L1 L2 L3 L4 L5
Floor: 5 0 0 0 0

3. Assign nearest lift by comparing their current positions


Assume,

Lift : L1 L2 L3 L4 L5
Floor: 5 2 7 9 0
Input : 4 10
Output :
L1 is assigned
Lift : L1 L2 L3 L4 L5
Floor: 10 2 7 9 0

Explanation : L1 is near to 4 floor


4. If two lifts are nearest to the user‟s source floor, the assign the lift with same
direction of user‟s requirement.
Example: if user request to move from 4 to 2 ,and if L3 is in 5th floor & L5 is in
3rd floor, then we should assign L3 because user requested for downward motion
so L3 ill move down from 5th floor
5. Restrict L1 & L2 for 0-5th floor , L3 & L4 for 6-10th floor , L5 for 0-10th
Initially all lifts are at 0th floor.
6. Assign lift with least number of stops
Example:
If L3 is in 9th floor
And L5 is at 8nd floor
If user wants to move from 8 to 0
We should assign L3 because L3 ill stop at 8,7,6 and then 0 NumberOfStops = 3,
but L5 ill stop at 8,7,6,5,4,3,2,1,0 and NumberOfStops = 8 so we should assign L3
7. Assign capacity (Number of people capable to travel) to all lift and assign
according to the capacity
8. If any lift is under maintenance then their current position should be marked as
“-1” and that lift should not be assigned at any cost.
8) GAMES TO DESIGN:\
TIC-TOE GAME
 Minesweeper
Breakout a.k.a. Arkanoid a.k.a. Brick-
Breaker (you‟ll find it online)
 dungeon game.
The game was split into various stages and
we were asked to implement the logic stage
by stage.
9) A matrix game was given with 5 rules. We were asked to implement each of
the rules separately.

R3 | - - - |
R2 | - - - |
R1 | - - - |
C1 C2 C3

Each of the 9 cells can either be empty or filled with an atom. R3, R2, R1 are the
rays that originate from the left. C1, C2, C3 are the rays that originate from the
bottom of the box.
Input : Position of the atoms and the rays that gets originated from the outside of
the box.

Eg.) 3
31
22
13
3
R3 C1 C3

Output : Print the box.

Rule1:
A ray that has an atom in its path should print „H‟ (Hit) If it does not have any
atoms in its path, the ray should pass to the other side.

C1 C3
R3 | - - - | R3
H |- X -|
R1 | - - - | R1
C1 H C3

Rule2&3:
A ray that has an atom in its diagonal adjacent position should refract.

H |- - -|
H |X - -|
R |- X -|
R H R

Input rays: R1, R2, C3

H |- X -|
R2 | - - - | C3
|- - -|
R2 C3

Rule4:
A ray that has atoms in both of the diagonal adjacent positions should reflect back.

Input ray: C2
|- - -|
|X - X|
|- - -|
R

Input ray: R2
|- X -|
R |- - -|
|- X -|

Rule5:
The deflection of rays should happen in the order of the input rays.

Input Rays: R3, R2, C1, C3


H|- X -|
R2 | - - - | C3
|- - -|
R2 C3

The final task was to implement these rules for dynamic matrix size.

Input : no of rows, no of columns


Eg.) 4 4 (row & column)
2 (No of atoms)
4 4 (Position of atom)
2 2 (Position of atom)
2 (No of rays)
R4 C2 (Ray number)

H |- - - X|
|- - - -|
|- X - -|
|- - - -|
H

The final task was very confusing and it had to handle all the cases. There are
chances for a ray to end at the starting position if the number of rows and columns
are more than 5.

10) Design a Call taxi booking application


-There are n number of taxi‟s. For simplicity, assume 4. But it should
work for any number of taxi‟s.
-The are 6 points(A,B,C,D,E,F)
-All the points are in a straight line, and each point is 15kms away from
the adjacent points.
-It takes 60 mins to travel from one point to another
-Each taxi charges Rs.100 minimum for the first 5 kilometers and Rs.10
for the subsequent kilometers.
-For simplicity, time can be entered as absolute time. Eg: 9hrs, 15hrs etc.
-All taxi‟s are initially stationed at A.
-When a customer books a Taxi, a free taxi at that point is allocated
-If no free taxi is available at that point, a free taxi at the nearest point is
allocated.
-If two taxi‟s are free at the same point, one with lower earning is
allocated
-Note that the taxi only charges the customer from the pickup point to
the drop point. Not the distance it travels from an adjacent point to
pickup the customer.
-If no taxi is free at that time, booking is rejected
Design modules for

1) Call taxi booking


Input 1:
Customer ID: 1
Pickup Point: A
Drop Point: B
Pickup Time: 9

Output 1:
Taxi can be allotted.
Taxi-1 is allotted

Input 2:
Customer ID: 2
Pickup Point: B
Drop Point: D
Pickup Time: 9

Output 1:
Taxi can be allotted.
Taxi-2 is allotted
(Note: Since Taxi-1 would have completed its journey when second
booking is done, so Taxi-2 from nearest point A which is free is
allocated)

Input 3:
Customer ID: 3
Pickup Point: B
Drop Point: C
Pickup Time: 12

Output 1:
Taxi can be allotted.
Taxi-1 is allotted

2) Display the Taxi details

Taxi No: Total Earnings:


BookingID CustomerID From To PickupTime DropTime
Amount

Output:
Taxi-1 Total Earnings: Rs. 400

1 1 A B 9 10 200
3 3 B C 12 13 200
Taxi-2 Total Earnings: Rs. 350
2 2 B D 9 11 350

11) This round contained of advance programing but the logics


were easy but they gave more importance to the modularity,
Object oriented approach and things like that. They asked to
create a simple console based application for e commerce. Two
user‟s admin and customer with different functionalities were
given. The Customer has to buy items then if discount is
applicable for that product he can redeem it and he can also view
the Order history. The Admin can add new items and so on.

12) One application will be given. Time: 2h30m


Write an application for booking railway ticket reservation system. The
application should have four functionalities.
1. Book
2. Cancel
3. Print booked tickets (details with summary)
4. Print available tickets (details with summary)
Conditions for booking:
There are a total of 63 berths for 63 confirmed tickets, 9 berths for 18
RAC tickets and 10 tickets in waiting-list. If the waiting-list ticket count
goes above 10, print as „No tickets available‟. The following passenger
details should be obtained from the user.
1. Name
2. Age
3. Gender
4. Berth Preference
The tickets should not be allocated for children below age 5.But, their
details should be stored. Lower berth should be allocated for persons
whose age is above 60 and ladies with children if available. Side-lower
berths should be allocated for RAC passengers.
Conditions for cancelling:
Whenever a ticket is cancelled, a ticket from RAC should be confirmed
and a waiting-list ticket should move to RAC.
Conditions for printing booked tickets:
Print all the tickets that are filled along with the passenger details and at
the end, print the total number of tickets that are filled.
Conditions for printing available tickets:
Print all the tickets that are unoccupied and at the end, print the total
number of tickets that are unoccupied.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy