Study Flashcards

1
Q
  1. Difference between Object and Class
A

A class is a blueprint or template for creating objects. It defines properties (attributes) and behaviors (methods) that the objects created from it will have. An object, on the other hand, is an instance of a class. It’s a concrete entity with actual values for those properties and is capable of performing actions through its methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Difference between Array and ArrayList
A

An array is a fixed-size collection of elements of the same type. Its size cannot be changed once created. An ArrayList, a part of Java’s Collections Framework, provides a more flexible way to handle collections of objects. It can dynamically resize itself and provides more methods for manipulating data, like adding or removing elements.This data type (especially in Java) allows for storage of different data types, whilst an array must be of a homogenous data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Difference between Inner Join and Left Join
A

In SQL, an inner join returns rows when there is a match in both tables being joined. A left join, however, returns all rows from the left table and the matched rows from the right table. If there is no match, the result is NULL on the right side.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. What is Normalization
A

Normalization is a process in database design to organize data to reduce redundancy and improve data integrity. It involves dividing large tables into smaller, related tables and linking them using relationships. The goal is to minimize duplication and avoid data anomalies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. How to Write Code for a Constructor
A

A constructor is a special method in a class that is called when an object of that class is created. It typically initializes the object’s properties. In Java, a constructor has the same name as the class and no return type. For example, in a Person class, a constructor might look like this: public Person(String name) { this.name = name; }.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. What is Finally
A

In Java, finally is a block used in exception handling. It follows try and catch blocks and executes regardless of whether an exception is thrown or caught. It’s typically used for cleanup code, like closing file streams or releasing resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. Can You Do Multiple Catch Blocks
A

Interview Response: Yes, you can have multiple catch blocks in Java. This allows you to handle different types of exceptions differently. Each catch block is matched in the order they are written and catches the specific exception it defines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. Are Exceptions Caught in a Specific Order
A

Yes, exceptions are caught in the order in which catch blocks are defined. Java checks each catch block from top to bottom and the first catch block that matches the exception type gets executed. It’s important to catch more specific exceptions before more general ones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. What is a Foreign Key?
A

A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table. It’s used to establish and enforce a link between the data in two tables, essentially a reference to a primary key in another table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. The Four Pillars of Object-Oriented Programming
A
  • Encapsulation: Keeping the data (variables) and the code (methods) together in one unit (class), and restricting the access to the details of the implementation.
  • Abstraction: Hiding complex implementation details and showing only the necessary features of an object.
  • Inheritance: A mechanism where a new class can inherit properties and methods from an existing class.
  • Polymorphism: The ability to process objects differently based on their data type or class.
    Simplified Explanation:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly