Advanced Interview Questions

1- Explain register and boot methods in the service provider class ?
The register method in the Service Provider class binds classes and services to Service Containers. And the boot method runs after the program includes all the dependencies in the container. Then you can create routes and view composers in the boot method.
2- What are the features of Laravel?
1- Offers a rich set of functionalities like Eloquent ORM, Template Engine, Artisan, Migration system for databases, etc 2- Libraries & Modular 3- It supports MVC Architecture 4- Unit Testing 5- Security 6- Website built in Laravel is more scalable and secure. 7- It includes namespaces and interfaces that help to organize all resources. 8- Provides a clean API.
3- What are the basic concepts in laravel?
1- Blade Templating 2- Routing 3- Eloquent ORM 4- Middleware 5- Artisan(Command-Line Interface) 6- Security 7- In-built Packages 8- Caching 9- Service Providers 10- Facades 11- Service Container
4- What is a lumen?
Lumen is a lightweight framework for building web applications in PHP. It is built on top of Laravel and follows the same best practices that you have come to know in Laravel. Lumen was designed to be used as an alternative to Laravel when you only need to build small applications and services.
5- What is Laravel Mix?
Laravel Mix is a wrapper around Webpack, a popular JavaScript module bundler. It simplifies the process of compiling assets such as JavaScript, CSS, and images, and provides a clean and expressive API for defining asset compilation tasks
6- Explain Laravel Facades?
Laravel Facades provide a static interface to classes available in the application's service container. They allow you to access these classes in a simple and expressive way without needing to instantiate them manually.
7- What is the difference between Laravel authentication and authorization?
The process of confirming a user's identification through credentials, like a username and password, is called authentication. Authorization, on the other hand, is the process of determining whether a user has the necessary permissions to perform a certain action or access a certain resource.
8- Explain the difference between INNER JOIN and OUTER JOIN ?
- INNER JOIN returns only the rows that have matching values in both tables based on the join condition specified, - OUTER JOIN returns all rows from one or both tables, with unmatched rows filled with NULL values where the join condition is not met.
9- How can you optimize a MySQL query?
MySQL query optimization involves various techniques such as indexing, using appropriate data types, minimizing the number of queries, optimizing table structure, avoiding unnecessary calculations, and utilizing query caching.
10- What does the JOIN statement do in MySQL? Explain the different types of joins?
The JOIN statement in MySQL is used to retrieve data from multiple tables based on a related column between them. Different types of joins include: 1- INNER JOIN (returns rows when there is a match in both tables), 2- LEFT JOIN (returns all rows from the left table and matching rows from the right table), 3- RIGHT JOIN (returns all rows from the right table and matching rows from the left table), 4- FULL JOIN (returns all rows when there is a match in either table).
11- What are trigger and how many TRIGGERS are available in MySQL table?
SIX triggers are available in MySQL table. 1- BEFORE INSERT 2- AFTER INSERT 3- BEFORE UPDATE 4- AFTER UPDATE 5- BEFORE DELETE 6- AFTER DELETE
12- What types of relationships are used in MySQL?
There are three types of relationships used in MySQL. 1- One-to-one: - Elements with a one to one relationship can be included as columns in the table. 2- One-to-many: - One to many or many to one relationships both are same. It will occur when one row in a table is related to multiple rows in different table. 3- Many-to-many: - Many rows in a table are related to many rows in different table is called many to many relationship.
13- What is the difference between constructor and destructor?
Constructor: - A constructor is a special member function of a class that is automatically called when an object is created. Destructor: - A destructor is a special member function of a class that is automatically called when an object of the class goes out of scope or is deleted.
14- What is the difference between abstract and interface class?
- Abstract: 1- Abstract class doesn’t support multiple inheritance (can extend only one abstract class) 2- Abstract contains constructors & data members. 3- An abstract class can have final, non-final, static and non-static variables. 4- A class that is abstract can have both abstract and non-abstract methods. - Interface: 1- An interface supports multiple inheritance. (can implements more than one interface) 2- Interface doesn't contains constructors & data members. 3- The interface has only static and final variables. 4- An interface can only have abstract methods.
15- What is the difference between overloading and overriding?
- Overloading deals with multiple methods in the same class with the same name but different signatures. - Overriding deals with two methods, one in a parent class & one in a child class, that have the same signatures.
16- What is Polymorphism? and types of Polymorphism?
Polymorphism is composed of two words - “poly”, which means “many”, and “morph”, which means “shapes”. Therefore, Polymorphism refers to something that has many shapes. In OOP, Polymorphism refers to the process by which some code, data, method, or object behaves differently under different circumstances or contexts. For Example: (Shape) has a (Circle, Triangle, Square), This is called polymorphism from one thing. There are two types of polymorphism: 1- Compile-time polymorphism (also known as static polymorphism) is achieved through function or operator overloading. 2- Runtime polymorphism (also known as dynamic polymorphism) is achieved through function overriding.
17- What is an abstract class?
In general terms, an abstract class is a class that is intended to be used for inheritance. An abstract class can consist of both abstract and non-abstract methods. - It cannot be instantiated. (Cannot create object from) - Made for other classes to inherit prop & methods from. - can have methods & properties. - can have abstract methods & non-abstract methods. - abstract methods no body code. (only parameters or arguments)
18- What is difference between class & object?
- Class is a blueprint that you can create an object from. - Object is a member in the main application. For Example: (Car) is a class. (BMW, Ford) are objects.
19- What are some advantages of using OOPs?
1- OOPs is very helpful in solving very complex level of problems. 2- Highly complex programs can be created, handled, and maintained easily using object-oriented programming. 3- OOPs, promote code reuse, thereby reducing redundancy. 4- OOPs also helps to hide the unnecessary details with the help of Data Abstraction. 5- OOPs, are based on a bottom-up approach, unlike the Structural programming paradigm, which uses a top-down approach. 6- Polymorphism offers a lot of flexibility in OOPs.
20- List down the limitations of Object-Oriented programming.
1- It requires intensive testing 2- Not apt for minor problems 3- It requires good planning 4- It takes more time to solve problems 5- Problems need to be thought in term of objects
21- Are there any limitations of inheritance? If yes, then what?
Yes. The limitations of inheritance are: 1- Increased execution effort and time. 2- Tight coupling of parent and child class. 3- Requires correct implementation. 4- Requires jumping between different classes.
22- What are the various types of inheritance?
The various types of inheritance include: 1- Single inheritance 2- Multiple inheritances 3- Multi-level inheritance 4- Hierarchical inheritance 5- Hybrid inheritance
23- What other paradigms of programming exist besides OOPs?
1. Imperative Programming Paradigm: - Procedural Programming Paradigm - Object-Oriented Programming - Parallel Programming 2- Declarative Programming Paradigm: - Logical Programming Paradigm - Functional Programming Paradigm - Database Programming Paradigm