Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4,6 TrustPilot
logo-home
Examen

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Note
-
Vendu
1
Pages
86
Grade
A
Publié le
28-12-2024
Écrit en
2024/2025

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Établissement
Cours











Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

École, étude et sujet

Établissement
Cours

Infos sur le Document

Publié le
28 décembre 2024
Nombre de pages
86
Écrit en
2024/2025
Type
Examen
Contient
Questions et réponses

Sujets

Aperçu du contenu

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
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
Jennifer2024 University of South Africa
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
1255
Membre depuis
2 année
Nombre de followers
347
Documents
1229
Dernière vente
3 jours de cela
Jennifer2024

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

3.7

122 revues

5
53
4
18
3
30
2
7
1
14

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions