100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Examen

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Puntuación
-
Vendido
1
Páginas
86
Grado
A
Subido en
28-12-2024
Escrito en
2024/2025

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Institución
Grado











Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
28 de diciembre de 2024
Número de páginas
86
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

lOMoAR cPSD| 49343224




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




Question 1 (2 marks)
What is the output of the following code when
executed? function func_1(){
return "func_1 is executed";
}
function
func_2()
{
func_1()
;
echo "func_2 is
executed";
}

f
u
n
c
_
2
(
)
;

1. func_1 is executedfunc_2 is executed
2. func_1 is executed
3. func_2 is executed
4. func_2 is executedfunc_1 is executed

Answer: (3)
Refer to chapter 13.
Both functions get executed, however the string returned by func_1()
never gets displayed.
Question 2 (2 marks)
What is the output displayed by the

following code? function

calculate($arr, &$num){

$result




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




= 0;
foreach($arr
as $value){
$result += $value;
}
$num = $result / count($arr);
}

$arr = array(10,20,30,40,50);
$num =
0;
calcul
ate($a
rr,$nu
m);
echo
$num;

1. 150
2. 30
3. 15
4. 0

Answer: (2)
Refer to pages 392 to 393 (section ‘How to pass arguments by value
and by reference’) in chapter 13. In this code $num is passed by
reference and in the function, it gets initialised to 30
((10 + 20 + 30 + 40 + 50)/5), which then displayed outside of the function.

Question 3 (2 marks)

What is the output
displayed by the following
code? function
calculate(){ $num
= func_num_args();
$result = 0;
for($i = 0; $i < $num;
$i++){ $result
+= func_get_arg($i);
}
return $result * $num;
}
echo calculate(3,2,1,0);




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




1. 0
2. 7
3. 21
4. 24

Answer: (4)
Refer to pages 400 to 401 (section ‘How to use variable-length
parameter lists’) in chapter 13. The function makes use of
variablelength parameter lists. It adds all the arguments and multiplies
the sum by the number of passed arguments. So 3+2+1+0 is 6 and 6*4
is 24. Question 4 (1 mark)
Within a function, you can use the ________________ keyword if you
need to refer to a variable that’s declared outside the function.

1. global
2. return
3. arguments
4. void

Answer: (1)
Refer to pages 394 to 395 (section ‘How variable scope works’)
in chapter 13. Question 5 (2 marks)

Which of the following options is correct about functions in PHP?

1. One can define a function without a name. Similarly, one can define
a function without a return statement.
2. When an argument is passed by value, the original variable is sent
to the function. Then any changes to the parameter in the function causes
changes in the value stored in the original variable.
3. If a function is defined without any parameters, it means that no
arguments can be passed to the function when a function call is made. 4.
A dedicated PHP file can be created to define multiple functions
but a namespace must be created for the functions in the file.

Answer: (1)

Refer to Chapter 13.
Referring to option 1, an anonymous function does not have a name
and functions need not have a return statement (see the function in
Question 2).




Downloaded by Vincent master ()
$2.65
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Jennifer2024 University of South Africa
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1255
Miembro desde
2 año
Número de seguidores
347
Documentos
1229
Última venta
3 días hace
Jennifer2024

On this page, you find all documents, package deals, and flashcards offered by seller Jennifer2024.

3.7

122 reseñas

5
53
4
18
3
30
2
7
1
14

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes