Arrays & Function

Descripción

Test sobre Arrays & Function, creado por Zarina Kiyakhmetova el 20/12/2018.
Zarina Kiyakhmetova
Test por Zarina Kiyakhmetova , actualizado hace más de 1 año
Zarina Kiyakhmetova
Creado por Zarina Kiyakhmetova hace alrededor de 7 años
36
1

Resumen del Recurso

Pregunta 1

Pregunta
1. Which one of the following is the right way of defining a function in PHP?
Respuesta
  • a) function { function body }
  • b) data type functionName(parameters) { function body }
  • c) functionName(parameters) { function body }
  • d) function fumctionName(parameters) { function body }

Pregunta 2

Pregunta
2. Type Hinting was introduced in which version of PHP?
Respuesta
  • a) PHP 4
  • b) PHP 5
  • c) PHP 5.3
  • d) PHP 6

Pregunta 3

Pregunta
3. What will happen in this function call?
Respuesta
  • a) Call By Value
  • b) Call By Reference
  • c) Default Argument Value
  • d) Type Hinting

Pregunta 4

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Error
  • b) 0
  • c) 42
  • d) 84

Pregunta 5

Pregunta
Which of the following are valid function names? i) function() ii) €() iii) .function() iv) $function()
Respuesta
  • a) Only ii)
  • b) None of the mentioned.
  • c) All of the mentioned.
  • d) iii) and iv)

Pregunta 6

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) I am b
  • b) I am bI am a
  • c) Error
  • d) I am a Error

Pregunta 7

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) I am b
  • b) I am bI am a
  • c) Error
  • d) I am a Error

Pregunta 8

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) helloblabla
  • b) Error
  • c) hello
  • d) helloblablablabla

Pregunta 9

Pregunta
A function in PHP which starts with __ (double underscore) is know as..
Respuesta
  • a) Magic Function
  • b) Inbuilt Function
  • c) Default Function
  • d) User Defined Function

Pregunta 10

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Error
  • b) $msg
  • c) 0
  • d) Will this work

Pregunta 11

Pregunta
Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
Respuesta
  • a) func_get_argv()
  • b) func_get_argc()
  • c) get_argv()
  • d) get_argc()

Pregunta 12

Pregunta
Which one of the following PHP functions can be used to find files?
Respuesta
  • a) glob()
  • b) file()
  • c) fold()
  • d) get_file()

Pregunta 13

Pregunta
Which of the following PHP functions can be used to get the current memory usage?
Respuesta
  • a) get_usage()
  • b) get_peak_usage()
  • c) get_memory_usage()
  • d) get_memory_peak_usage()

Pregunta 14

Pregunta
Which of the following PHP functions can be used for generating unique ids?
Respuesta
  • a) uniqueid()
  • b) id()
  • c) md5()
  • d) mdid()

Pregunta 15

Pregunta
Which one of the following functions can be used to compress a string?
Respuesta
  • a) zip_compress()
  • b) zip()
  • c) compress()
  • d) gzcompress()

Pregunta 16

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) 1
  • b) 2
  • c) 3
  • d) 4

Pregunta 17

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) 106
  • b) 103
  • c) 104
  • d) 209

Pregunta 18

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Hello World
  • b) Hello World
  • c) Hell o wo rld
  • d) World

Pregunta 19

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) I love my country
  • b) i love my Country
  • c) I love my Country
  • d) I Love My Country

Pregunta 20

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) welcome to India
  • b) welcome to india
  • c) Welcome to India
  • d) Welcome to india

Pregunta 21

Pregunta
PHP’s numerically indexed array begin with position ___________
Respuesta
  • a) 1
  • b) 2
  • c) 0
  • d) -1

Pregunta 22

Pregunta
Which of the following are correct ways of creating an array? i) state[0] = “karnataka”; ii) $state[] = array(“karnataka”); iii) $state[0] = “karnataka”; iv) $state = array(“karnataka”);
Respuesta
  • a) iii) and iv)
  • b) ii) and iii)
  • c) Only i)
  • d) ii), iii) and iv)

Pregunta 23

Pregunta
What will be the output of the following php code?
Respuesta
  • a) karnataka 11,35,000
  • b) 11,35,000
  • c) population 11,35,000
  • d) karnataka population

Pregunta 24

Pregunta
Which function will return true if a variable is an array or false if it is not?
Respuesta
  • a) this_array()
  • b) is_array()
  • c) do_array()
  • d) in_array()

Pregunta 25

Pregunta
Which in-built function will add a value to the end of an array?
Respuesta
  • a) array_unshift()
  • b) into_array()
  • c) inend_array()
  • d) array_push()

Pregunta 26

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) True
  • b) 1 c) False d) 2a) True b) 1
  • c) False
  • d) 2

Pregunta 27

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) orangebanana
  • b) appleorange
  • c) orangeorange
  • d) appleapple

Pregunta 28

Pregunta
Which function can be used to move the pointer to the previous array position?
Respuesta
  • a) last()
  • b) before()
  • c) prev()
  • d) previous()

Pregunta 29

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) 3
  • b) 4
  • c) 5
  • d) 6

Pregunta 30

Pregunta
Which function returns an array consisting of associative key/value pairs?
Respuesta
  • a) count()
  • b) array_count()
  • c) array_count_values()
  • d) count_values()

Pregunta 31

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) I like Volvo, Toyota and BMW
  • b) I like Volvo, BMW and Toyota
  • c) I like BMW, Volvo and Toyota
  • d) I like Toyota, BMW and Volvo

Pregunta 32

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( Peter Ben Joe )
  • b) Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
  • c) Array ( 35 37 43 )
  • d) Array ( [35] => Peter [37] => Ben [43] => Joe )

Pregunta 33

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
  • b) Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
  • c) Array ( [A] => 6 [Cat] => 1 [Dog] => 2 [Tiger] => 1 )
  • d) Array ( [A] => 2 [Cat] => 1 [Dog] => 4 [Tiger] => 1 )

Pregunta 34

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [d] => yellow )
  • b) Array ( [i] => orange )
  • c) Array ( [h] => orange )
  • d) Array ( [d] => yellow [h] => orange )

Pregunta 35

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [a] => blue [b] => yellow [c] => red [d] => green )
  • b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
  • c) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
  • d) Array ( [a] => red [b] => green [c] => blue [d] => yellow )

Pregunta 36

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) india Array ( [a] => china )
  • b) india Array ( [a] => brazil )
  • c) china Array ( [a] => india )
  • d) china Array ( [a] => brazil )

Pregunta 37

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [1] => hello [4] => hello [5] => php ) Array ( [5] => php )
  • b) Array ( [1] => hello [2] => hello [3] => hello [4] => hello ) Array ( [5] => php )
  • c) Array ( [1] => hello [2] => hello [3] => hello [4] => hello [5] => php ) Array ( [5] => php )
  • d) Array ( [1] => hello [2] => hello [3] => hello [4] => hello ) Array ( [1] => php )

Pregunta 38

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Sam is the brother of Bob and Jack
  • b) Sam is the brother of Bob and Bob)
  • c) Sam is the brother of Jack and Bob)
  • d) Error

Pregunta 39

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Sam is the brother of Bob and Bob) $brother
  • b) Sam is the brother of Bob and Bob)
  • c) $brother
  • d) Error

Pregunta 40

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => LA [1] => Paris [2] => Paris )
  • b) Array ( [0] => NYC [1] => LA [2] => Paris)
  • c) Array ( [0] => NYC [1] => LA [2] => Paris [3] => Paris )
  • d) None of the mentioned

Pregunta 41

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [Harry] => 21 [Ron] => 23 [Malfoy] => 21 )
  • b) Array ( [HARRY] => 21 [RON] => 23 [MALFOY] => 21 )
  • c) Array ( [HARRY] => 21 [RON] => 23 )
  • d) Array ( [Harry] => 21 [Ron] => 23 )

Pregunta 42

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
  • b) Array ( [a] => a [b] => b [c] => c [d] => d )
  • c) Array ( [red] => a [green] => b [blue] => c [yellow] => d )
  • d) Array ( [a] => red [b] => green [c] => blue [d] => yellow )

Pregunta 43

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [a] => red [b] => green [c] => blue )
  • b) Array ( [a] => red [b] => green [c] => blue [d] => yellow )
  • c) Array ( [e] => red [f] => green [g] => blue )
  • d) Array ( [a] => red [b] => green [c] => blue [d] => yellow [e] => red [f] => green [g] => blue )

Pregunta 44

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) 024
  • b) 120
  • c) 010
  • d) 060

Pregunta 45

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) a
  • b) b
  • c) c
  • d) d

Pregunta 46

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [1] => Mumbai [0] => Beijing )
  • b) Array ( [0] => NYC [1] => London )
  • c) Array ( [1] => NYC [0] => London )
  • d) Array ( [0] => Mumbai [1] => Beijing )

Pregunta 47

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Lucy
  • b) Peter
  • c) Susan
  • d) Edmund

Pregunta 48

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
  • b) Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
  • c) Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 )
  • d) Array ( [0] => 0 [5] => 5 )

Pregunta 49

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
  • b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
  • c) Array ( [0] => red [1] => green )
  • d) Array ( [0] => blue [1] => yellow )

Pregunta 50

Pregunta
What will be the output of the following PHP code ?
Respuesta
  • a) Key = Harry, Value = 21 Key = Ron, Value = 21 Key = Malfoy, Value = 23
  • b) Key = Harry, Value = 21 Key = Ron, Value = 19 Key = Malfoy, Value = 23
  • c) Key = Harry, Value = 21 Key = Malfoy, Value = 23 Key = Ron, Value = 19
  • d) Key = Ron, Value = 19 Key = Harry, Value = 21 Key = Malfoy, Value = 23

Pregunta 51

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) I like Volvo BMW and Toyota)
  • b) I like Volvo, BMW and Toyota)
  • c) I like Volvo, BMW and Toyota
  • d) I like. Volvo.,. BMW. and) Toyota)

Pregunta 52

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
  • b) Array ( [peter] => 35 [ben] => 37 [joe] => 43 )
  • c) Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
  • d) Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )

Pregunta 53

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )
  • b) Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )
  • c) Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) )
  • d) Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )

Pregunta 54

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( Peter Ben Joe )
  • b) Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
  • c) Array ( 35 37 43 )
  • d) Array ( “[Peter] => 35” “[Ben] => 37” “[Joe] => 43” )

Pregunta 55

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
  • b) Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
  • c) Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
  • d) Array ( [A] => 2 [Cat] => 1 [Dog] => 1)

Pregunta 56

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [d] => yellow )
  • b) Array ( [c] => blue )
  • c) Array ( [a] => red )
  • d) Array ( [e] => yellow )

Pregunta 57

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [3] => blue [4] => blue) Array ( [0] => red )
  • b) Array ( [4] => blue [5] => blue [6] => blue) Array ( [0] => red )
  • c) Array ( [3] => blue [4] => blue [5] => blue [6] => blue ) Array ()
  • d) Array ( [3] => blue [4] => blue [5] => blue [6] => blue ) Array ( [0] => red )

Pregunta 58

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => red [1] => green)
  • b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
  • c) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
  • d) Array ( [0] => blue [1] => yellow )

Pregunta 59

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) green
  • b) red
  • c) blue
  • d) none of the mentioned

Pregunta 60

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => red [1] => green )
  • b) Array ( [0] => green [1] => blue )
  • c) Array ( [0] => red [1] => blue )
  • d) Array ( [0] => blue [1] => blue )

Pregunta 61

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) mango
  • b) error
  • c) peach
  • d) 0

Pregunta 62

Pregunta
Which of the functions is used to sort an array in descending order?
Respuesta
  • a) sort()
  • b) asort()
  • c) rsort()
  • d) dsort()

Pregunta 63

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
  • b) Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
  • c) Error
  • d) Array ( [1] => apple [0] => mango [3] => peach [2] => pear )

Pregunta 64

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
  • b) Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
  • c) Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
  • d) Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )

Pregunta 65

Pregunta
Say in the above question you need to get the array sorted in the manner we humans would have done it i.e picture1 then picture2 etc.. Which of the following function should be used?
Respuesta
  • a) dsort()
  • b) casesort()
  • c) natcasesort()
  • d) naturalsort()

Pregunta 66

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
  • b) Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
  • c) Error
  • d) Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => A [10] => J [11] => Q [12] => K )

Pregunta 67

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => peach )
  • b) Array ( [0] => apple [1] => mango [2] => peach )
  • c) Array ( [0] => apple [1] => mango )
  • d) Array ( [0] => peach [1] => pear [2] => orange )

Pregunta 68

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Error
  • b) Array ( [0] => apple [1] => mango [2] => peach )
  • c) Array ( [0] => apple [1] => mango )
  • d) Array ( [0] => pear [1] => orange )

Pregunta 69

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) 4hello2
  • b) 4
  • c) 2
  • d) 6

Pregunta 70

Pregunta
What will be the output of the following PHP code?
Respuesta
  • a) Array ( [0] => KA [1] => LA [2] => CA [3] => MA [4] => TA [5] => IA [6] => GA )
  • b) Array ( [0] => KA [2] => CA [4] => TA )
  • c) Array ( [1] => IA [3] => GA )
  • d) Array ( [1] => LA [3] => MA )
Mostrar resumen completo Ocultar resumen completo