Emicon Advisory Services
Shiva Automobiles Interview Questions and Answers
Q1. What are friend function
Friend functions are functions that are not members of a class but have access to the private and protected members of the class.
Friend functions are declared with the keyword 'friend' in the class definition.
They can access private and protected members of the class they are friends with.
Friend functions are not member functions of the class.
They are often used to allow external functions or classes to access private members of a class.
Q2. What is constructor
A constructor is a special type of method that is automatically called when an object is created in a class.
Constructors have the same name as the class they belong to.
They are used to initialize the object's state.
Constructors can have parameters to set initial values for object properties.
Example: public class Car { public Car(String color) { this.color = color; } }
Q3. What and why joins in sql
Joins in SQL are used to combine rows from two or more tables based on a related column between them.
Joins are used to retrieve data from multiple tables based on a related column
Types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
INNER JOIN returns rows when there is at least one match in both tables
LEFT JOIN returns all rows from the left table and the matched rows from the right table
RIGHT JOIN returns all rows from the right table and the matched rows f...read more
Q4. What are OOPS pillars?
OOPS pillars are the four main concepts of Object-Oriented Programming: Inheritance, Encapsulation, Abstraction, and Polymorphism.
Inheritance: Allows a class to inherit properties and behavior from another class. Example: Animal class can be inherited by Dog class.
Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: Using private variables and public methods in a class.
Abstraction: Hiding the complex implementation details and showing...read more
Q5. Check if a number is prime or not
A prime number is a number greater than 1 that has no positive divisors other than 1 and itself.
Check if the number is less than 2, if yes then it is not prime
Loop through numbers from 2 to square root of the number and check if the number is divisible by any of them
If the number is not divisible by any number in the loop, then it is prime
Q6. What is ddl commands
DDL commands are Data Definition Language commands used to define, modify, and delete database objects.
DDL stands for Data Definition Language
Common DDL commands include CREATE, ALTER, and DROP
Examples: CREATE TABLE, ALTER TABLE ADD COLUMN, DROP TABLE
Interview Process at Shiva Automobiles
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month