100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4,6 TrustPilot
logo-home
Summary

Summary Assignment 1 and Assignment 2 – Internet Programming (ICT2613 – 2025)

Rating
-
Sold
-
Pages
5
Uploaded on
02-05-2025
Written in
2024/2025

Assignment 1 and 2 – Internet Programming (ICT2613 – 2025) Please note: This document contains Assignments 1 and 2 for the module Internet Programming ICT2613 for the year 2025 answers










Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 2, 2025
Number of pages
5
Written in
2024/2025
Type
Summary

Subjects

Content preview

Assignment 1 and 2 – Internet Programming (ICT2613 – 2025)




Please note:
This document contains Assignments 1 and 2 for the module Internet Programming ICT2613 for the year 2025.
It is intended to serve as a guide. You are strongly advised not to copy and paste answers directly without
verifying the correct process for submission on myUnisa.
Use the content provided to understand the structure, extract what is relevant, and ensure your submission
complies with the module requirements.
Questions are indicated in red, while the corresponding answers are provided below each one.



Assignment 1 (chapters 1-6), Due Date: 13 May 11:00 PM, Total marks: 32 marks


1 = A (client-server application)
2 = D (PHP interpreter)
3 = C (Apache)
4 = B (uses localhost as the domain name)
5 = A (.htm)
6 = A (Code two slashes (//) followed by the comment)
7 = B (echo $votingAge;)
8 = B (POST)
9 = B (Name: Bob)
10 = B (20)
11 = B (foreign keys)
12 = C (SELECT)
13 = A (if the values of the primary key and foreign key are equal)
14 = B (a WHERE clause)
15 = A (http://localhost/phpmyadmin)
16 = B (PHP Data Objects)
17 = C (DSN (Data Source Name))
18 = A (fetch())
19 = C (PDOException object)
20 = C (foreach statement)
21 = D (the model and the view)
22 = A (make each layer as independent as possible)
23 = D (the application runs more efficiently)
24 = A (Model-View-Controller)
25 = A (controller)
26 = D (syntax error)
27 = D (multiplying by the wrong variable)
28 = A (runtime error)

, 29 = C (logic)
30 = A (fix all errors)


Assignment 2, Due Date: 23 June 11:00 PM, Total Marks: 60

Question 1 (10 marks)

<?php
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = htmlspecialchars($_POST["name"]);
$language = $_POST["language"];

// Language greetings mapping
$greetings = [
"English" => "Hello",
"Afrikaans" => "Hallo",
"IsiXhosa" => "Molo",
"IsiZulu" => "Sawubona",
"Setswana" => "Dumela"
];

// Display greeting
if (array_key_exists($language, $greetings)) {
echo "<h2>" . $greetings[$language] . " " . $name . "</h2>";
} else {
echo "<h2>Invalid language selected.</h2>";
}
}
?>

Question 2 (10 marks)
Write a PHP program that inputs a number representing seconds and computes and displays the number of hours,
minutes and seconds from the input number.
For example, if the input is 5000 seconds, it is equivalent to 1 hour, 23 minutes and 20 seconds. Note that a minute
is 60 seconds and an hour is 60 minutes.

<?php
// Process form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$totalSeconds = (int)$_POST["seconds"];

// Calculate hours, minutes, and seconds
$hours = intdiv($totalSeconds, 3600);
$remainingSeconds = $totalSeconds % 3600;
$minutes = intdiv($remainingSeconds, 60);
$seconds = $remainingSeconds % 60;

// Display the result
echo "<h2>$totalSeconds seconds is equal to: </h2>";
echo "<p>$hours hour(s), $minutes minute(s), and $seconds second(s)</p>";
}

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
phegelelo University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
17
Member since
3 year
Number of followers
15
Documents
12
Last sold
1 year ago

5,0

1 reviews

5
1
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions