CIS 2336 Exam Prep
What is the difference between unary, binary, and ternary operators in PHP?
The difference between unary, binary, and ternary operators is the number of operands each requires (one, two, and three, respectively).
Which JavaScript function is the equivalent of echo or print in PHP?
The equivalent of the echo and print commands used in PHP is the JavaScript document.write function (or method).
What will be the output of the following PHP code? ?php $op2 = "be"; function foo($op1) { global $op2; echo $op2; echo $op1; } foo(" awesome"); ?>
be awesome
Which is the correct CSS syntax?
body {color: black}
Select the CSS property that sets the width of an element's bottom border?
border-bottom-width
Which of the following can't be the value of list-style-type?
disc
Which of the following measurement defines a measurement relative to a font's x-height?
ex
Which attribute defines the file-select field in a HTML form?
file
Which of the following CSS property sets the font size of text?
font-size
How to define a function in PHP?
function functionName(parameters) {function body}
Choose the correct HTML tag for the largest heading.
h1
What are the services provided by following URL schemes?
http: Web service malito: Email service Callto: Video/audio calling service https: Secure web service File: Local file service
Which CSS selector is used to specify a rule to bind a particular unique element?
id
Which attribute specifies a unique alphanumeric identifier to be associated with a HTML element?
id
Which of the following CSS selector types are used to specify elements to bind CSS style rules?
id class tag
Which of the following property sets the amount of spacing between letters?
letter-spacing
Which of the following CSS functions defines a linear gradient as a CSS image?
linear-gradient()
Relative URLs are used to ____________
link other pages within the same site
Which command is used for determining the IP address of a domain name?
nslookup
How can you make a list that lists the items with numbers?
ol
Which of the following color has this value #ff0000?
red
Draw the three-tier architecture of web applications and explain each of the components briefly.
see image
Which attribute is not used for the radio type in a HTML form?
selected
In what form are CSS style rules presented?
selector { property: value }
The _____________ attribute specifies an inline style associated with an element, which determines the rendering of the affected element.
style
Which HTML attribute is used to define inline styles?
style
Which of the following CSS property is used to give a line under the text?
text-decoration: underline
Which element is used to create multi-line text input in a HTML form?
textarea
What will be the output of the following PHP code? ?php $state = array ("Karnataka", "Goa", "Tamil Nadu", "Andhra Pradesh"); echo (array_search ("Goa", $state)); ?>
1
Given the following words, which words match the regular expression 'ab∗cd∗'? 1. abbc 2. bcadcbab 3. abcd 4. acdd 5. abcdd
1, 3, 4, 5
How do you insert a comment in a CSS file?
/* this is a comment */ (it's bold because there are asterisks)
Which of the following measurement defines measurement of font size as a percentage?
%
What will be the output of the following PHP code? ?php $country = array("Mauritius" => array ("population" => "1,265,985", "capital" => "Port Luis"), "Maldive" => array("population" => "133,412", "capital" => "Male")); echo $country["Mauritius"] ["population"]; ?>
1,265,985
1. Which of the following is incorrect IPv4 address?
154.324.120.87
The following is a regular expression. '\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d' What will the pattern match from the following text?
18-09-23 08:00:00.00
What will be the output of the following JavaScript code? HTML> <body> p id="demo"></p> script> var x = 10; var y = 2; var z = x / y; document.getElementByID("demo").innerHTML = z; /script> /body> <HTML
5
Which of the following Color Format is a CSS's six-digit hexadecimal format is the same as color defined in HTML?
6-Hex Color
What will be the output of the following PHP code? ?php function calc($price, $tax="") { $total = $price + ($price * $tax); echo "$total"; } calc(50, 0.2); ?>
60
Which port number is commonly used by HTTP Internet service?
80
What is the correct HTML for creating a hyperlink?
<a href="http://www.w3schools.com">W3Schools</a>
How can you open a link in a new browser window?
<a href="url" target="_blank">
Which element is used for creating links in a HTML page?
<a>
Which of the following HTML tag defines the title of a work? (e.g. a book, a song, a movie, a TV show etc.)
<cite>
For grouping form controls we can use ___________.
<fieldset>
Inside which of the following HTML tag we provide information about linking external CSS style sheets?
<head>
What is the path for an image located in same folder as the current page?
<img src= "pic.jpg">
What is the correct HTML for inserting an image?
<img src="image.gif" alt="MyImage">
Which HTML element defines preformatted text?
<pre>
Which HTML tag is used to define an internal style sheet?
<style>
The ________________ directive allows CSS style sheets to be grouped and joined together.
@import
Using regular expressions, write a JavaScript function to test whether the word make exists in the String "Adversity and loss make a man wise".
A JavaScript function using regular expressions to test whether the word fox exists in the string The quick brown fox could be as follows: document.write(/make/.test("Adversity and loss make a man wise "))
What is the difference between static and dynamic web pages? Why are dynamic web pages used?
A Web server can also deliver dynamic pages that are generated on-the-fly by programming on the server side. A dynamic page is produced when a request arrives often with input data. Customizing a document depending on when, from where, by whom, and with what program it is retrieved.
Which of the following are correct ways of creating an array? I. city[0] = "Seoul"; II. $city[] = array("Seoul"); III. $city[0] = "Seoul"; IV. $city = array("Seoul");
III and IV
What is the difference between a numeric and an associative array?
A numeric array can be indexed numerically using numbers or numeric variables. An associative array uses alphanumeric identifiers to index elements.
Write a regular expression to match either of the words hot or hit.
A regular expression to match either of the words hot or hit could be /h[oi]t/.
Where in the HTML document is the correct place to refer to an external style sheet?
In the <head> section
What does the ID selector do?
Apply the style to a specific element
What will be the output of the following PHP code? $a1 = array("red", "green"); $a2 = array("blue", "yellow"); $a3 = array_merge($a1, $a2); $a4 = array("0", "1", "2", "3"); $a = array_combine($a4, $a3); print_r($a); ?>
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
What will be the output of the following PHP code? ?php $fname = array("Peter", "Ben", "Joe"); $age = array("45", "57", "63"); $c = array_combine($age, $fname); print_r($c); ?>
Array ([45] => Peter [57] => Ben [63] => Joe)
What will be the output of the following PHP code? ?php $names = array("Aron", "Bob", "Jack"); echo $names[1] . " is the brother of " . $names[2] . " and " . $names[0] . "."; ?>
Bob is the brother of Jack and Aron
By default, to which part of a document will JavaScript code output?
By default, JavaScript code will output to the part of the document in which it resides. If it's in the head, it will output to the head; if in the body, it outputs to the body.
What does CSS stand for?
Cascading Style Sheets
What selector should you use when applying a style to multiple elements?
Class
What will be the output of the following PHP code? ?php $names = array("Aron", "Bob", "Jack"); echo $names[0]."is the brother of ".$names[1]." and ".$names[1].".".$brother; ?>
Error
Which method is ideal for applying the same style to an entire website?
External CSS
For Inline style, we don't need to reapply style information throughout the document and outside documents.
False
Inline style has the lowest priority
False
The page title is inside the _____ tag.
Head
What does HTML stand for?
Hyper Text Markup Language
What will be the output of the following PHP code? ?php $cars = array("Audi", "Mercedez", "Opel"); echo "I like " . $cars[1] . ", " . $cars[2] . " and " . $cars[0] . "."; ?>
I like Mercedes, Opel, and Audi
HTML Form validation traditionally was performed by ___________.
JavaScript
Are JavaScript functions and variable names case-sensitive or case-insensitive?
JavaScript functions and variable name are case-sensitive. The variables Count, count, and COUNT are all different.
What keyword is used to create an object?
New objects are created via the new keyword.
What does an IP address represent? Give two examples of valid IPv4 addresses.
On the Internet, each host has a unique IP address For example, tiger, a host at Kent State, has the IP address 131.123.38.172. [0-255].[0-255].[0-255].[0-255] [0-255].[0-255].[0-255].[0-255]
Name a way to return multiple values from a function.
One way to return multiple values from a function is to place them all inside an array and return the array.
What is the purpose of web publishing and hosting? What are the services provide by a web hosting service?
Publishing on the Web involves Designing and constructing the pages and writing the programs for a website. Placing the completed site with a hosting service which runs web server programs to deliver your site to Web users. To host a site under a given domain name, a hosting service associates that domain name to an IP number assigned to the hosted site.
HTTP working
See image
Which of the following is not the form type for adding text?
Submit button
What is the default type of 'type' attribute of element in a HTML form?
Text
What is the purpose of Domain Name System (DNS)? Explain briefly the concept of Domain Name Hierarchy.
The IP address is easy on machines but hard on users. Therefore, each host also has a unique domain-based name composed of words, rather like a postal address. For example, the domain name for tiger is tiger.cs.kent.edu (at Department of Computer Science, Kent State University).
What is the long form of URL? Explain the purpose of URL in brief.
The Web uses Uniform Resource Locators (URLs) to identify (locate) many kinds of resources (files and services) available on the Internet. A URL may identify a host, a server port, and the target file stored on that host. URLs are used, for example, by browsers to retrieve information, and in HTML documents to link to other resources.
Who is making the Web standards?
The World Wide Web Consortium
What is the best way to force your own operator precedence?
The best way to force your own operator precedence is to surround the parts of an expression to be evaluated first with parentheses.
What is the purpose of the explode function?
The purpose of the explode function is to extract sections from a string that are separated by an identifier, such as extracting words separated by spaces within a sentence.
Name the three conditional statement types in PHP.
The three conditional statement types are if, switch, and the ?: operator.
What will be the output of the following PHP code? ?php function foo($msg) { echo "$msg"; } $var1 "foo"; $var1("This works!!"); ?>
This works!!
How do you create a new object in PHP?
To create a new object in PHP, use the new keyword like this: $object = new Class;
How can you incorporate one PHP file within another?
To incorporate one file within another, you can use the include or require directives, or their safer variants, include_once and require_once
What command can you use to skip the current iteration of a loop and move on to the next one in PHP?
To skip the current iteration of a loop and move on to the next one, use a continue statement.
Each element can have only one ID and Each page can have only one element with that ID.
True
You can use the same class on multiple elements.
True
What characters are used to define a JavaScript variable name?
Unlike PHP, no character is used (such as $) to define a JavaScript variable name. JavaScript variable names can start with and contain uppercase and lowercase letters as well as underscores; names can also include digits, but not as the first character.
What is the main benefit of using a function?
Using functions avoids the need to copy or rewrite similar code sections many times over by combining sets of statements so that they can be called by a simple name.
How can you include JavaScript code from another source in your documents?
You can include JavaScript code from other files in your documents by eithercopying and pasting them or, more commonly, including them as part of a (script src='filename.js') tag
What JavaScript method can you use to send a form for validation prior to submitting it?
You can send a form for validation prior to submitting it by adding the Java-Script on submit attribute to the form tag. Make sure that your function returns true if the form is to be submitted, and false otherwise.
How can you determine the number of elements in an array?
You can use the count function to count the number of elements in an array.
When would you use the === (identity) operator?
You use the identity operator when you wish to bypass JavaScript's automatic operand type changing.
Which of the following attributes of the tag displays alternate text for the image?
alt