Week 7 mid semester exam
Updated on 28 Dec 2018
UNIT CODE | COMP306 |
UNIT TITLE | Software Design & Development |
LECTURER | Brent Knigge |
DURATION | 1 hour 30 mins |
WEIGHTING | 20 % |
SPECIAL INSTRUCTIONS TO STUDENTS:
- There are a total of 10 questions. Attempt all questions.
- Each question is worth 2 marks.
- This exam constitutes 20% of your overall assessment.
- This is a closed book assessment.
Question 1
2 marks
This snippet of code will be parsed by PHP, however there is something wrong. What is it?
if($mood = 'Happy')
echo “<p>That's Great to hear!</p>”;
Question 2
2 marks
This error message is displayed on the browser. What is the likely cause of this error?
Warning: Missing argument 1 for myFunc() in d:\my documents\My Site\php\Examples\ereg_test.php on line 12
Question 3
2 marks
What technique is best utilized for multiple if / else statements?
Question 4
2 marks
For the array declaration shown below, what special type of loop could be used to traverse the elements of the array?
$myArray = array('S0001234' => 'Smith',
'S0001235' => 'Jones');
Question 5
2 marks
In a switch statement what is the default keyword used for?
Question 6
2 marks
This snippet of code will be parsed by PHP, however there is something wrong. What is it?
$myArray = array(1 => ‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’,
‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’);
for($i = 1; $i < sizeof($myArray); $i++)
echo ‘<br />’ . $myArray[$i];
Question 7
2 marks
What is the difference between using include as opposed to include_once ?
Question 8
2 marks
What does the following string function do?
strtolower
Question 9
2 marks
The method attribute of a form tag can be set to GET or POST. What is the difference between the 2 types of form submission?
Question 10
2 marks
Can you create an object using the new keyword if the constructor is declared private?