Maventic Innovative Solutions
Reliable Autotech Interview Questions and Answers
Q1. Can 'this' keyword be equal to null?
No, the 'this' keyword cannot be equal to null.
The 'this' keyword refers to the current instance of a class.
It is used to access the members of the current object.
Since 'this' refers to an object, it cannot be null.
Q2. Why constructor overriding is not allowed in java?
Constructor overriding is not allowed in Java to maintain the integrity of the object creation process.
Constructor is used to initialize the object state, and allowing overriding can lead to unexpected behavior.
Inheritance allows the subclass to inherit the superclass constructor, but not override it.
If a subclass needs to modify the behavior of the superclass constructor, it can use constructor chaining or call a separate method.
Example: If a subclass overrides the superclas...read more
Q3. Why is normalization used and what is 3NF with example?
Normalization is used to eliminate data redundancy and improve data integrity. 3NF ensures that each attribute is dependent on the primary key.
Normalization helps in organizing data in a structured manner
It eliminates data redundancy and inconsistencies
3NF ensures that each attribute is dependent on the primary key
For example, a table with columns like Order ID, Product ID, and Customer ID can be normalized to eliminate redundant data
Q4. Can static and public be interchanged ?
No, static and public cannot be interchanged.
Static and public are two different keywords in programming.
Static is used to define a variable or method that belongs to the class itself, rather than an instance of the class.
Public is an access modifier that allows the variable or method to be accessed from anywhere in the program.
Interchanging static and public would result in a syntax error.
For example, in Java, the following code is valid: public static int myVariable = 10;
Bu...read more
Q5. What is inheritance with code. Difference between overloading and overriding.
Inheritance is a mechanism in OOP where a new class is derived from an existing class. Overloading is having multiple methods with the same name but different parameters. Overriding is having a method in the subclass with the same name and parameters as in the superclass.
Inheritance allows for code reuse and promotes code organization.
Overloading is used to have multiple methods with the same name but different parameters.
Overriding is used to change the implementation of a m...read more
Q6. Types of Constructors
Types of Constructors
Default constructor: No arguments, initializes object with default values
Parameterized constructor: Takes arguments and initializes object with provided values
Copy constructor: Creates a new object by copying the values of an existing object
Static constructor: Initializes static members of a class
Private constructor: Restricts the creation of objects from outside the class
Reviews
Interviews
Salaries
Users/Month