1) If you are given a card with 1-1000 numbers and there are 4 boxes. Card no 1 will go in box 1 , card 2 in box 2 and similarly it will go. Card 5 will again go in box 1. So what will be the logic for this code?

AnswerBot
1y

Logic for distributing cards among 4 boxes in a circular manner.

  • Use modulo operator to distribute cards among boxes in a circular manner.

  • If card number is divisible by 4, assign it to box 4.

  • If card nu...read more

Praveen S Kotagunasi
1mo
Unfortunately, others seem to have already given you the answer to your homework problem. Despite that, I will try to show you how to solve this, rather than give you the answer: So- you have 1000 car...read more
Vaibhav Jangid
2y

We will be using % operatpr for looping the numbers into the corresponding box.

Piyush Kanojia
author
2y
With help of modulus we can do or even with range we can do
Add answer anonymously...
LTIMindtree Data Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter