Description
Question 1 (2 marks)
Which of the following is an aggregate expression that will find the oldest date in the
invoiceDate column?
1. MIN(invoiceDate)
2. MAX(invoiceDate)
3. HIGH(invoiceDate)
4. LOW(invoiceDate)
Question 2 (2 marks)
Which of the following LIMIT clauses will return a maximum of five rows starting with the eleventh
row in the result set?
15 ICT3612/102/0/2024
1. LIMIT 10, <= 5
2. LIMIT 11, 500
2. paymentDate IS NOT NULL OR invoiceTotal >= 500
3. NOT (paymentDate IS NULL AND invoiceTotal = 500
Question 4 (1 mark)
Which of the following is not a comparison operator in a SQL statement?
1.
2. !=
3. =
4. >
Question 5 (1 mark)
If introduced as follows, the subquery can return which of the values listed below?
FROM (subquery)
1. a single value
2. a column of one or more rows
3. a table
4. a subquery can’t be introduced in this way
Question 6 (2 marks)
Which one of the following is incorrect about PDO?
1. PDO facilitates database access in PHP
2. Creation of PDO object can result in errors that can be handled using try catch statement
3. One can specify the name of the database table when creating a PDO object
4. A PDO object can be created using three arguments
Question 7 (2 mark)
Study the database table named weather given below, where record_number is the primary
key:
16
What is the result of the following code?
$query = ‘INSERT INTO weather (record_number, place, date, rainfall)
VALUES (:rec_no, :place, :date, :rainfall)’;
$rec_no = 5;
$place = ‘Roodepoort’;
$date = ‘2019-12-27’;
$rainfall = 25;
$statement = $db->prepare($query);
$statement ->bindValue(‘:rec_no’, $rec_no);
$statement ->bindValue(‘:place’, $place);
$statement ->bindValue(‘:date’, $date);
$statement ->bindValue(‘:rainfall’, $rainfall);
$statement->execute();
$statement->closeCursor();
Assume that a PDO object named $db is correctly connected to the relevant database.
1.
record_number place
date
rainfall
1
Gordons Bay
2019-03-01
12
2
Johannesburg
2019-01-30
25
3
Hammanskral
2019-04-12
7
4
Mamelodi
2019-06-23
1
5
Roodepoort
2019-12-27
25
2.
record_number place
date
rainfall
1
Gordons Bay
2019-03-01
12
2
Johannesburg
2019-01-30
25
3
Hammanskral
2019-04-12
7
4
Mamelodi
2019-06-23
1
5
Port Elizabeth
2019-10-19
3
5
Roodepoort
2019-12-27
25
3.
record_number place
date
rainfall
1
Gordons Bay
2019-03-01
12
2
Johannesburg
2019-01-30
25
3
Hammanskral
2019-04-12
7
4
Mamelodi
2019-06-23
1
5
Port Elizabeth
2019-10-19
3
17 ICT3612/102/0/2024
4.
record_number place
date
rainfall
1
Gordons Bay
2019-03-01
12
2
Johannesburg
2019-01-30
25
3
Hammanskral
2019-04-12
7
4
Mamelodi
2019-06-23
1
5
Port Elizabeth
2019-10-19
3
6
Roodepoort
2019-12-27
25
Question 8 (2 marks)
Study the database table named weather given below, where record_number is the primary
key:
Refer to the code below:
$rf = 10;
$query = “UPDATE weather SET rainfall = ? WHERE record_number = 4”;
$statement = $db->prepare($query);
$statement ->bindValue(1, $rf);
$rowCount = $statement->execute();
$statement->closeCursor();
Assume that a PDO object named $db is correctly connected to the relevant database.
Which of the following options is correct about the code given below?
1. rainfall in the first row (record_number: 1) is updated to 10
2. $rowCount stores 2 after execution
3. rainfall in the fourth row (record_number: 4) is updated to 10
4. The SQL statement is incorrect
Question 9 (2 marks)
The prepare() method of a PDO object ____________.
1. must be run before values are assigned to the parameters in a prepared statement
2. assigns the values to the parameters in a prepared statement
3. retrieves the rows of a prepared statement
4. must be run after values are assigned to the parameters in a prepared statement
Question 10 (2 marks)
Which of the following is the correct way to code a PHP statement that gets the first row that’s
18
stored in a PDOStatement object named $products and puts it in an array named $product?
1. $product = $db->query($products);
2. $product = $db->fetch($products);
3. $product = $products->query();
4. $product = $products->fetch();
Question 11 (1 mark)
When you develop a content management system, you can use PHP’s ____________ functions
to parse the user entries so they can be formatted for display in the browser.
1. array handling
2. string handling
3. formatting
4. number handling
Question 12 (1 mark)
The include ________________ for a PHP application tells PHP where to look for the files
specified by the include(), include_once(), require(), and require_once() functions.
1. file
2. view
3. path
4. root
Question 13 (1 mark)
To set the include path for a website, you can use the __________.
1. include_path() function
2. include_path() method
3. set_include_path() function
4. set_include_path() method
Question 14 (1 mark)
For a website that implements the MVC pattern, there is usually one controller file for each
_________________.
1. application
2. model
3. view
4. user
Question 15 (1 mark)
General-purpose files are often called ________________ files because they can be used by
many applications.
1. convenience
19 ICT3612/102/0/2024
2. service
3. resource
4. utility
Question 16 (1 mark)
Secure Sockets Layer (SSL) is a/an ________________ that’s used by the Internet that lets
clients and servers communicate over a secure connection.
1. hash
2. cipher
3. protocol
4. algorithm
Question 17 (1 mark)
Which of the following is a URL that connects to www.company.com over a secure connection?
1. http://www.company.com
2. https://www.company.com
3. http://wwws.company.com
4. http://swww.company.com
Question 18 (1 mark)
When you use form-based authentication ________.
1. the username and password are automatically encrypted and decrypted
2. the programmer writes the code for the authentication process
3. the browser automatically displays a dialog box for the username and password
4. the username and password must be sent for every protected page
Question 19 (1 mark)
Before a server uses SSL to transmit data to a client, it ____________.
1. provides a digital secure certificate to the client
2. decrypts all data
3. confirms the identity of the client
4. authorizes the client
Question 20 (1 mark)
To perform a redirect, you can begin by using the ________________ array to check if the current
request is using a secure connection.
1. $_POST
2. $_GET
3. $_SERVER
4. $_SECURE
20
Question 21 (2 marks)
Which of the following displays the content of the file (‘modules.txt’)?
1. $file = fopen(‘modules.txt’, ‘rb’);
fgets($file);
2. $modules = readfile(‘modules.txt’);
3. $modules = file_get_contents(‘modules.txt’);
4. $modules = file(‘modules.txt’);
Question 22 (1 mark)
What is correct about the statement $modules = file(‘modules.txt’); given the contents
of ‘modules.txt’ as below?
1. $modules contain true or false to indicate whether the file exists
2. $modules contains a string with three module codes in CSV format
3. size of $modules is three
4. $modules contain a string with the value ICT1511
Question 23 (2 marks)
Which of the following is incorrect when working with files in PHP?
1. To delete a file, you use the function delete()
2. $_FILES array can be used to access details of uploaded files
3. fputcsv() can be used to generate a file with data in CSV format
4. If a script has to write to a file, one can open the file in wb mode
Question 24 (1 mark)
Which one of the these is a PHP function that returns an array containing a list of files and
directories in a specified directory?
1. listdir()
2. scandir()
3. getcwd()
4. is_dir()
Question 25 (1 mark)
Which PHP super global variable can be used to get information about each uploaded file?
1. $_FILES
2. $_UPLOAD
3. $_ATTRIBUTES
4. $_INFO
21 ICT3612/102/0/2024
Question 26 (1 mark)
A ________________ is a working model of a website that lets the intended users review and
evaluate it.
1. plan
2. schematic
3. prototype
4. rendering
Question 27 (1 mark)
The controller file for each application of a website is commonly named _________.
1. index.php
2. current.php
3. this.php
4. base.php
Question 28 (1 mark)
________________ refinement refers to the process of making step-by-step improvements to the
working model for a website with review and evaluation after each step.
1. intermittent
2. gradual
3. continual
4. stepwise
Question 29 (1 mark)
The view directory for a website is normally used to store the view files that are used by more than
one ________________.
1. controller file
2. model file
3. prototype
4. application
Question 30 (1 mark)
The controller and view files for each application of a website should be stored in _____.
1. the root directory
2. a separate directory
3. the current working directory
4 a utility directory
Reviews
There are no reviews yet.