Sunday, December 27, 2015

PHP Quize



Quiz on Chapter: 1-3:



1.       What is the difference between $message and $$message?
A. $message is a simple variable whereas $$message is a reference variable.
B. $message is a simple variable whereas $$message is a Object variable.
C. $message is a simple object whereas $$message is a static variable.

2.       How do we declare constants variable?
A. constants $varname
B. $varname constants
C. define()
D. $$varname

3.       What are the difference between print and echo?
A. echo faster than print
B. echo return value 
C. print return value
D. echo return true

4.       ______________ data type is used to represent a single value.
A. Boolean
B. Scalar
C. Number
D. String

5.       Which is the example of compound data type?
A. array
B. object
C. String
D. Float

6.       Which statement is true about Type Juggling?
A. Variables are sometimes automatically cast.
B. Convert on data type to another     
C. Convert to object to Data Type

7.       How to get the type of the variable?
A. using getDataType function
B. using gettype function
c. datatype() function
D. settype() function

8.       Which function returns the type of variable?
(a)   gettype()
(b)   settype()
(c)    ini_set()
(d)    None of the above
9.       How to convert types?
a.       using getDataType function
b.      using gettype function
c.       datatype() function
d.      settype() function

10.   Which of the example is reference assignment?
A.      $value=”Hello”  $value2=$value
B.      $$value=”Hello”  $value2=$value
C.      $value=”Hello”  $value2=&$value

11.   PHP comments for a single line have the following syntax:
A.      /* comments /* 
B.      #  
C.      //
D.      ::  


12.   In PHP, instructions are terminated with a _______.
A.      ;      
B.      #       
C.      !       
D.      %>

13.   What is the correct way to add 1 to the $count variable?
A.      count++;      
B.      $count++;      
C.      ++count      
D.      $count =+1

14.   What does break; do?
A.      Ends execution of the current switch structure
B.      Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
C.      Ends execution of the current for, foreach, while, do-while or switch structure

15.   Which operator is used to concatenate two strings in php?
A.      dot operator (.)   
B.      plus operator (+)

16.   Which of the following function is used for terminate the script execution in PHP?
    A. break()     B.quit()

17.   <?php
    define("x","5");
    $x=x+10;
    echo x;
    ?>
    A. Error    B.15     C.  10     D. 5

18.   How to returns any ensuring value back to the function caller?
A.      using break statement 
B.      using return statement
C.      using Continue Statement

19.   Which function call themselves?
A.      Reference Function  
B.      Recursive Function 
C.      Function within Function

20.   Which statement will evaluate and include a file into the location where it is called.
A.      include() statement
B.      Inc statement 
C.      Requrired_once  Statement

21.   What are the General Features of PHP?
A.      Practicality
B.      Power
C.      Price
D.      Improved Resource Handling
E.       Possibility

22.   What is web Default server of PHP?
A.      Apache
B.      IIS
C.      PCRE
D.      PHPLIB

23.   What is additional features in PHP5?
A.      Session Handling
B.      String Handling
C.      SQLite
D.      Webserives

24.   What is Stand for WAMP server?
A.      Windows Application mySQLPHP
B.      Windows Apache MySQL PHP
C.      Windows Application amd MySQL PHP
D.      Windows Apache Microsoft PHP

25.   What command is used manipulating PHP configuration Variable?
A.      Unset()
B.      ini_set()
C.      php_conf
D.      None of the above

26.   $str="3dollars";
$a=20;
$a+=$str;
print($a);
?>
Output ?
a)      23dollars
b)      203dollars
c)       320dollars
d)      23
27.    <?php
$test="3.5seconds";
settype($test,"double");
settype($test,"integer");
settype($test,"string");
print($test);
?>

What is the following output?
2.       3.5
3.       3.5seconds
4.       3
5.       3seconds

28.    In PHP, which of the following function is used to insert content of one php file into another php file before server executes it
a)      include[]
b)      #include()
c)       include()
d)      #include{}

29.   what symbol is used as comments in php.ini file
(a)     comma (,)
(b)    Fullstop (.)
(c)     Semicolon (;)
(d)    colon (:)

30.   Echo is capable off outputting is …………?
(a)     single
(b)    multiple
(c)     boolean
(d)    void

31.   Compound data type allow ………… items?
(a)     single
(b)    multiple
(c)     boolean
(d)    none of them
32.   Null data type recognizes how many value?
(a)     1
(b)    2
(c)     3
(d)    4

33.   Which symbol is used for reference assignment?
(a)     $
(b)    &
(c)     @
(d)    ;

34.   There are how many variable scopes in PHP?
(a)     4
(b)     5
(c)      6
(d)     7

35.   There are how many equality operators?
(a)     1
(b)    2
(c)     3
(d)    4

36.   What will be the output?
 <?php
  $i=0;
While($i<=10) {
If ($i<=5) {
Continue;
}
Print $i;
$i=$i+1;
}
?> 
(a)     1
(b)    Infinitive
(c)     5
(d)    10

37.   Write the output of echo ("35 hello 55"+65); statement?
(a)     155
(b)    120
(c)     100
(d)    90

38.   What will be the output?
<?php
foreach ($i=1;<$i<=5;$i++) {
Print $i;
}
?>
(a)   1
(b)   2
(c)    4
(d)    syntax error

39.   Which file contains the configuration of apache?
(a)     httpd.conf
(b)    httpd.value
(c)     httpd.flag
(d)    httpd.ini

40.   In which loop statement will be always executed at least once?
(a)     Do ……… while
(b)    foreach
(c)     for
(d)    if

41.   In which loop total number of iteration is known before execution?
(a)     Do ……… while
(b)    foreach
(c)     for
(d)    if

42.   Write the output.
<?php
$str= "good";
$$str= "bye";
echo ${$str };
?>
(a)     good
(b)    good bye
(c)     bye
(d)    nothing

43.   Which issues are concerned in creating variables?
(a)     scope
(b)    data type
(c)     naming
(d)    All of the above
44.   <?php
$val1="good";
$val2=&$val1;
$val2="bad";
?>
What is the $val1?
(a)     good
(b)    bad
(c)     good bad
(d)    all

45.   Which of the following function has no return value?
(a)     echo
(b)    print
(c)     printf
(d)    all

46.   <?php
$x=2;
$y=$x++;
$y=$y+2;
echo $y;
?>
What will be the output?
a)      2
b)      22
c)       4
d)      None of the above

47.   What will be the output?
<?php
$a="1";
If($a==1) {
Print "sonna is gomvir";
}
elseif($a=="1") {
Print "sonna is jolly ";
} else {
Print "sonna is funny";
}
?>
(a)     sonna is gomvir
(b)    sonna is jolly
(c)     sonna is funny
(d)    None of the above

48.   What will be the output?
 <?php
$i=0;
While ($i<=10) {
                    If ($i<=5) {
                    break;
                    }
Print $i;
$i=$i+2;
}
?>
(a)     5
(b)    10
(c)     2
(d)    nothing

49.   What will be the output?
 <?php
$i=1;
do {
$i++;
Print $i;
}
While ($i<=0);
?>
(a)     1
(b)    2
(c)     0
(d)    none of the above

50.   What will be the output?
 <?php
foreach ($i=1; <$i<=5; $i++) {
Print $i;
}
?>

(a)     1
(b)    5
(c)     2
(d)    syntax error


51.   Which symbol is used for variable declaration?
(a)     @
(b)    $
(c)     &
(d)    #

52.   Which of the following symbol used for Heredoc?
(a)     <<
(b)    <>
(c)     $
(d)    <<<


Chapter-4: Functions


53.   What is the correct way to create a function in PHP?
a.       function myFunction()     
b.      new_function myFunction()      
c.       create myFunction()

54.  $value = pow(3,3);

echo $value;

What is the result of $value
a.       9
b.      18
c.       27
d.      21

55.  $price = 10; $tax = 5; $total =50;
function calcSalesTax($price, $tax)
{
$total = $price + ($price * $tax); }

echo "Total cost: $total";

What is the output?
a)      Total cost: 50
b)      Total cost: 30
c)      Total cost: 60
d)      Total cost: 70

56.  function calcSalesTax($price, $tax=.02)
{
$total = $price + ($price * $tax);
echo "Total cost: $total";
}

$price = 10;

calcSalesTax($price);

What is output?
a)      Total cost: 10.50
b)      Total cost: 10.20
c)      Total cost: 10.02
d)      Error

57.   Write the output of the following code?
<?php
Function add()
{
STATIC $n=5;
$n=$n+5;
echo $n;
}
add();
?>

a)      5
b)      55
c)       10
d)      None of the above

58.   <?php
function zz(& $x) {
$x=$x+5;
}
?>
$x=10;
zz($x);
echo $x; ?>
a)      5
b)      0
c)       15
d)      10

59.   What does this function do: <?php function my_func($variable) {return (is_numeric($variable) && $variable % 2 == 0);}?>       
a.       tests whether $variable is a number and ends in 2       
b.      tests whether $variable ends in 2       
c.       tests whether $variable is a number and contains 2       
d.      tests whether $variable is an even number 

60.   What is output?
<?php
Function a($a="",$b)
{
$d=$a + $b;
Print $d;
}
a(30,40);
?>
(a)     30
(b)    40
(c)     ""40
(d)    70

61.   What is output?
<?php
function sonna($a,$b) {
                    function sonu($c) {
                                         $g=  $c*.76;
                                         return($g);
                                         }
$tot=$a+$b;
print sonu($tot);                          
}                                      
sonna(5,6);
?>
(a)     8.36
(b)    5
(c)     6
(d)    9.36

62.   When function parameter ends?
(a)     when function exit
(b)    When program exit
(c)     When method exit
(d)    When class exit


63.   Write the output of the following code?
Function add() {
STATIC $n=5;
$n=$n+5;
echo $n;
}
add(); ?>

(a)     5
(b)    5+5
(c)     10
(d)    $n

64.   Break statement is used to …………..?
(a)     end loop execution
(b)    start loop execution
(c)     break execution
(d)    None of the above

65.   Which type of variable holds the value after the exit function block?
(a)     object
(b)    static
(c)     dynamic
(d)    all

66.   What is output?
<?php
Function a($a,$b) {
$d=$a+$b;
Print $d;
}
$m="a";
$m(30,40);
?>

(a)     30
(b)    40
(c)     $d
(d)    70

67.   Which key word is used as constant in php?
(a)     VALUE
(b)    GLOBAL
(c)     STATIC
(d)    FUNCTION

68.   How many values for directives are used in httpd.conf?
(a)     4
(b)    5
(c)     6
(d)    7

69.   Which keyword is used to make a variable static?
(a)     STATIC
(b)    static
(c)     global
(d)    none of the abavo

70.   There are how many types of array?
(a)     2
(b)    3
(c)     4
(d)    5

71.   Which is the maximum number according to natsort of the following..
10, 5,7,20, 3

a)      20
b)      10
c)       5
d)      7
72.   Which operator is used to use a method of a class without object?
a)      $
b)      @
c)       ;
d)      ::

73.   What kinds of logic pattern?
A.      three
B.      two
C.      four
D.      five

74.   What is output?
Function a($b,$c) {
$b=10;  $c=20;
$d=$b+$c;
Print $d;
}
a(30,40); ?>

(a)     70
(b)    40
(c)     30
(d)    20


Chapter-5: Arrays


1.      $colors = array("red","blue","green");
list($red, $blue, $green) = $days;

echo $red . " is one of Element of " .'$colors';

a)      red is one of Element of $colors
b)      red is one of Element of $days
c)      red is one of Element of $colors
d)      Notice: Undefined variable

2.      <?php
function UserProfile()
{
$user[] = "Mahabub";
$user[] = "ceo@mahabub.com";
$user[] = "0174585696";
}
list($name, $email, $phone) =
UserProfile();
echo "Name: $name, email: $email, phone: $phone";
?>

Write down what is the output?






3.      $state[1] = "Pennsylvania";

$state[2] = "New Jersey";

$state[49] = "Hawaii";

print_r($state);


a)      Array ( [1] => Pennsylvania [2] => New Jersey [49] => Hawaii )
b)      Array ( [1] => Pennsylvania [2] => New Jersey [3] => Hawaii )
c)      Array ( [0] => Pennsylvania [1] => New Jersey [2] => Hawaii )
d)      Array ( [49] => Pennsylvania [2] => New Jersey [1] => Hawaii )


4.      $numbers = range(1, 6);

Print_r($numbers);

What is output?

a)      Array ( [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 )
b)      Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 )
c)      Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )
d)      Array ( [1] => 0 [2] => 1 [3] => 2 [4] => 3 [5] => 4 [6] => 6 )


5.      $states = array("Florida");
$state = "Ohio";
printf("\$states is an array: %s <br />", (is_array($states) ? "TRUE" : "FALSE"));

What is output
a)      $states is an array: TRUE
b)      $states is an array: FALSE

6.      $states = array("Ohio", "New York");
array_unshift($states, "California", "Texas");

What is the current status of $states?
a)      array("California", "Texas", "Ohio", "New York")
b)      array("Ohio", "New York", “California", "Texas")
c)      array("California", "Texas”)
d)      array("California", "Ohio", "New York")

7.       creates an array by using one array for keys and another for its values
A. Array_Splice 
B. . array_combine
C. Array_Fill()

8.       Which statement is true about Array?
A. An array is traditionally defined as a group of items that share certain characteristics
B. As array values can be other arrays, trees and multidimensional arrays are also possible.
C. Offer considerable practical value to the programmer and are used to divide an otherwise complex.

9.       Which function use to remove a portion of the array and replace it with something else
A.      Array_Splice 
B.      array_combine
C.      Array_Fill()

10.   How to remove duplicate from an array?
A.      Array_Duplicate
B.      Array_Unique 
C.      Array_Push()

11.   <?php
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count($a); ?>
What will be the output
A.       3 
B.       4  
C.       2

12.   Which function use to check if a value exists in an array?
A.       In_Array()
B.       Array_check() 
C.       Array_Fill()

13.   Which function use to sort an array by key in reverse order
A.       Sort()
B.       ksort() 
C.       Krsort()
D.  array_reverse()

14.   How to searches the array for a given value and returns the corresponding key if successfully?
A.      Array_in()
B.      Search() 
C.      Array_Search()

15.   <?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_pop($stack);
print_r($stack);
?>
What will be the output?
a.       [0] => orange    [1] => banana    [2] => apple
b.      [0] => orange    [1] => banana    [2] => raspberry
c.       [0] => raspberry [1] => banana    [2] => apple

16.   <?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
What will be the output?
A. [0] => XL    [1] => gold  [2]=>Size
B. [0] => XL    [1] => gold

17.   ksort— Sort an array with a user-defined comparison function and maintain index association
A.      True
B.      False

18.   ________Return the current key and value pair from an array and advance the array cursor.
A.      Prev 
B.      Next   
C.      Last 
D.      Each

19.    Which construct used to make simultaneously variable assignments from values extracted from an array?

A.      Array_list() 
B.      list () 
C.      list_array()

20.   A key may be either an integer or a string. If a key is the standard representation of an integer
A.      True 
B.      False

21.   Which function adds element to the front of array?
A.      Shift() 
B.      Unshift() 
C.      push()
D.      Pop()



22.   What is the output?
<?php
$array = array(10,20,10,30,20,40,20,40);
$a =array_count_values($array);
print_r($a);
?>
(a)   Array ( [2] => 10 [3] => 20 [1] => 30 [2] => 40 )
(b)   Array ( [0] => 10 [1] => 20 [2] => 10 [3] => 30[4] => 20[5] => 40[6] => 20[7] => 40)
(c)    Array ( [10] => 2 [20] => 3 [30] => 1 [40] => 2 )
(d)    none of the above


23.   <?php
$color=array("red","yellow","white");
$x=in_array("black",$color);
if($x==0)
echo "good bye";
if($x==1) echo "Hello";
?>
a)      Hello
b)      Error
c)       good bye
d)      None of the above


24.   <?php
$x=array("aaa","","ccc","ddd","");
$y=array_unique($x);
echo count($x) . "," . count($y);
?>
a)      3,1
b)      3,3
c)       5,5
d)      5,4

25.   <?php
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?>
a)      8
b)      5
c)       7
d)      28


26.   <?php
$x=array(1,3,2,3,7,8,9,7,3);
$y=array_count_values($x);
echo $y[8];
?>
a)      43
b)      1
c)       8
d)      6

27.   Which of the following function is used to pick one or more random values from PHP Array?
a)      array_rand()
b)      array_random()
c)       Random_array()
d)      Rand_array()

28.   <?php
$x=array("aaa","ttt","www","ttt","yyy","tttt");
$y=array_count_values($x);
echo $y[ttt];
?>
a.       2
b.      3
c.       1
d.      4


29.   What will be the output of below code ?
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
unset($arr);
echo var_dump($arr);  ?>

a)      42
b)      56
c)       Null
d)      x=42

30.   Which of the following is/are the example(s) of compound data type?
(a)   $a[0]=4.765
(b)   $a=4
(c)    $$a=4.77
(d)    None

31.   What is the return of shuffle?
(a)     void
(b)     boolean
(c)      string
(d)     none of them

32.   There are how many field scope?
(a)     4
(b)    5
(c)     6
(d)    7

33.   There are how many categories of sorting flag in array_multisort?
(a)     1
(b)    2
(c)     3
(d)    4

34.   What is the return type of arsort()?
(a)     void
(b)    boolean
(c)     string
(d)    none of them

35.   There are how many method scope in php?
(a)     4
(b)    5
(c)     6
(d)    7

36.   Which scope is present in method not in field?
a)      public
b)      private
c)       abstract
d)      protected

37.   What is the default scope method in php?
(a)     public
(b)    private
(c)     protected
(d)    abstract

38.   Which key word is used to declare a class or function?
(a)     abstract
(b)    public
(c)     private
(d)    protected
39.   Where type hinting works in?
A.      class
B.      object
C.      method
D.      function

40.   Which is the maximum number according to natsort of the following..
10, 5,7,20, 3
A.      20
B.      10
C.      5
D.      7

41.   What is the output?
<?php
$array = array(10,20, 30, 40);
print_r(array_pad($array,-8,0));
?>

(a)   [0]=> 0, [1]=> 0, [2]=> 0, [3]=> 0, [4]=> 10, [5]=> 20, [6]=> 30, [7]=> 40
(b)   [0]=> 10, [1]=> 20, [2]=> 30, [3]=> 40, [4]=> 0, [5]=> 0, [6]=> 0, [7]=> 0
(c)    [0]=> 10, [1]=> 20, [2]=> 0, [3]=> 0, [4]=> 0, [5]=> 0, [6]=> 30, [7]=> 40
(d)    none of the above


42.   Which of following array function randomly recorder the array elements?
a)      strstr()
b)      usort()
c)       natsort()
d)      shuffle()

Chapter-6-7: Object Oriented PHP



1. Which of the following is not a part of OOP?
A. Type checking
B. Inheritance
C. Polymorphism
D. Encapsulation

2. Which one of the following terms must relate to "Object"
A. Static allocation.
B. Specific instance of the class models.
C. Code component.
D. Attributes of a class.

3. Abstract class objects never have to be instantiated.
A. True
B.  False

4. A constructor is used to...
A. Free memory.
B. Initialize a newly created object.
C. Import packages.
D. Create a JVM for applets.

5. What is the purpose of the Properties?
A. To build a user interface.
B. To build Object
C. to describe some aspect of a class.
D. Noe of the Above

6.  Which of the following line is used to create new Object?
A. employee $emp=new employee();
B. $employee =new Employee();
C. employee =new $Employee();


7. Which of the following are class property scope?
A. Private
B. Public
C. Declare
D. Protected

8.  PHP support six method scope. Which of the following are method scope.
A. Private
B. Public
C. Declare
D. Protected


9.  How to declare a constructor?
A. function __construct($abc)
{
}
B. function  construct($abc)
{
}
C. function  employee($abc)
{
}

10. Which of the following statements are true  about constructors?
A. Constructor is defined as block of code that automatically executes at the time of object instantiation.
B.  Constructor can accept parameters.
C. Constructor ensures that the object being passed to the method.
B. Class constructors cannot call on other constructors.

11. How to determine whether an object is an instance of a class?
A. using new keyword
B. using instanceof keyword
C. using static keyword

12. The ability to implement polymorphism through method overloading is not supported by php
A. True  B. False

13. What is the default scope method in php?
(a)   public
(b)   private
(c)    protected
(d)    abstract

14. Which key word is used to declare a class or function?

(a)   abstract
(b)   public
(c)    private
(d)    protected

15. Where type hinting works in?
a)      class
b)      object
c)       method
d)      function


16. There are how many method scopes in php?
(a)     4
(b)    5
(c)     6
(d)    7

17.Which scope is present in method not in field?

(a)     public
(b)    private
(c)     abstract
(d)    protected

18. Which line of code use to clone a object?
A.      $drone1=new Corproate_Drone()
$drone2=copy $drone1
B.      $drone1=new Corproate_Drone()
$drone2=object $drone1
C.      $drone1=new Corproate_Drone()
$drone2=clone $drone1


19. Which class defines a general specification for implementing a particular service, declaring the required functions and constants without implementation code?
A.      constants
B.      Interface
C.      Abstract


20. Which methods are special in that they are declared only within a parent class but are implement child class?
A.      Static method
B.      Constants Method
C.      Private method
D.      Abstract Method


21. What are the two common characteristics shared by all objects?
A.      Methods and interfaces
B.      State and behavior
C.      Methods and messages


22. Instance of key word verifies………?
(a)     class
(b)    object
(c)     object's class
(d)    None of the above
23. How can you access a field of a class?
(a)     $this=filed name
(b)    $this->filed name
(c)     $variable=filed name
(d)    None of the above

24. Which option is false for constructor?
(a)     can accept parameter
(b)    can call other method
(c)     can call other constructor
(d)    None of the above

25. What is the default scope of any variable and function?
(a)     public
(b)    static
(c)     privet
(d)    protected

26. Which is/are the fundamental concept of object oriented programming?
(a)     inheritance
(b)    polymorphism
(c)     encapsulation
(d)    All of the above

27. Which type of scope is only accessible by subclass?
(a)     static
(b)    public
(c)     protected
(d)    None of the above

28. Which option(s) is/are true for object oriented programming?
A. Code reusability                     B. Data hiding.
C. Support multiple inheritances.
D. All

29. Which option is false for constructor?
A. can accept parameter          B. can call other method
C. can call other constructor   D. none

Chapter- 8: Error Handling



1. Which statement is/are true about Exception Handling?
A. Definition of error.
B. Exceptions are used to change the normal flow of a script if a specified error occurs.
C. Exceptions should only be used with error conditions


2. How to get the name of the file throwing the exception?
A. getFile()
B. getName()
C. getCode()
D. getMessage()


3. How to get the line number for which the exception is thrown?
A. getFile()
B. getName()
C. getCode()
D. getLine()


4. Which of the following statement is the default exception constructor?
A. thrown Exception()
B. throw new Exception()
C. throw new $Exception()


5. During the developing stage, which of the directive used for all errors to be reported?
A.  error_reporting=All_error & E_strict
B. E_All | E_Parse
C.  error_reporting=E_All  & E_STRICT
D. None of the above


6.  Which features determine the language’s  error – handling behavior.
A. Error Logging
B. Exception Handling
C. Configuration
D. All of the above


7. How many methods can be used by default constructor of exception class?
(a)     2
(b)    3
(c)     4
(d)    None of the above

8. log_errors is related to which type of directive?
(a)     log_errors
(b)    error_ log
(c)     log_error_max
(d)    None of the above

9. How many e warning level in php?
(a)     10
(b)    20
(c)     30
(d)    40


10. Which reporting level is used to generate compile time fatal error?
A. E_ERROR                      B.  E_CORE_ERROR
C. E_COMPILE_ERROR   D. E_USER_ERROR

Chapter- 9: Regular Expressions


1. PHP supported two regular expressions –
(a)     POSIX 
(b)    Unix
(c)     Perl
(d)    Pear

2. Which statement is true about Regular Expressions?
A.      describing or matching data according to defined syntax rules
B.      allowing to slice and dice text in nearly every conceivable fashion.
C.      Used for searching data


3. Which function executes a case-sensitive search of a string for defined pattern?
A. eregi()
B. ereg()
C. pereg()
D. peregI()


4. Which function executes a case-insensitive search of a string for defined pattern?
A. eregi()
B. ereg()
C. pereg()
D. peregI()


5. Which function used to find and replace  pattern with a replacement string.
A. eregi_replace()
B. ereg()
C. replace_string()
D. peregI()


6. How to divide a string into various elements?
A. using  string_divide()
B. Substring()
C. Split()
D. Str()


7. Which function searches all elements of an array, returning an array()
A. using  array_Search()
B. Search()
C. preg_grep()
D. Str()

8. ___________  function searches a string for a specific pattern, returning TRUE if it exists.
A. preg_search()
B. preg_find()
C. preg_match()


9. Spliting a string into various elements based on Case-Insensitive pattern_
A. preg_search()
B. preg_find()
C. ereg_split()
D. preg_split()


10.  How to determine the length of a string?
A. strlen($str)
B. strLength($str)
C. strLength($str)
D. None of the above


11. Comparing two strings case insensitively, which of the following function is used?
A. strCompare($str1,$str2)
B. strcasecmp($str1,$str2)
C. compare($str1,$str2)
D. None of the above

12.  How to convert a string to lowercase?
A. Stringtolower($str)
B. tolower($str)
C. strtolower($str)
D. lower($str)


13. How to convert a string to Uppercase?
A. Stringtolower($str)
B. tolower($str)
C. strtoupper($str)
D. lower($str)


14. How to capitalize each word?
A. Stringtoupperr($str)
B. tocapitalize($str)
C. strtoupper($str)
D. ucword($str)


15. Which function use to convert html tag to plain text?
A. strip_tags($input)
B. strip_html ($input)
C. tag_strip($input)
Ans: A

16. what is the return value of this substr function?
<?php
$rest = substr("abcdef", -1);
$rest = substr("abcdef", 0, -1);
?>
a) f,abcde
b) a,fedcb
c) b,abcdef
d) a,abcde

17. To match only numerical character and contain at least two characters which regular expression is/are correct?
A. ([0-9]{2,10})                      B. ([:alnum:]{2,})
C. ([0-9][a-zA-Z]{2,})            D. ([0-9][^a-zA-Z]{2,})

18. Which of the following will return true for the regular expression “(^.{5}$)”
A. 55555                                 B. d22323
C. 232y3y                               D. 45gth

19. Comparing two strings case insensitively, which of the following function is used?
A. strCompare($str1,$str2)
B. strcasecmp($str1,$str2)
C. compare($str1,$str2)
D. None of the above

20. How to divide a string into various elements?
A. using  string_divide()
B. Substring()
C. Split()
D. Str()


21. Which function searches all elements of an array, returning an array()
A. using  array_Search()
B. Search()
C. preg_grep()
D. Str()


22. ___________  function searches a string for a specific pattern, returning TRUE if it exists.
A. preg_search()
B. preg_find()
C. preg_match()

23. Spliting a string into various elements based on Case-Insensitive pattern_
A. preg_search()
B. preg_find()
C. ereg_split()
D. preg_split()


Chapter 10: File and OS


1. <?php
$x=dir(".");
while($y=$x->read())
{
echo $y. "<br>"
}
$x->close();
?>
What is the following output?
a) display all folder names
b) display a folder content
c) display content of the all drives
d) Parse error

2.       What is the function used to retrieve file name and extension?
a)      basename()
b)      dirname()
c)       disk_total_space()
d)      file_base()

3.       What is the function used to retrieve file directory path?
Ans: dirname()
4.       What is the function used to show the total space of disc?
a)      disc_total_space()
b)      disk_free_space()
c)       disk_space()
d)      total_disk_space()

5.       What is the function used to show the free for used/useful space?
Ans: disc_free_space()
6.       What is the function used to find out the file last access time?
Ans: fileatime()
6.What is the function used to find out the file last changed time?
                                Ans-filectime()
7.What is the function used to find out the file last modificationtime time?
                                Ans-filemtime()
8.What is the mode used to read only file pointer placed beginning of the file?
                                Ans-R
9.What is the mode used to read and write file pointer placed beginning of the file?
                                Ans-r+
10.What is the mode used to write only  return file content and the file pointer beginning of the file before writing?
                                Ans-W
11.What is the mode used to read and write only  return file content and the file pointer beginning of the file before writing?
                                Ans-w+
12.what mode used to write only the file pointer at the end of the file?
                                Ans-A
13.what mode used to read and write only the file pointer at the end of the file?
                                Ans-a+
14.what mode used to create and open file for writing?
                                Ans-X
15.what mode used to create and open file for writing and writing?
                                Ans-x+
16.what function used to open a file?
                                Ans-fopen()

17.what function used to close a file?
                                Ans-fclose()
18.what function used to capable for reading file into an array?
                                Ans-file()

19.what function used to reads the content of file into a string?
                                Ans-file_get_content()

20.what function used to read the length of character doesnot stop newline?
                                Ans-fgetcsv()
21.what function return the certain number of character?
                                Ans-fgets(),fgetss()
22.what function used to read  single character of open resource?
                                Ans-fgetc()
23.what function used to read  the length of  character by specific  handle?
                                Ans-fread()
24.what function used to read  an certain file?
                                Ans-readfile()
25.what function used to parsing a resource in accordance with a predefine format?
                                Ans-fscanf()
26.what function used to output the content of a string variable ?
                                Ans-fwrite()
27.what function return each element in the directory?
                                Ans-readdir()
28.what function used to attempt remove the specified directory?
                                Ans-rmdir()
29.what function used to closed directory stream?
                                Ans-closedir()
30. Function for Reading a File into an Array
a)      file()
b)      file_get_contents()
c)       file_put_contents()
d)      fread()
e)      fgets()

Chapter 11: PEAR



Chapter 12: Date and Time


1)
Which of the following functions do not return a timestamp?
A) time()
B) date()
C) strtotime()
D) localtime()
E) gmmktime()

2)
The getdate() function returns
A) An integer
B) A floating-point number
C) An array
D) A string
E) A Boolean

3)
.......... Returns the time of sunrise for a given day / location
A) datesunrise()
B) date_sunrise()
C) date-sunrise()
D) date.sunrise()

4)
What will the following script output?
<?php
$time = strtotime ('2004/01/01');
echo date ('H:\i:s', $time);
?>
A) 00:00:00
B) 12:00:00
C) 00:i:00
D) 12:i:00
E) -1

5)
................Checks a date for numeric validity.
A) check_date
B) verifydate
C) Verify_date
D) checkdate



6)
What is the difference, in seconds, between the current timestamp in the GMT time zone and the current timestamp in your local time zone?
A) It depends on the number of hours between the local time zone and GMT
B) There is no difference
C) The two will only match if the local time zone is GMT
D) The two will never match
E) None of the above

7)
You must make a call to ................... to specify what time zone you want calculations to take place in before calling any date functions.
A) date_default_timezone_set()
B) datedefault_timezone_set()
C) date_defaulttimezone_set()
D) date_default_timezoneset()

8)
What would happen if the following script were run on a Windows server set to Moscow, Russia’s time zone?
<?php
echo gmmktime(0, 0, 0, 1, 1, 1970);
?>
A) It would output the number 0
B) It would output the number -1
C) It would output the number 1
D) It would raise an error
E) It would output nothing

9)
The ......... function parses an English textual date or time into a Unix timestamp
A) strtodate()
B) stroftime()
C) strtotime()
D) str_to_time()

10)
................ Formats a local time or date according to locale settings.
A) strftime
B) strgtime
C) strhtime
D) stritime





Chapter 15: Handling file uploads


1.---------super global array, used to handle file upload data.
Ans: $_FILES
2.PHP’S built in file upload function is ------------and -----------------------.
Ans: is_uploaded_file() and move_uploaded_file().
3.The ------------ input directive determiners the maximum amount of time , in seconds, that a php script will spend attempting to parse input before registering a fatal error.
Ans: Max_input_time
4. the ------------------------directive sets an upper limit on the number of files which can be simultaneously uploaded.
Ans: max_file_uploads
5. The ------------------places an upper limit on the size of data submitted via the POST method.
Ans: post_max_size
6. The -----------------directive determines the maximum size in megabytes of an uploaded file.
Ans: upload_max_filesize
7. The --------function determines whether a file specified by the input parameter filename is uploaded using the POST method.
Ans: is_uploaded_file()
8. The -------function provides a convenient means for moving an uploaded file from the temporary directory to a final location.
Ans: move_uploaded_file()
9. the Web’s HTTP protocol is primarily involved in the transfer of web pages froma server to the user’s browser.
Ans: HTTP
1. Which of the following function provides a convenient means for moving an uploaded file from file’the temporary directory to a final location?
a)      Move_uploaded_files()
b)      Move_files();
c)       Move_file_Uploaded();

2. How to get the file size, in bytes of the file uploaded from the client Machine?
a)      A.$_Files[‘userfile’]_size Variable
b)      B.$_Files[‘userfile’][‘size’] variable
c)       C.$_Files[‘size’][‘tempname’]
d)      All of them

3._____________ supper global stores a variety of information pertinent to file uploaded to the server via a PHP Script.
A.      $_File_uploaded
B.      $_Files
C.      $_Files_Array()

4. Which of the following function determine whether a file specified by the input parameters filename is uploaded using the post method?
a)      Uploaded_file()
b)      File_uploaded()
c)       Is_uploaded_file()
d)      None of them

5. Which of the following directive determines the maximum size in megabytes of an uploaded file?
A.      Uploaded_file()
B.      File_uploaded()
C.      Max_Size()
D.      Upload_max_size()

Chapter 16: Networking



1.       ____________________ allows to use domain names in place of the corresponding IP Address?
A.      FTP
B.      DNA
C.      DNS
D.      DNN

2.       How to check the domain name exists or not?
A.      Use checkDomain()
B.      Use chechkdnsrr()
C.      Use DNS_Checking()


3.       Which of the following function returns an array consisting of various DNS resource records pertinent to a specific domain?
A.      Dns_record()
B.      Dns_get_record();
C.      Domain_get_record()

4.       Which of the following function returns the port number of a specific service?
A.      Dns_record()
B.      Get_port_number();
C.      Getserverbyname()

5.       Which of the following are not a mail function in PHP?
A.      Mail_send_to
B.      Mail()
C.      Send()
D.      Sendmail()

6.      To send a mail, Which of the following statement should be used?
A.     Send_mail("test@example.com", "This is a subject", "This is the mail body")
B.     mail("test@example.com", "This is a subject", "This is the mail body")
C.     mailto:("test@example.com", "This is a subject", "This is the mail body")


Chapter 18: Session Handlers


1.      A session is started simply by calling session_start like this: session_start();
A.     True       B. False

2.      Erase the session variables from memory, and even completely wipe the session from storage done through the
A.     session_unset() 
B.     session_destroy()
C.     Session_none()
D.     Session_fresh

3.      Which function completely removing the session from the storage mechanism?
A.     session_unset() 
B.      session_destroy()
C.      Session_none()
D.     Session_fresh

4.      Which function completely removing the session from the memory?
A.     session_unset() 
B.     session_destroy()
C.     Session_none()
D.     Session_fresh

5.      Which function offers a particularly convenient method for manually encoding
all session variables into a single string?
A.     session_unset() 
B.      session_destroy()
C.      session_encoding()
D.     session_encode()


6.      Encoded session data can be decoded. Which function offers a particularly convenient method for manually decode all session variables?
A.     session_unset() 
B.     session_destroy()
C.      session_decoding()
D.     session_decode()

7.      Assigning each visitor a unique identifying attribute, Known as---------?

(a)   CookieID
(b)   SeesionID
(c)    ClientID
(d)    None of them


8.      How to sorting bits of information on the client's Machine?

(a)   Use session
(b)   Use cookies
(c)    Use session variables
(d)    None of them


9.      Which directive determine the number of seconds that cached session pages are made available?

(a)   session_cache_expire
(b)   Cookies cache_expire
(c)    Session_expire
(d)    None of them



10.  Which function create a new session of continues a current session?

(a)   SessionStart
(b)   Session_Start
(c)   Start_session
(d)   all of them


 
11.  How to erases all session variable stored in the current session?

(a)   Unset_Session
(b)   Session_Unset
(c)    Session_destroy
(d)    None of them






12.  Which directive determine how the session information will be stored?

(a)   Unset_session
(b)   session.save_handler
(c)    session.save_file
(d)    None



13.  How many session configuration directives are responsible for determining the behavior of PHP session handling? 

(a)   22
(b)   34
(c)    25
(d)    28



14.  Which are the true in the following bellow?

(a)   HTTP defines the rules used to transfer text, graphics, video and all other data via the world wide web
(b)   Session handling remains one of the coolest and most talked about features of the language.
(c)    In relational data base terms, you can think of the SID as the primary key that ties all other user attribute together.
(d)    cookie define your own customized management play in using a MYSQL database.



15.  What is cookie?

(a)   The practices of storing kilobits of information on the client machine in what are commonly called cookie.
(b)   The practices of storing gigabytes of information on the server machine. in what are commonly called cookie.
(c)    The practices of storing information on the client machine. in what are commonly called cookie.
(d)    The practices of storing bits of information on the client's machine in what are commonly called cookie.

16.  What is stateless protocol?

(a)   The heart of developers who wish to create complex web base application.
(b)   must able to adjust to user specific behavior preferences.
(c)    Each request is processed without any knowledge of any prior of future request.
(d)    This is accomplished by assigning each site visitor a unique identifying attribute.




17.  When a user in a web site, the server store information about the user such as their preference, in a cookie and send it to browser.

define the true or false.

(a)   True
(b)   false


18.  What are true in the following sentences/

(a)   PHP can configuration to autonomously control the entire session-handling with little programing interaction.
(b)   An existing session is located by finding the SID either within the requested URL or within a cookie.
(c)    By closing session is located by finding the SID either within the requested URL or within a cookie.
(d)    Twenty five session configuration directives are responsible for the determining the behavior of PHP's session handling functionality.



19.  How can we retrieve cookie information via the super global? 

(a)   $_REQUEST['session id']
(b)   $_COOKIE['session id']
(c)    $_POST['session id']
(d)    $_GET['session id']




20.  How many ways the session information will be stored?

(a)   four ways
(b)   five ways
(c)    six ways
(d)    seven ways




21.  What is the default value of session .save.handling() function?

(a)   mm
(b)   sqlite
(c)    user
(d)    files



22.  How can we defined session .save_path()syntax?

(a)   using the syntax N;/path
(b)   using the syntax M;/path
(c)    using the syntax D;/path
(d)    using the syntax V;/path



23.  When session use_cookies is enabled, there is no need to explicity call cookie_setting function?  

(a)   true
(b)   false





24.  How many values are available in the session.cache_limter() function?

(a)   four values such as nocache, private, private-no-expire, public
(b)   four values such as none, private, private-no-expire, public
(c)    Three values such as none,nocache, private
(d)    Two values such as none, private



25.  What is the default value of the session.cache_expire()?

(a)   120
(b)   180
(c)    340
(d)    890



26.  How many SID consist of session.hash()function?

(a)   124 and 140 bits
(b)   128 and 160 bits
(c)    180 and 170 bits
(d)    200and 205 bits



27.  What's function will start or resume a session for every PHP _enable page?

(a)   session_start();
(b)   session_unset();
(c)    session_destroy();
(d)    session_auto_start();


No comments:

Post a Comment