TCS NQT 2024 Coding Questions & Solutions : Hello Everyone this post is related to TCS NQT 2024 Coding Questions & Solutions. As we Know TCS Announced Mass Hiring for 2024 BATCH So it’s unique opportunity. You can find 5 Coding Questions with Solutions in C++, Java & Python. We are sharing Free Preparation strategy, free resources for TCS NQT.
Question 1:
FULLY AUTOMATIC VENDING MACHINE dispenses your cuppa on just the press of button. A vending machine can serve range of products as follows:
Coffee
- Espresso Coffee
- Cappuccino Coffee
- Latte Coffee
Tea
- Plain Tea
- Assam Tea
- Ginger Tea
- Cardamom Tea 5. Masala Tea
- Lemon Tea
- Green Tea
- Organic Darjeeling Tea
Soups
- Hot and Sour Soup
- Veg Corn Soup
- Tomato Soup
- Spicy Tomato Soup
Beverages
- Hot Chocolate Drink
- Badam Drink
- Badam-Pista Drink
Write a program to take input for main menu & sub menu and display the name of sub menu selected in following format (enter the first letter to select main menu):
Welcome to CCD
Enjoy your <name of sub menu>
Example 1:
Input
с
1
Output
Welcome to CCD!
Enjoy your Espresso Coffee!
Example 2:
Input
t
9
Output
INVALID OPTION!
Question 2: TCS NQT 2024 Coding Questions
- The Park(String plateNumber) function which takes a plateNumber of newly entered Car and allocates a position in the list. That is adding Car to the parking area to the next position of the last Car parked.
- The Search(String plateNumber) function should return
The Car Position as output for the given input is Car Plate Number.
Name Plate String can have minimum 6 and maximum 12 numbers of characters. Ignore decorating or separator characters. (Data Structure used to hold CPS car parking data must be initialized with following Car numbers for better output.) CPS = [MH04CC2, MH04C2820, MHO4BB3232, MH04CC2113, MHO4CC2878, MHO4BB8, MH04CC2888, MH04CC1313, MH04CC2222, MH04C1201, MH04CC555, MH04C6565, MHO4A7]
Input should be as follows:
1
MHCC2222
Note: 1 should be entered for car parking and 2 should be entered for car searching along with car plate number.
Output must be in format as follows:
- “CAR PARKED AT POSITION:<number>”, if option 1 is selected with valid car plate number as input
- CAR POSITION:<number>”, if option 2 is selected and valid car number is entered which is already present in CPS
- “CAR DOES NOT EXISTS”, if option 2 is selected and valid car number is entered which is not present in CPS “INVALID INPUT”, if option entered is other than the value 1 or 2 or if invalid car number is entered
Test case 1:
Case 1:
Example
INPUT VALUE:
2
MH04CC278
OUTPUT VALUE:
CAR POSITION: 5
Question 3:
A Washing Machine works on the principle of a Fuzzy system, the weight of clothes put inside it for wash is uncertain. But based on weight measured by sensors, it decides time and water levels which can be changed by menus given on the machine control area. For low Water level, time estimate is 25 minutes, where approximate weight is 2000 grams or any non-zero positive number below that.
For Medium Water level, time estimated is 35minutes, where approximate weight is between 2001 grams and 4000 grams.
For High Water level, time estimated is 45 Minutes, where approximate weight is above 4000 grams.
Assume the Capacity of the Machine is maximum 7000 grams.
Where the approximate weight is zero, the time estimate is 0 minutes. Write a function which takes numeric weight in the range [0,7000] as input and produces estimated time as output; if input is more than 7000, then output is: “OVERLOADED!”, and for all other inputs, the output statement is “INVALID INPUT”.
Input should be in the form of integer value- <Integer>
Output must have the following format- TimeEstimated: <Integer> Minutes
Example 1
Input Value
2000
Output Value
Time Estimated: 25 Minutes Table of Contents
Question 4:
There is a bucket of water capacity of X litres, which is supposed to fill with a mug of Y millilitres water capacity. Say for example X-100 and Y=10 then, the bucket will get full of a minimum of 8 mugs (>80% and less than 100% >). Bucket filling is to be stopped once more than 80% of bucket capacity is filled. The amount of water taken at a time in a mug is not fixed as it can be any value less than or equal to y. Notify to stop once the bucket is full. That is more than 80% of the capacity of the bucket and the count number of mugs poured into the bucket. Note that Bucket capacity will always be greater than Mug’s capacity.
Example 1:
INPUT Values
100 // Enter bucket capacity in litres as this
20//Enter Mug capacity in litres as
this
//Enter Amount of water in MUG one after other as below
20
20
20
20
20
OUTPUT Values
BUCKET FULL!
NUMBER OF MUGS: 4
Note:
Order of inputs should be the same as shown in the above example. Do not use Input Prompts(Directly accept input values in order as above). Output should match with the format given above.
If the amount of water entered by the user is less than zero or greater than Mug’s Capacity display “INVALID INPUT” and quit. If the capacity of Mug entered is greater than the capacity of Bucket then quit with the error message “INVALID INPUT”.
Question 5:
Given N gold wires, each wire has a length associated with it. At a time, only two adjacent small wres assembled at the end of a large wire and the cost of forming is the sum of their length. Find the minimum cost when all wires are assembled to form a single wire.
For Example:
Suppose, Arr[] = (7, 6, 8, 6, 1, 1) (7,6,8,6,1,1)-(7, 6, 8, 6, 2), cost = 2 (7,6,8,6,2)-(7.6, 8, 8), cost = 8 (7,6,8,8)-(13,8, 8), cost=13 (13, 8, 8)-(13, 16), cost = 16 (13, 16)-(29), cost = 29 2+8+13+16+29=68
Hence, the minimum cost to assemble all gold wires is: 68
Input Format:
1) The first line of input contains the value N.
2) Next N line contains the value of elements of array
Output Format:
Print Minimum cost when all wires are assembled to form a single wire.
Sample Input1:
N=6 and arr=(7, 6, 8, 6, 1, 1).
Output
68
This is All About TCS NQT 2024 Coding Questions & Solutions.
About : New Off Campus Jobs
Hi everyone, welcome to the new website for off-campus job opportunities. We have a new website where we post real jobs for people who just finished school, college, or have work experience. No matter which batch or branch you are from, there are lots of jobs and internships available for you to explore. Jobs you can work for several hours in a day are called part-time jobs. Meanwhile, jobs that require you to work for a complete day are called full-time jobs. Jobs you can do from your own home. Getting ready for a job.
- Off-Campus Jobs
- Verified Jobs
- Internship Opportunities
- Part-Time | Full-Time Jobs
- Work from Home Jobs