Add office photos
Engaged Employer

Bounteous x Accolite

3.4
based on 809 Reviews
Filter interviews by

SCM Garments Interview Questions and Answers

Updated 23 Nov 2024
Popular Designations

Q1. Given an array of non-negative integers.Find the length of the longest subsequence such that elements in the subsequence are contiguous integers. The consecutive numbers can be in any order. Example n=7 nums={2...

read more
Ans.

Find the length of the longest subsequence of contiguous integers in an array.

  • Sort the array

  • Iterate through the array and check for consecutive integers

  • Keep track of the longest subsequence found

Add your answer

Q2. Get list of pincodes from these objects Employee{ id Long, name String, Addresses : List } Addresses{ houseNo long, pindcode long, state String, country String, } Ans. Use flatMap to flatten and then use map to...

read more
Ans.

Use flatMap and map to extract list of pincodes from Employee objects

  • Use flatMap to flatten the list of Addresses in each Employee object

  • Use map to iterate over the flattened list and extract the pincodes

  • Example: employeeList.stream().flatMap(emp -> emp.getAddresses().stream()).map(address -> address.getPincode()).collect(Collectors.toList())

Add your answer

Q3. What is Database Pooling, Hikari and its configurations. Java 8 to current enchancements and current java version Factory and Builder design patterns to explain and code Project expalantion and details, Cross q...

read more
Ans.

Database pooling is a technique used to manage a pool of database connections for efficient resource utilization. HikariCP is a popular database connection pooling library in Java.

  • HikariCP is a high-performance database connection pooling library for Java applications.

  • It is known for its low latency and high throughput.

  • Configurations for HikariCP include settings such as maximum pool size, connection timeout, and idle timeout.

  • Example: HikariConfig config = new HikariConfig();...read more

Add your answer

Q4. Design Patterns like Singleton and how to create them

Ans.

Singleton is a creational design pattern that ensures a class has only one instance and provides a global point of access to it.

  • To create a Singleton, make the constructor private to prevent direct instantiation

  • Create a static method that returns the instance of the class

  • Use lazy initialization to create the instance only when it's needed

  • Ensure thread safety by using synchronized keyword or double-checked locking

  • Examples: java.lang.Runtime, java.awt.Desktop, java.util.Calenda...read more

Add your answer
Discover SCM Garments interview dos and don'ts from real experiences

Q5. Method overriding based code question -> guess the output

Ans.

Method overriding in Java with code example

  • Output will be 'Child class method' as the method in Child class overrides the method in Parent class

  • Method overriding is a feature that allows a subclass to provide a specific implementation of a method that is already provided by its superclass

  • The method in the subclass should have the same name, return type, and parameters as the method in the superclass

Add your answer

Q6. fetch all the duplicate values from an array

Ans.

To fetch all duplicate values from an array of strings

  • Iterate through the array and store each element in a HashSet

  • If an element is already in the HashSet, it is a duplicate value

  • Add the duplicate values to a separate list and return it

Add your answer

Q7. In given array find the sum a*a+b*b=c*c

Ans.

Use a nested loop to iterate through the array and check for the sum of squares of two elements equal to the square of a third element.

  • Iterate through the array using a nested loop to compare all possible combinations of elements.

  • Calculate the sum of squares of two elements and check if it equals the square of a third element.

  • Return the elements if a match is found, otherwise continue iterating.

Add your answer

Q8. Write API to save data

Ans.

API to save data in Java

  • Use HTTP POST method to send data to the server

  • Create a RESTful endpoint to handle the data saving

  • Validate the input data before saving it to the database

Add your answer

Q9. Hashmap iteration ways

Ans.

There are multiple ways to iterate over a HashMap in Java.

  • Using keySet() and values() methods

  • Using entrySet() method

  • Using forEach() method with lambda expression

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at SCM Garments

based on 11 interviews
2 Interview rounds
Technical Round - 1
Technical Round - 2
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Java Developer Interview Questions from Similar Companies

3.7
 • 193 Interview Questions
3.6
 • 164 Interview Questions
3.8
 • 21 Interview Questions
3.9
 • 17 Interview Questions
3.8
 • 13 Interview Questions
3.6
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

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