TCS NQT Coding Questions and Answers | TCS NQT 2024 Preparation | Advanced Coding Questions PART-1

TCS NQT Coding Questions and Answers: Hello Everyone this post is related to TCS NQT Previous Year Coding Question with Solution. As we Know TCS Announced Mass Hiring for 2024 BATCH So it’s unique opportunity. You can find 2 Coding Questions with Solutions in C++, Java & Python. We are sharing Free Preparation strategy, free resources for TCS NQT.

Question 1:

1. An Zoo consists of two types of animals with different number of legs. The zoo management wants to find out how many type of animals are their with each category.

  • N represents the total number of animals
  • L represents the total number of Legs

Find out the number of animals of each category

Constraints:

There are only two type of animals two legs and four legs animals

N and L should be greater than zero

L>=2, L%2=0, N<L

Input Format:

1) The first line of input contains the value N represents the sum of both types of animals.

II) The second line of input contains value L represents total number of Legs

Output Format:

Print the number of animals of each category (two legs & four legs) 

If input is not Valid print Invalid input

Sample Input1:

N=200

L=540

Sample Output1:

TL=130

FL=70


Question: 2

A parking lot in a park has MxN number of parking spaces. Each parking space will either be  empty(0) or full(1). The status (0/1) of a parking space is represented as the element of the matrix. The task is to find the row with have maximum number of cars parked in it.

Note :

MxN- Size of the matrix

M is the number of row and N is number of columns
Elements of the matrix M should be only 0 or 1.

Input Format:

1) The first line of input contains the value M the number of rows.

2) The second line of input contains value N represents the number of columns.

3) Next line contains a matrix with values 1 and 0

Output Format:

Print the Row which have maximum number of cars parked in it.

Sample Input1:

R=3

L=4

Matrix= 0   1   0   0

                1  1   0    1

                1   1  1     1

Output : 3 Row 3 have maximum number of 1.

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

Leave a Comment