Sunday 31 May 2020

AWS Elastic Beanstalk Interview Questions and Answers

AWS Elastic Beanstalk Interview Questions and Answers


Question: What is Elastic Beanstalk in AWS?
AWS Elastic Beanstalk is End-to-end web application management.


Question: Can we use Elastic beanstalk to deploy the web application which is made in Node OR PHP?
Yes, AWS Elastic Beanstalk is service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.


Question: How does works Elastic Beanstalk?
You simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and automatic scaling to web application health monitoring, with ongoing fully managed patch and security updates.


What are Benefits and features of Elastic Beanstalk?
  1. Easy to get started
    Elastic Beanstalk is the simplest way to deploy and run your web application on AWS.
  2. Complete resource control
    You have the freedom to select the AWS resources, such as Amazon EC2 instance types, that are optimal for your web application.
  3. Fully managed: update your web application with the latest platform security and patch updates.
  4. Automatic application health monitoring
    Elastic Beanstalk automatically collects more than 40 key metrics and attributes to determine the health of your web application



Question: What Language Supported by Elastic Beanstalk
  1. Go
  2. Java SE
  3. Java with Tomcat
  4. NET on Windows Server with IIS
  5. Node.js
  6. PHP
  7. Python
  8. Ruby
  9. Packer Builder



Question: How is AWS CloudFormation different from AWS Elastic Beanstalk?
AWS CloudFormation helps you provision and describe all of the infrastructure resources that are present in your cloud environment. On the other hand, AWS Elastic Beanstalk provides an environment that makes it easy to deploy and run applications in the cloud.
AWS CloudFormation supports the infrastructure needs of various types of applications, like legacy applications and existing enterprise applications. On the other hand, AWS Elastic Beanstalk is combined with the developer tools to help you manage the lifecycle of your applications.



Question: Who should use AWS Elastic Beanstalk?
Those who want to deploy and manage their applications within minutes in the AWS Cloud. You don’t need experience with cloud computing to get started. AWS Elastic Beanstalk supports Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker web applications.




Saturday 30 May 2020

PHP 7 Scalar type declarations and return type declarations

PHP 7  Scalar type declarations and return type declarations

What is a Scalar type declarations?
Allowing/Not-Allowing datatype declaration in functions is known as Scalar type declarations.


Question: What are different types of Scalar type declarations?
1) Coercive Mode (default)
2) Strict Mode


What are different type of data-type can be used in Scalar type declarations?
  1. int
  2. float
  3. bool
  4. string
  5. interfaces
  6. array
  7. callable



Question: Give the examples of Scalar type declarations with Coercive Mode (default)
Example 1
$a=1; // integer
$b=2; //integer
function FunctionName1(int $a, int $b){
return $a + $b;
}
echo FunctionName1($a, $b); //3


Example 2
   function sum(int ...$ints) {
      return array_sum($ints);
   }

   print(sum(3, '2', 5.1)); //10


Example 3
function FunctionName3(int $a, int $b){
return $a * $b;
}

echo FunctionName3('hello', 10); //PHP Fatal error: Uncaught TypeError: Argument 1 passed to FunctionName() must be of the type integer, string given.


Example 4
$a='1One'; 
$b=2; //integer
function FunctionName3(int $a, int $b){
return $a + $b;
}
echo FunctionName3($a, $b);//RESULT: PHP Notice: A non well formed numeric value encountered on line 5


Question: Give the examples of Scalar type declarations with STRICT MODE?
Example 1
declare(strict_types=1); 

$a=1; // integer
$b=2; //integer
function phpFunction (int $a, int $b){
return $a + $b;
}

echo phpFunction1($a, $b);//3

Example 2
declare(strict_types=1); 

$a='1'; // String
$b=2; //integer
function phpFunction1 (int $a, int $b){
return $a + $b;
}

echo phpFunction1($a, $b);//Fatal error: Uncaught TypeError: Argument 1 passed to phpFunction1() must be of the type int, string given


Question: Give the examples of Return type declarations with STRICT MODE?
Example 1
$a='10'; //  string
$b=2; // integer
function phpFunctionReturn ($a, $b) : int  {
return $a * $b;
}
echo phpFunctionReturn ($a, $b);


Example 2
declare(strict_types=1); 
$a='10'; //  string
$b=2; // integer
function phpFunctionReturn ($a, $b) : string  {
return $a * $b;
}
echo phpFunctionReturn ($a, $b);//PHP Fatal error:  Uncaught TypeError: Return value of phpFunctionReturn() must be of the type string, integer returned in /home/cg/root/7035270/main.php:6