Add office photos
Employer?
Claim Account for FREE

Serole Technologies

2.8
based on 32 Reviews
Filter interviews by

Cosmic Byte Interview Questions and Answers

Updated 5 Feb 2024

Q1. What are checked and unchecked exceptions

Ans.

Checked exceptions are checked at compile-time while unchecked exceptions are not.

  • Checked exceptions are those that are checked at compile-time and must be handled or declared in the method signature.

  • Unchecked exceptions are those that are not checked at compile-time and do not need to be handled or declared in the method signature.

  • Examples of checked exceptions include IOException, ClassNotFoundException, and SQLException.

  • Examples of unchecked exceptions include NullPointerE...read more

Add your answer

Q2. What is object and what is class?

Ans.

An object is an instance of a class. A class is a blueprint or template for creating objects.

  • A class defines the properties and behaviors of objects

  • An object is created from a class using the 'new' keyword

  • Multiple objects can be created from a single class

  • Classes can inherit properties and behaviors from other classes

  • Example: Class - Car, Object - Honda Civic

Add your answer

Q3. Difference between string buffer and string builder

Ans.

String buffer is synchronized and thread-safe while string builder is not.

  • String buffer is slower than string builder due to synchronization.

  • String builder is faster but not thread-safe.

  • String buffer is preferred for multi-threaded applications.

  • String builder is preferred for single-threaded applications.

  • Both classes are used for manipulating strings efficiently.

Add your answer

Q4. How to use try, catch and finally?

Ans.

try-catch-finally is used for handling exceptions in code.

  • try block contains the code that may throw an exception

  • catch block catches the exception thrown by try block

  • finally block contains code that will be executed regardless of exception

  • Multiple catch blocks can be used for handling different types of exceptions

Add your answer
Discover Cosmic Byte interview dos and don'ts from real experiences

Q5. Difference between arraylist and array?

Ans.

ArrayList is a dynamic data structure while Array is a static data structure.

  • ArrayList can grow or shrink dynamically while Array has a fixed size.

  • ArrayList can store objects of any type while Array can only store elements of the same data type.

  • ArrayList provides built-in methods for insertion, deletion, and searching while Array does not.

  • Example: ArrayList names = new ArrayList(); String[] namesArray = new String[5];

  • Example: names.add("John"); names.add("Jane"); namesArray[0...read more

Add your answer

Q6. Explain any 2 oops concepts

Ans.

Encapsulation and Inheritance are two important OOPs concepts.

  • Encapsulation is the process of binding data and functions that manipulate that data together in a single unit, called a class.

  • Inheritance is the process of creating a new class by inheriting properties and methods from an existing class.

  • Encapsulation helps in data hiding and abstraction, which makes the code more secure and easy to maintain.

  • Inheritance helps in code reusability and saves time and effort in writing...read more

Add your answer

Q7. Usage of final keyword

Ans.

Final keyword is used to declare a constant value that cannot be changed.

  • Final keyword can be used with variables, methods, and classes.

  • Final variables must be initialized at the time of declaration or in constructor.

  • Final methods cannot be overridden by subclasses.

  • Final classes cannot be extended by other classes.

  • Final keyword is also used in try-with-resources statement to declare resources that should be closed after use.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

4.2
 • 630 Interview Questions
4.0
 • 596 Interview Questions
3.9
 • 461 Interview Questions
4.4
 • 426 Interview Questions
4.2
 • 220 Interview Questions
3.9
 • 186 Interview Questions
View all
Top Serole Technologies Interview Questions And Answers
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
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