learning-project-01 / bookstore-app

3 stars 2 forks source link

hands on java interviews #113

Open rkpatra201 opened 5 months ago

rkpatra201 commented 5 months ago

3rd May

  1. ArrayList add,remove, get by index, get by object, addAll, removeAll, retailnAll, size, isEmpty, clear for-each, for index, iterator, list-iterator
  2. Using string datatype for elements perform above operations
  3. Using Employee datatype for elements perform above operations
  4. what is the time complexity of adding an element to arraylist
  5. what is the time complexity of searching/removing an element from arraylist (not using index)
  6. what is the time complexity of searching/removing an element from arraylist using index
  7. which marker interface is used by arraylist

cc @Subhransupanda2000 / @Ansu-s

2nd May 2024

  1. sorting in this topic should be using Arrays.sort()
  2. sort string type array in natural order, reverse order
  3. sort integer type array in natural order, reverse order
  4. sort Employee type array in natural order(sort by name), reverse order(sort by name)
    class Employee{
    String name;
    Float salary;
    }

1st May 2024

  1. swapping of 2 numbers without using third variable.
  2. swapping of 2 numbers using third variable.
  3. sum of numbers of array elements which are at odd index.
  4. 1d array. reverse array elements
  5. 2d array. exchange rows or columns of 2d array

30th April 2024

  1. Methods of object class.
  2. Overriding methods of object class in Employee class.
  3. Inheritance extending a class (abstract class) for inheritance, final class, final method, final variable
  4. role of super() and super keyword in inheritance
  5. constructor invocation order in inheritance
  6. parameterized method overriding in inheritance
  7. template design pattern

29th April 2024

  1. Object cloning, swallow cloning, deep cloning, cloning with nested reference types
  2. constructor overloading. this keyword and this constructor.

https://www.infoworld.com/article/2077578/how-to-copy-objects-in-java-shallow-copy-and-deep-copy.html https://www.studytonight.com/java/this-keyword-in-java.php#google_vignette

Question:

class Address{
  String city;
  String pinCode;
  Address(String city, String pinCode){
  this.city = city;
  this.pinCode = pinCode;
  }
}
class Person{
  String name;
  int age;
  Address address;
  Person(String name, int age, Address address){
  this.name = name;
  this.age = age;
  this.address = address;
  }
}

perform swallow copy and deep copy on Person object

rkpatra201 commented 5 months ago

cc @Subhransupanda2000 / @Ansu-s updated the 1st May interview topic. Time 8pm - 8:30pm. As discussed interview will cover 29th, 30th, 1st may topics.

Subhransupanda2000 commented 5 months ago

https://github.com/Subhransupanda2000/JAVA/pull/14