100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS } R52,18
Add to cart

Exam (elaborations)

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

 0 purchase

ICT3612 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Preview 4 out of 85  pages

  • November 16, 2024
  • 85
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (18)
avatar-seller
MasterVincent
lOMoAR cPSD| 49343224




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




THIS DOCUMENT CONTAINS 200+ ANSWERED QUESTIONS
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.




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




Question 2 (2 marks)
What is the output displayed by the
following code? function
calculate($arr, &$num){
$result
= 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;




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




for($i = 0; $i <
$num; $i++){ $result
+= func_get_arg($i);
}
return $result * $num;
}
echo calculate(3,2,1,0);

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 variable-
length 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)




Downloaded by Vincent master ()

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller MasterVincent. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R52,18. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

69484 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 15 years now

Start selling
R52,18
  • (0)
Add to cart
Added