1. Question:What are the abstract class and interface?

     

    Answer
    Abstract class:  An abstract class is a class that really isn’t supposed to ever be instantiated but instead serve as a base class to be inherited by other classes. Syntax->
             abstract class Class_name{
                 //insert attribute definitions here.
                 //insert method definitions here.
             }   
    Interface: An interface defines a general specification for implementing a particular service,   
                   declaring the required functions and constants without specifying exactly how it must be      
                   implemented. In PHP, an interface is created like so :
             Interface  InterfaceName{
    CONS 1;
    ………..
    CONS N;
    function methodName1();
    ……………………………………..
    function methodNameN();  
           } 

    1. Report
  2. Question:What are the encryption techniques in PHP? 

    Answer
    PHP implements the MD5 hash algorithm using the md5() function,
    eg : $encrypted_text = md5 ('password');

    1. Report
  3. Question:How to create an PHP array of a group of items inside an HTML form? 

    Answer
    We can create input fields with same name for "name" attribute with squire bracket at the end of the name of the name attribute, It passes data as an array to PHP super global. 
    For instance :
    
    <input name="MyArray[]" />  
    <input name="MyArray[]" />  
    <input name="MyArray[]" />

    1. Report
  4. Question:What are passing arguments by reference and passing arguments by value? 

    Answer
    By reference: When we pass an argument by reference, we pass a pointer to the value in memory. The function operates on the argument. When a function changes the value of an argument passed by reference,the original value changes.By value: When we pass an argument by value, we pass a copy of the value in memory. The function operates on the copy. This means that when a function changes the value of an argument passed by value, the effect is local to that function; the copy changes but the original value in memory is not affected.

    1. Report
  5. Question:What is recursive function? 

    Answer
    A recursive function is a function that calls itself during its execution. This enables the function to repeat itself several times, outputting the result and the end of each iteration. Below is an example of a recursive function. 

    function Count (integer N)    
    if (N <= 0) return "Must be a Positive Integer";    
    if (N > 9) return "Counting Completed";    
    else return Count (N+1);
    end function

    1. Report
  6. Question:What is the use of "enctype" attribute in a html form? 

    Answer
    The enctype attribute determines how the form-data should be encoded when submitting it to the server. We need to set enctype as "multipart/form-data" when we are using a form for uploading files

    1. Report
  7. Question:Define exceptions.
               

    Answer
    In programming, often involves unforeseen happenings that disrupt the flow of events.These  unexpected happenings are known as exceptions.

    1. Report
  8. Question:What are the types of key of array?

     

    Answer
    Each array consists of two components:  key and a value. Keys can be numerical or associative. Numerical key use numeric value and associative key use string value.


    1. Report
  9. Question:Between echo () and print () functions which one is the faster and why?

     

    Answer
    The echo() function is a tad faster than print() function; because it returns nothing, whereas print () will return 1 if the statement is successfully output. 


    1. Report
  10. Question:What are class and object?

     

    Answer
    Class: Classes are intended to represent those real-life items that we would like to manipulate within an application.

    Object: A class provides a basis from which we can create specific instances of the entity the class models, better known as objects. For example, an employee management application may include an Employee class. we can then call upon this class to create and maintain specific instances.

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd