4460 Exam 1
Create a new array for the following jobs. analyst engineer researcher intern
$jobs = array("analyst","engineer","researcher","intern");
To create a new object in PHP, use the new keyword such as:
$object = new Class;
UBER came up with a new program to cater for young and senior customers. The following PHP code is needed to support that program. Write an 'IF ELSE' statement to evaluate the variable $age. If $age is less than 18 (echo 'not allowed to ride'), AND if $age is between 18 and 60 inclusive (echo 'must pay'), else if $age is more than 60 (echo 'ride for free'). if($age<18) { echo 'not allowed to ride'; } [ Select ] ["if($age<=60 && $age>=18)", "if($age<60 && $age>18)", "if($age>60)", "if($age<=18)"] { echo 'must pay'; } [ Select ] ["if($age<18)", "if($age<=60 && $age>=18)", "if($age<=18)", "if($age>60)"] { echo 'ride for free'; }
-
In the following piece of code, how many columns will be created? < div class="container-fluid"> <div class="row"> <div class="col-sm-4"></div> <div class="col-sm-8"></div> </div> </div>
2
What is the correct HTML code for creating a hyperlink? -<a>http://www.w3schools.com</a> -<a url="http://www.w3schools.com">W3Schools.com</a> -<a href="http://www.w3schools.com">W3Schools</a> -<a name="http://www.w3schools.com">W3Schools.com</a>
<a href="http://www.w3schools.com">W3Schools</a>
"$a++" is an example of a unary operator.
True
Variable of global scope can be accessed by all parts of a PHP program.
True
PHP uses standard .........., which are simply the number of seconds since the start of January 1, 1970.
Unix timestamps
Which below is the correct HTML code for referring to an external style sheet called 'mystyle.css'? -<link rel="stylesheet" type="text/css" -href="mystyle.css"> -<style src="mystyle.css"> -<link method='post' action='page.php' /> -<stylesheet>mystyle.css</stylesheet>
<link rel="stylesheet" type="text/css" href="mystyle.css">
MySQL is _________________ . -Robust and free -All the above -A DBMS to track data -Has English like commands
All the above
What is one of the benefits of using a function?
Decrease the loading time of program files
Apache Web Server enables the styling of any HTML elements: color, border, spacing, etc.
False
Bootstrap helps to develop elegant web pages, enforces consistency across all pages, is highly customizable, has good support but unfortunately is NOT responsive for mobile phones and tablets.
False
Glyphicons can only be used in text and buttons, but not in forms.
False
On a computer network, a client that provides information or a service is also known as a server.
False
PHP has no further development so it has only a one version. Thus there is hardly a need to check if a function is available in the PHP version that is being used.
False
The operators +, -, * and / have the same precedence and would be processed in the order in which they are encountered. Example 1 + 2 * 3 − 4 * 5 is same as 2 - 4 * 5 * 3 + 1
False
Which below is NOT a characteristic of PHP? -Limited access to Web Server -Flexible (many ways to write PHP) -Integrates seamlessly with HTML -A scripting language
Limited access to Web Server
$out = sprintf("The result is: $%.2f", 123.42 / 12); echo $out; sprintf function is used to.......................................
Store output ready to display later on
<style> is the HTML tag used to define an internal style sheet.
True
A development server is a way for a developer to test code and allow one to work independently with few dependencies from external components.
True
HTTP is a communication standard governing the requests and responses that take place between the browser running on the end user's computer and the web server.
True
If you reference a variable, changing the value of the reference will change the original as well.
True
In CSS, to select an element with id "demo" you can use the '#demo' term.
True
Is the following a CDN link? <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
True
The directions of operators processing (left to right or right to left) are called the operator's associativity.
True
The following is a correct array assignment method using the array keyword. $p1 = array("Copier", "Inkjet", "Laser", "Photo");
True
The function printf controls the format of the output text to browser by letting programmers put special formatting characters in a string.
True
echo "a: [" . TRUE . "]<br>"; echo "b: [" . FALSE . "]<br>"; The underlying output value for a and b as shown in the above example are 1 (for a) and either 0 or NULL (for b) respectively.
True
Which of the following about dynamic web is false?(-PHP is a server-scripting language -MySQL is a database management system. -WAMP is an IDE -Apache web server is a web server)
WAMP is an IDE
Using ________ arrays you can reference the items in an array by name rather than by a numeric value.
associative
Which is the correct CSS syntax? -body;color:black;} -{body:color=black;} -body:color=black; -body {color: black;}
body {color: black;}
IDE (Integrated Development Environment) provides the following functions except: -breakpoints -In-editor debugging -program testing -database functionalities
database functionalities
To cater for many different logic possibilities in a PHP program, we use the __________ statement.
elseif
To check if a file exist, you should best use the _________ command.
file_exists
Complete the LOOP code below for counting from zero to 19. for($count=0; $count<20; $count++) { echo $studentArray[$count]; echo '<br>';}
for($count=0; $count<20; $count++)
Using the jobs array from the previous question, do a foreach loop to iterate through and echo each item in the array. Assume the name of the array is $jobs.
foreach($jobs as $item), echo $item.'<br>';
The simplest form of expression is a _____________.
literal
Which part of the BS carousel does the term 'carousel slide' most probably belong to? -left and right controls -wrapper for slides -outermost <div> -indicator part
outermost <div>
_____refers to which parts of a program has access a particular variable.
scope