CPT 114

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following is NOT a characteristic of the server component of a client/server application? Question options: A) Submits a user's request B) Processes a user's request C) Sends an HTML document D) Processes a PHP file

A

Which of the following is an example of an IP address? Question options: A) http://127.0.0.1 B) C:\Windows\Temp\someFile.txt C) http://www.abtech.edu D) http://localhost

A

Which of the following protocols added the World Wide Web to the Internet? Question options: A) http B) ftp C) mail D) telnet

A

Which of the following words or phrases are commonly used to describe operations on data in the terminology of Object Oriented Programming? Question options: A) Methods B) Encapsulation C) Attributes D) Fields

A

Which term is commonly used to describe a way of writing instructions that combines English with the general syntax of programming languages? Question options: A) pseudocode B) algorithm C) application design D) user interface

A

Which of the following is NOT true about HTML tables? Question options: A) HTML tables are used to display related information neatly in rows and columns. B) HTML tables are used to display related information neatly in either rows or columns but not both. C) The appearance of tables can be modified in a style sheet. D) HTML tables can be used to lay out various components on a Web page.

B

Which language does the computer actually understand when it executes instructions for a program? Question options: A) PHP B) Machine language C) HTML or other markup language D) Any high-level programming language

B

How does the Web browser handle white space (multiple spaces, tabs, blank lines, indents) in your HTML document? Question options: A) The browser ignores white space. B) The browser displays white space the same way that it appears in your document. C) The browser displays white space if this space is included inside HTML tags. D) The browser displays white space if this space is included inside <p> </p> tags.

A

How many times will the following loop repeat? for ($count = 3; $count < 5; $count = $count + 2) { print ("<p>Hello!</p>"); } Question options: A) 1 B) 2 C) 3 D) 4

A

If $hourlyWage contains the value 20.00 and $hoursWorked contains the value 30, what value will $bonus contain after the following code is executed? if ($hourlyWage > 20 or $hoursWorked < 40) $bonus = $25.00; else $bonus = $50.00; Question options: A) 25.00 B) 50.00

A

If $hourlyWage contains the value 20.00 and $hoursWorked contains the value 30, what value will $bonus contain after the following code is executed? if ($hourlyWage >= 20 and $hoursWorked <= 30) $bonus = $25.00; else $bonus = $50.00; Question options: A) 25.00 B) 50.00

A

If $hourlyWage contains the value 20.00 and $hoursWorked contains the value 30, what value will $bonus contain after the following code is executed? if ($hourlyWage >= 20 or $hoursWorked < 30) $bonus = $25.00; else $bonus = $50.00; Question options: A) 25.00 B) 50.00

A

If a variable named $carsSold contains the value 15, what is stored in $bonus after this code is processed? (Are these structures separate or chained?) if ($carsSold < 20) $bonus = 50.00; elseif ($carsSold < 30) $bonus = 100.00; else $bonus = 200.00; Question options: A) 50.00 B) 100.00 C) 150.00 D) 200.00

A

Read this carefully. What HTML code is generated by the print statement? $numCourses = 4; $studyTime = $numCourses * 5; print ("<p>Allow $studyTime hours for study</p>"); Question options: A) <p>Allow 20 hours for study</p> B) <p>Allow hours for study</p> C) <p>Allow $studytime hours for study</p> D) <p>Allow 0 hours for study</p>

A

Study the following algorithm. What is the least number of times this loop might repeat? Set count to 1 Turn a card over WHILE (card != Jack) Add 1 to count Turn a card over ENDWHILE Display count Question options: A) 0 B) 1 C) 52 D) Not possible to say

A

The following code processes a file containing five positive numbers. What will the variable $result contain after the code is executed? $result = 0; $someFile = fopen("someFile.txt", "r"); for ($count = 1; $count <= 5; $count = $count + 1) { $nextNum = fgets($someFile); if ($nextNum > $result) $result = $nextNum; } fclose ($someFile); print ("<p>The result is $result</p>"); Question options: A) The sum of the five numbers in the file. B) The highest of the five numbers in the file. C) The value of the first number in the file is added five times. D) The value of the last number in the file.

A

The following print statement is missing a closing quote. Is this a syntax error or a logical error? print ("<p>I guess I have an error - I'm melting!</p>); Question options: A) Syntax error B) Logical error

A

The numbers.txt file contains a list of numbers, one on each line. What is wrong with this code? $result = 0; $numbersFile =fopen("numbers.txt","r"); while (!feof($numbersFile)) { $result = $result + number; $number = fgets($numbersFile); } fclose($numbersFile); print (<p>RESULT: $result</p>"); Question options: A) The statements inside the loop are in the wrong order. B) $number = fgets($numbersFile); should also appear before the loop heading. C) There should not be an exclamation mark before feof($numbersFile). D) The fopen() and fclose() statements should be located inside the loop

A

True or false? Domain names are equivalent to IP addresses - either can be used to create valid URL's, for example http://127.0.0.1 is equivalent to http://localhost. Question options: A) True B) False

A

What does a compiler do? Question options: A) Converts source code into an executable file. B) Reads and executes source code, one line at a time. C) Provides an Application Programming Interface. D) Allows components of a client/server application to work together.

A

What is the computer's instruction set? Question options: A) The basic set of commands that a computer can execute B) The rules for using a high-level programming language C) The pseudocode used to express an algorithm D) The syntax of a high-level language

A

What is wrong with the following PHP code segment? $tax = $amount * 0.07; $amount = 10.00; $total = $tax + $amount; print ("<p>TOTAL COST: $".number_format($total, 2)."</p>"); Question options: A) The first and second statements are in the wrong order B) The second and third statements are in the wrong order C) The print statement will not display correctly. D) The value stored in $tax will be 0 when it should be 0.70

A

What type of operation is used to store a value in a variable? Question options: A) Assignment operation B) Sequential operation C) Arithmetic operation D) Repetition (loop) operation

A

Where should you indicate that a Web page is to refer to a file that contains a style sheet file? Question options: A) In the <head> section. B) In the <body> section. C) In the <title> section. D) In the comment section.

A

Which is the correct order for these first three stages in the software development life cycle? Question options: A) evaluate requirements, application design, algorithm development B) application design, algorithm development, evaluate requirements C) algorithm development, application design, evaluate requirements D) algorithm development, evaluate requirements, application design

A

Which of the following is NOT a basic feature of a style sheet? Question options: A) Style sheets allow a person viewing a Web page to change the styles on the page to suit their personal preferences. B) Style sheets allow the developer to define customized styles for HTML tags and attributes. C) Style sheets allow the developer to apply a consistent look and feel to multiple Web pages. D) Changes in a style sheet are automatically applied to pages when they are next displayed.

A

A discount store is selling its inventory of computer monitors for $100, $200, or $300 depending on screen size. Here's what a programmer wrote as a selection structure to display the price based on the size. What needs to change for this code to work correctly? if ($screenSize < 20) print ("<p>Price: $100.00</p>"); if ($screenSize< 25) print ("<p>Price: $200.00</p>"); else print ("<p>Price: $300.00</p>"); Question options: A) The second if should be an else. B) The second if should be an elseif. C) Curly braces should surround the second if and should include the else section. D) There is no problem with the code.

B

An instruction that begins with IF is an example of: Question options: A) A sequential statement B) A selection statement C) A repetition statement D) An input statement

B

Employees who work at least 40 hours receive a $100 bonus. What is wrong with the logic of the following code? if ($hoursWorked >= 40) { print ("<p>You qualify for a bonus! </p>"); } $bonus = 100; Question options: A) The ELSE section is missing. B) The statement assigning 100 to $bonus should appear INSIDE the IF structure. C) The statement assigning 100 a value to $bonus should appear INSIDE the IF structure, and the print statement should appear AFTER the IF structure. D) There is nothing wrong with this code.

B

Every PHP statement must end with Question options: A) A closing parenthesis ) B) A semi-colon ; C) A period . D) A closing bracket >

B

How do you display a double quote inside a string that begins and ends with double quotes? Question options: A) Just include the double quote ", for example "He said "OK"" B) Use \", for example "He said \"OK\"" C) Use =", for example "He said ="OK="" D) You cannot display " inside a string that begins and ends with double quotes!

B

How many COLUMNS will be displayed in this table? print ("<table border = \"1\">"); for ($count = 1; $count <=10; $count = $count + 1) { $result1 =$count * 10; $result2 =$count * 100; print("<tr><td>$count</td><td>$result1</td> <td>$result2</td></tr>"); } print ("</table"); Question options: A) 1 B) 3 C) 10 D) 30

B

How many paragraphs will the following HTML code display? <p>Current HTML standards are defined by the <a href="http://www.w3.org/">World Wide Web Consortium</a></p><p>Be sure to follow the current standards!</p> Question options: A) 1 B) 2 C) 3 D) 4

B

If $hourlyWage contains the value 20.00 and $hoursWorked contains the value 30, what value will $bonus contain after the following code is executed? if ($hourlyWage <20 or $hoursWorked > 30) $bonus = $25.00; else $bonus = $50.00; Question options: A) 25.00 B) 50.00

B

If a variable named $carsSold contains the value 25, what is the result of this test? if ($carsSold != 25) Question options: A) True B) False

B

In programming, instructions that are understandable but do not produce correct results are said to contain: Question options: A) Syntax errors B) Logical errors C) Sequential statements D) Selection statements

B

Is the following an example of an absolute or relative address? <a href = "contactUs.html">Contact Us</a> Question options: A) Absolute address B) Relative address

B

Programming instructions written in a programming language are known as: Question options: A) Machine language B) Source code C) Markup language D) Pseudocode

B

The arithmetic is wrong in the following PHP statement (should be 65 - $age). Is this a syntax error or a logical error? $yearsToRetire = $age - 65; Question options: A) Syntax error B) Logical error

B

This loop is supposed to use a table to display the numbers 1, 2 and 3 along with the square of each number? What's wrong with this code? for ($count = 1; $count <=3; $count = $count + 1) { print ("<table border = \"1\">"); $result = pow($count, 2); print("<tr><td>$count</td><td>$result</td></tr>"); print ("</table"); } Question options: A) The test condition in the loop heading should be $count <3 B) Only one row is being displayed in this loop - there should be three rows. C) The <table> and </table> tags should be located before and after the loop. D) The loop should repeat 6 times, not 3 - there are 3 rows with 2 columns each.

B

What do we usually use to represent IP addresses? Question options: A) A Web server B) An Internet domain name C) A Windows address D) A client/server application

B

What is the domain name that you will use to access sample code on your standalone server? Question options: A) www.w3.org B) localhost C) WebTech D) samples

B

What is wrong with the following code which should read and sum three numbers stored in a file? $someFile = fopen("someFile.txt", "r"); for ($count = 1; $count <= 3; $count = $count + 1) { $total = 0; $nextNum = fgets($someFile); $total = $total + $nextNum; } print("TOTAL: $total</p>"); fclose ($someFile); Question options: A) The fgets() statement should appear before the FOR loop B) The $total = 0; statement should appear before the FOR loop C) The $total = $total + $nextNum; statement should appear after the FOR loop D) The file should be closed inside the FOR loop

B

What is wrong with the following piece of PHP code? if ($carsSold <= 10) print("<p>If you sell more than 10 you get a bonus!</p>"); else ($carsSold > 10) print("<p>Good job - you sold more than 10 cars!</p>"); Question options: A) A semi-colon is missing at the end of the first line. B) The ELSE section should not begin with a test condition. C) Curly braces are needed. D) There is nothing wrong with the code as written.

B

What value is stored in $result after these PHP instructions are executed? $value1 = 10; $value2 = 15; if ($value1 >= $value2) $value2 = 30; else $value1 = $value2; $result = $value1 + $value2; print("<p>The result is $result</p>"); Question options: A) 25 B) 30 C) 40 D) 45

B

Which is the correct syntax to define the style for a <p> tag in a CSS file? Question options: A) { p font-family: Arial, Helvetica, Sans-serif; font-size:10pt; } B) p { font-family: Arial, Helvetica, Sans-serif; font-size:10pt; } C) <p> { font-family: Arial, Helvetica, Sans-serif; font-size:10pt; } D) <p>font-family: Arial, Helvetica, Sans-serif; font-size:10pt; </p>

B

Which of the following is true about text files? Question options: A) Only files with .txt file extensions can be text files. B) Files with .txt, .html and .php file extensions are all examples of text files. C) Files with .jpg and .mp3 file extensions are examples of text files. D) Text files may contain plain text but may not contain HMTL or PHP code.

B

Which one of the following correctly stores the result of 10 * 2 in a PHP variable? Question options: A) result = 10 * 2; B) $result = 10 * 2; C) 10 * 2 = $result; D) $result = $result + 10 * 2;

B

Which tag is used to indicate a first level heading? Question options: A) <h0> B) <h1> C) <head> D) <heading1>

B

Consider the following address: C:\Projects\Website\index.html Which statement is true? Question options: A) The file is stored in the folder named Projects B) The file is stored at the root of the C: drive C) The file is stored in the folder named Website D) The file is stored in the folder named index

C

How do you know this is a Windows address? C:\Windows\Temp\winLog.log Question options: A) The folder name is Windows B) The address contains a Windows log file C) The address begins with a drive letter D) The folder names all begin with an upper-case letter

C

How many assignment operations do you see in this algorithm? itemCost = 20.00 tax = itemCost *0.07 total = itemCost + tax display total Question options: A) 1 B) 2 C) 3 D) 4

C

How many different paths are there through this code segment? if ($carsSold < 20 and $yearsOnJob < 2) $bonus = 50.00; elseif ($carsSold < 30) $bonus = 100.00; else $bonus = 200.00; Question options: A) 1 B) 2 C) 3 D) 4

C

How many different variables do you see in this algorithm? oldInventory = 520 unitsSold = 30 newInventory = oldInventory - unitsSold display newInventory Question options: A) 1 B) 2 C) 3 D) 4

C

How many rows and columns will be displayed by this table? <table border = "1" > <tr><td>France</td><td>Paris</td></tr> <tr><td>England</td><td>London</td></tr> <tr><td>Italy</td><td>Rome</td></tr> </table> Question options: A) 1 row and 3 columns B) 2 rows and 3 columns C) 3 rows and 2 columns D) 3 rows and 6 columns

C

How many times will the following loop repeat? for ($count = 1; $count < 10; $count = $count + 3) { print ("<p>Hello!</p>"); } Question options: A) 1 B) 2 C) 3 D) 4

C

How many times will the following loop repeat? for ($count = 1; $count <= 3; $count = $count + 1) { print ("<p>Hello!</p>"); } Question options: A) 1 B) 2 C) 3 D) 4

C

If a variable named $score initially contains the value 90 what value is stored in $score after this code is processed? if ($score > 90 ) $bonus = 10; elseif ($score > 80 $bonus = 5; else $bonus = 0; $score = $score + $bonus; if ($score > 100) $score = 100; Question options: A) 85 B) 90 C) 95 D) 100

C

Look at the following HTML form. Which description is correct? <form action = "discount.php" method = "post" > <p>Please enter your discount code: <input type = "text" size = "20" name = "code" > </p> <input type = "submit" value = "Process" > </form> Question options: A) The code sent to discount.php can be extracted from $_POST['discount'] B) The code sent to discount.php can be extracted from $_POST['$discount'] C) The code sent to discount.php can be extracted from $_POST['code'] D) The code sent to discount.php can be extracted from $_POST['$code']

C

Look at the following form. What is the name of program that will be executed when this form is submitted? <form action = "retire.php" method = "post" > <p>What is your age?<input type="text" size="10" name="age"></p> <p><input type="submit" value = "Calculate " ></p> </form> Question options: A) Calculate B) post C) retire.php D) age

C

PHP variable names must begin with Question options: A) A lower-case letter B) An upper-case letter C) A dollar sign $ D) A number

C

The following code processes a file containing five positive numbers. What will the variable $result contain after the code is executed? $result = 0; $someFile = fopen("someFile.txt", "r"); $nextNum = fgets($someFile); for ($count = 1; $count <= 5; $count = $count + 1) { $result = $result + $nextNum; } fclose ($someFile); print ("<p>The result is $result</p>"); Question options: A) The sum of the five numbers in the file. B) The lowest of the five numbers in the file. C) The value of the first number in the file is added five times. D) The value of the last number in the file.

C

What HTML output will be generated by the following PHP code? $inventory = 47; if ($inventory < 40) print("<p>Time to re-order!</p>"); else { $countdown = $inventory - 40; print("<p>Countdown to re-order: $countdown.</p>"); } Question options: A) <p>Time to re-order!</p> B) <p>Time to re-order!</p> <p>Countdown to re-order: 7</p> C) <p>Countdown to re-order: 7</p> D) <p>Countdown to re-order: 47</p>

C

What is an algorithm? Question options: A) An executable file that has been converted into machine language B) A set of markup instructions C) A set of instructions to meet a requirement of some kind D) Programming instructions written in a programming language

C

What is the purpose of <!-- and --> tags in HTML documents? Question options: A) Display LEFT and RIGHT arrows graphically B) Display comments for someone viewing the page in a Web browser C) Display comments for someone reading the file that contains the document D) These are not valid HTML tags

C

What is the purpose of a repetition structure? Question options: A) Repeatedly execute a print statement a certain number of times. B) Repeatedly execute any single statement a certain number of times. C) Repeatedly execute one or more statements a certain number of times. D) Repeatedly execute an entire program a certain number of times.

C

What is wrong with the following piece of PHP code? if ($password = "xyz") print("<p>That's the correct password!</p>"); Question options: A) There must be an ELSE section. B) A semi-colon is missing at the end of the first line. C) The = should be == D) Curly braces are needed.

C

What is wrong with this HTML code segment? <strong>This is a test <strong> Question options: A) The code should be <strong ="This is a test" /> B) The first <strong> tag should be </strong> C) The second <strong> tag should be </strong > D) There is nothing wrong with this code

C

What phrase is commonly used to describe testing an application to ensure that it can be understood easily by the intended audience? Question options: A) Applicability testing. B) Systems testing. C) Usability testing. D) Procedural testing.

C

What value is stored in $inventory after these three PHP instructions are executed? $inventory = 320; $unitsSold = 40; $inventory = $inventory - $unitsSold; Question options: A) 320 B) 40 C) 280 D) Error! you cannot use the same variable on both sides of the = operator.

C

What value is stored in $result after this PHP instruction is executed? $result = 6 + 10 * 5 - 4; Question options: A) 76 B) 16 C) 52 D) 100

C

What will be displayed if this algorithm is executed? oldInventory = 520 unitsSold = 30 newInventory = oldInventory - unitsSold display newInventory Question options: A) 520 B) 30 C) 490 D) 520, 30, 490

C

Which of the following correctly creates a form designed to run a program named contactList.php when the Submit button is pressed? Question options: A) <form action = "post" method = "contactList.php" > <input type = "submit" value = "submit" /> </form> B) <input type = "submit" value = "submit" /> <form action = "contactList.php" method = "post" > </form> C) <form action = "contactList.php" method = "post" > <input type = "submit" value = "submit" /> </form> D) <form action = "contactList.php" method = "post" > </form> <input type = "submit" value = "submit">

C

Which of the following is NOT a relational operator Question options: A) < B) == C) = D) !=

C

Which of the following is NOT an example of a repetition structure? Question options: A) FOR B) FOREACH C) IF..ELSE D) WHILE

C

Which of the following is an example of client/server design? Question options: A) An algorithm B) A compiler C) A Web application D) A standalone program

C

Which of the following is true about an algorithm? Question options: A) Algorithms must always include instructions to receive input. B) The instructions in an algorithm must include a selection structure C) The instructions in an algorithm must be clear and unambiguous. D) The instructions in an algorithm must perform a calculation.

C

Which of the following will generate a syntax error in a computer program? Question options: A) Instructions that are not efficient B) Instructions that do produce correct results C) Instructions that are not understandable D) None of these will generate syntax errors

C

Which one of the following is an acceptable name for a PHP variable? Question options: A) $3rdScore B) score3 C) $score3 D) $score 3

C

A test that evaluates to true or false is known as Question options: A) A relational expression B) A valid expression C) An arithmetic expression D) A Boolean expression

D

An instruction to obtain information from the user is an example of: Question options: A) A sequential statement B) A selection statement C) A repetition statement D) An input statement

D

Consider the following code? Which employees will get a 400.00 bonus? if ($yearsWorked < 5) { if ($salary < 18000.00) $bonus = 500.00; else $bonus = 400.00; } else $bonus = 750.00; Question options: A) Employees who have worked at least 5 years, no matter what their salary is. B) Employees who have worked at least 5 years, with a salary of at least 18000.00. C) Employees who have worked less than 5 years, with a salary below 18000.00. D) Employees who have worked less than 5 years, with a salary of at least 18000.00.

D

If a variable named $carsSold contains the value 15 what is stored in $bonus after this code is processed? (Hint: are these structures separate or chained?) if ($carsSold < 20) $bonus = 50.00; if ($carsSold < 30) $bonus = 100.00; if ($carsSold < 40) $bonus = 200.00; Question options: A) 50.00 B) 100.00 C) 150.00 D) 200.00

D

Look at the following code segment. Which statement describes the structure correctly? if ($yearsWorked < 5) { if ($salary < 18000.00) $bonus = 500.00; else $bonus = 400.00; } else $bonus = 750.00; Question options: A) The code contains a single if..else structure. B) The code contains two if..else structures chained together. C) The code contains two if..else structures that are entirely separate from one another. D) The code contains two if..else structures, one is nested inside the other.

D

Look at the following form. Which input method is the form using to receive the user's favorite activity? <form action = "calculate.php" method = "post" > <p>What is your favorite activity? <select name = "activity"> <option>Running</option> <option>Swimming</option> <option>Cycling</option> </select> </p><p><input type = "submit" value = "Submit" ></p> </form> Question options: A) Group of checkboxes B) Group of radio buttons C) A text box D) A drop down List

D

What is PHP? Question options: A) A domain name B) A markup language C) A standalone Web server D) A programming language

D

What value will be displayed? $result = 0; for ($count = 1; $count < 5; $count = $count + 1) { if ($count < 3) $result = $count; else $result = $result + $count; } print ("<p>RESULT: $result</p>") Question options: A) 8 B) 9 C) 10 D) 15

D

Where must the PHP code be located inside a .php file? Question options: A) Between <php? and ?php> B) Between <php?> and </? > C) Between <php> and </php> D) Between <?php and ?>

D

Which of the following is an essential characteristic of Object Oriented Programming? Question options: A) Object Oriented Programming methods can only be applied to client/server applications. B) Object Oriented Programming methods can only be applied to Web applications. C) Object Oriented Programming methods allow a programmer to focus entirely on the requirements of a single application D) Object Oriented Programming methods allow a programmer to think about all possible operations on a set of data rather than the requirements of a single application.

D

Which piece of code is correct to meet the following requirement: Display "Good score" for scores 80 and above Question options: A) if ($score != 80) print ("<p>Good score</p>"); B) if ($score == 80) print ("<p>Good score</p>"); C) if ($score > 80) print ("<p>Good score</p>"); D) if ($score >= 80) print ("<p>Good score</p>");

D


Kaugnay na mga set ng pag-aaral

Chapter 10 Flexibility, Empowerment, and Partnership

View Set

Life 5 (11, 13 & 28) Fixed & Variable Contracts - including retirement

View Set

Questions and Answers from ALL of the Canvas Tests

View Set

OB Chapt 23 Quiz Newborn With Special Needs Quiz Questions

View Set

Lesson 5 - World War I and Post War Culture

View Set

NUTR 223 (UNR) NC Connect: High Protein Diet

View Set

CpE 449 - Computer Networks and Forensics

View Set