Posts

SQL Interview Questions

1) What are the usages of SQL? To execute queries against a database To retrieve data from a database To inserts records in a database To update records in a database To delete records from a database To create new databases To create new tables in a database To create views in a database 2) Does SQL support programming? No, SQL doesn't have loop or Conditional statement. It is used like commanding language to access databases. 3) What are the subsets of SQL? Data definition language (DDL) - Data definition language(DDL) allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence etc. Data manipulation language (DML) - Data manipulation language makes user able to access and manipulate data. It is used to perform following operations. Insert data into database Retrieve data from the database Update data in the database Delete data from the database Data control language (DCL) - Data control

How can we optimize slow loading web sites?

1. Minify all CSS & js files. What is minify?  Minification is the process of removing all unnecessary characters from the source codes without changing their functionality. 2. Use optimized images instead of actual size image. What is image optimization?  Image optimization is about reducing the file size of your images as much as possible without sacrificing quality so that your page load times remain low. 3. Use Gzip compression. What is gzip compress?  Gzip is a method of compressing files. Compression allows your webserver to provide smaller file sizes which load faster for your website users.  4. During the image upload perform image resizing so the same image should be generated with multiple sizes that we can use at required positions. 5. SQL Query optimization- for better performance. 6. Enable cache - ( Redis / Memcache / file cache as cache driver ). For enabling browser level cache you can use IndexDb with expiry time& Cache-Control with

What is generator in PHP?

A generator is basically a normal function, but instead of returning a value it yields as many values as it needs to. It looks like a function but acts as an iterator. Generators use the  yield  keyword instead of return. Sample Example -  <?php function generator() { echo "Generator started"; for ($i = 0; $i < 5; ++$i) { yield $i; echo "Yielded $in"; } echo "Generator ended"; } foreach (generator() as $g);

Laravel interview questions

What is PHP artisan in Laravel? PHP is artisan is command line interface included with Laravel. It provides number of commands while developing laravel applications. Why we use Laravel? Progressive Framework Scale able Framework Large community  ORM Support Authentication Support Database Migrations Laravel Thinker and Seeder How can we configure variable in .env file? Set value in .env file => APP_Name = "Test_Laravel_Framewrok" Accessing value from .env file => env('APP_Name') How to set & get config variable in Laravel? set value in config file => config(['app.timezone' => 'YOUR TIME ZONE']); get value from config file => $value = config('app.timezone'); How can we determine current environment? Using - App::environment(); we can determine current environment. Ex - App::environment(['local', 'staging']) How to set debug mode in Laravel? In .env file we have env variable called "APP_DEBUG", If it

VueJs basic interview questions?

What are life cycle hooks in VueJs? beforeCreate - The first component in the creation hooks. This allows us to perform actions before our component has been added to DOM. We don't have access to DOM inside of this hook. Created -This hook is invoked when Vue has set up events and data observation. Here, events are active and access to reactive data is enabled though templates have not yet been mounted or rendered. beforeMount - The beforeMount hooks runs right before the initial render happens and after the template or render functions have been complied. Mounted - This is a most used hook and you will have full access to the reactive component, templates, and rendered DOM (via. this.$el). The most frequently used patterns are fetching data for your component. beforeUpdate - This hook runs after data changes on our component and the update cycle begins. But it runs right before the DOM is patched and re-renders. Updated - This hook runs after data changes on your compo

What is difference between http and https?

Start with http - Start with http:// https - Start with https:// Port http - It uses 80 port by default. https - It uses 443 port by default. Protocol http - It operates on tcp/tp level. https - It operates on http but uses encrypted tls/ssl. Data encryption http - It wont use data encryption. https - It use data encryption. SEO http - it wont help in search ranking. https - it helps in search ranking. Speed http - Speed fast. https - Speed slow. Scrambling  Data scrambling is the process to obfuscate or remove sensitive data. This process is irreversible so that the original data cannot be derived from the scrambled data. http - Does not scramble data https - It scramble data before transmission and at receiver end it de-scramble date to recover original data. There for transmitted information is secured and can not be hacked. Security Level http - It is less secured as data can be vulnerable to hackers.  https - It is designed to prev

CodeIgniter Interview Questions

CodeIgniter is an open-source MVC based framework for PHP. It is a loosely coupled framework that we can use for the rapid development of websites and mobile APIs. 1) How to check the version of the CodeIgniter framework? In system/core/CodeIgniter.php, check CI_VERSION constant value define(‘CI_VERSION’, ‘3.0.6’); 2) How to set CSRF token in CodeIgniter? CSRF is used to set the protection in CodeIgniter. To set CSRF, you have to put the corresponding config value True. Syntax: $config['csrf_protection'] = TRUE; 3) How many types of messages you can log in to CodeIgniter? There are three message types in Codeigniter. They are : Error Messages. These are actual errors, such as PHP errors or user errors. Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info. Informational Messages. These are the lowest priority messages, simply giving information regarding some process.

Object Oriented Programming (OOPs) Concepts in PHP

Class -  Class is the template which contains class members. class members are properties and methods. Property - Variable declared within the class. Method - Function declared within the class. Object -  An object is the memory location of the class variables. We can access the class variables with the support of object. New -  By using this keyword we can allocate space in the new memory locations to load class content. Constructor -  The constructor is one the type of method which is having class name same as method name. By default, every class contains a default constructor used to load class constraints. In PHP we can use constructor in two ways - Using constructor keyword (default constructor) - __constructor(). Using class name - className(). Destructor -  Destructor is the special type of method, which can be executed at the time of destroying object of class. By using __destructor() we can create destructor. In PHP , the class objects w

Basic PHP Interview Questions?

1) What is PHP?  PHP is a server-side scripting language that is basically used for developing dynamic web pages.  2) What is the difference between echo( ) and print ( )? echo and print are more or less the same. They are both used to output data to the screen.The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters while print can take one argument. echo is marginally faster than print.  3) What is print_r( )? This is also an output function used in PHP, It is used to display the whole array in PHP.  4) How to include files in PHP? We can include a file using "include( )" or "require( )" function with file path as its parameter. 5) What is the difference between GET and POST? We can send small data using GET method but POST method can transfer a large amount of data and POST is secure method than GET method.  7) How to declare an array in P

Difference between unset() and unlink() in PHP

In PHP unlink() is a function for file system handling, unlink() is used to delete files (physical). Suppose you have uploaded a file and wants to delete this file through the coding then unlink() function is used to delete the file, Suppose you have an image with the name test.png and you wants to delete this image then use the <?php /****Condition*****/ /****Condition*****/ unlink(image path/test.png); /****Condition*****/ /****Condition*****/ ?> or <?php $xx = fopen('testing.html', 'a'); fwrite($xx, '<h1>Hello EWA!</h1>'); fclose($xx); unlink('testing.html'); ?> unset() is a function for variable management. It will make a variable undefined. Or we can say that unset() is used to null out the value of a given variable. OR Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array. Example for unset() : <?php $value =