Final Review Flashcards

1
Q

Find the error in this code:

SELECT name,

CASE

WHEN imdb_rating > 8 THEN ‘Oscar’

WHEN imdb_rating > 7 THEN ‘Good’

WHEN imdb_rating > 6 THEN ‘Fair’

FROM movies;

A. The column was not renamed.
B. Not enough WHEN/THEN statements.
C. Missing ELSE statement.
D. Missing END statement.

A

D. Missing END statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you query all the unique genres from the books table?

A. SELECT DISTINCT genres
FROM books;

B. FROM books
SELECT DISTINCT genres;

C. SELECT UNIQUE genres
FROM books;

D. SELECT genres
FROM books;

A

A. SELECT DISTINCT genres

FROM books;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F. IS NULL condition returns true if the field is empty.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What code would you add to this query to order colors by name alphabetically (Z to A)?

SELECT *

FROM colors

_________________;

A. ORDER BY name ASC
B. GROUP BY name ASC
C. ORDER BY name DESC
D. ORDER BY name

A

C. ORDER BY name DESC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the wildcard character % in the following SQL statement do?

SELECT *
FROM sports
WHERE name LIKE ‘%ball’;

A. It matches all sports that begin with ‘ball’.
B. It matches all sports that contain ‘ball’.
C. It matches all sports that have a pattern like ‘ball’, such as ‘b3ll’ and ‘b@ll’.
D. It matches all sports that end with ‘ball’.

A

D. It matches all sports that end with ‘ball’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is LIKE?

A. A clause used to bookmark columns that are frequently queried.
B. A clause used to select unique values from a table.
C. A special operator that can be used with the WHERE clause to search for a pattern.
D. A statement that allows us to create different outputs.

A

C. A special operator that can be used with the WHERE clause to search for a pattern.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is LIMIT?

A. A clause that restricts our query results in order to obtain only the information we want.

B. A clause that is used to return unique values in the output.

C. A clause that lets you specify the maximum number of rows the result set will have.

D. A clause that lets you specify the maximum number of columns the result set will have.

A

C. A clause that lets you specify the maximum number of rows the result set will have.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is ORDER BY?

A. A clause that allows you to select unique values.

B. An operator used with the WHERE clause.

C. A clause that sorts the result set alphabetically or numerically.

D. A clause that sorts the result set in alphabetical order only.

A

C. A clause that sorts the result set alphabetically or numerically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the correct query to select only the cities with temperatures less than 35?

A. SELECT *
FROM cities
WHERE temperature < 35;

B. SELECT *
FROM cities
WHERE temperature = 35;

C. SELECT *
FROM cities;

D. SELECT *
FROM cities
WHERE temperature != 35;

A

A. SELECT *
FROM cities
WHERE temperature < 35;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the correct syntax to query both the name and date columns from the database?

SELECT __________
FROM album;

A. name & date

B. name, date

C. name; date

D. name + date

A

B. name, date

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following is NOT a comparison operator in SQL?

A. ~
B. <
C. >=
D. !=

A

A. ~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which operator would you use to query values that meet all conditions in a WHERE clause?

A. AND
B. OR
C. BETWEEN
D. LIKE

A

A. AND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Choose the correct explanation for the include statement in PHP.

A. include checks if a value is included in an array.

B. include brings in and evaluates code from one file to another.

C. include allows a global variable to be used within a function.

A

B. include brings in and evaluates code from one file to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Fill in the code so that “Great job!” prints to the terminal.

if (“cat” [_______] “dog”){

echo “Great job!”;

}

A. !==
B. >
C. !
D. =
E. ===
A

A. !==

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Fill in the code so that “Great job!” prints to the terminal.

if (1 [_________] 10){

echo “Great job!”;

}

A. =
B. >
C. &
D. >=
E. <
F. ===
A

E.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Fill in the code so that “Great job!” prints to the terminal.

if (10 [________] 10){

echo "Great job!";

}

A. <
B. =
C. ===
D. !==
E. >
A

C. ===

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Fill in the code so that “Great job!” prints to the terminal.

if (10 [________] 10){

echo "Great job!";

}

A. >
B. <
C. !==
D. >=

A

D. >=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Fill in the code so that “Great job!” prints to the terminal.

if (10 [________] 10){

echo "Great job!";

}

A. >
B. =
C. <
D. !==
E. <=
A

E. <=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Fill in the code so that “Great job!” prints to the terminal.

if (10 [_____] 3){

echo “Great job!”;

}

A. >
B. =
C. &
D. <
E. <=
F. ===
A

A. >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The following variables hold what type of values?

$first = TRUE;
$second = FALSE;

A. Booleans
B. Floats
C. Strings
D. Arrays

A

A. Booleans

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What will the following code output to the terminal?

$first = TRUE;

$second = FALSE;

$third = TRUE;

if ($first) {

if ($second){

echo "Option 1";

} else {

  echo "Option 2";

}

} elseif ($third) {

echo "Option 3";

} else {

echo “Option 4”;

}

A

Option 4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What will the following code output to the terminal?

$happy = TRUE;

if ($happy) {

echo “I’m so happy right now!”;

}

A. TRUE

B. $happy

C. I’m so happy right now!

D. Nothing

A

C. I’m so happy right now!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What will the following code output to the terminal?

$letter = “h”;

switch ($letter) {

case “h”:

echo "h";

case “e”:

echo "e";

case “l”:

echo "l";

case “x”:

echo "l";

case “o”:

echo "o";   

}

A. hel

B. helo

C. hello

D. h

A

hello

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What will the following code output to the terminal?

$mood_color = “red”;

switch ($mood_color){

case "green": 

  echo "You're feeling happy.";

  break;

case "yellow": 

  echo "You're feeling energized.";

  break;

case "black": 

  echo "You're feeling scared.";

  break;

case "red":

  echo "You're feeling angry.";

  break;

}

A. You’re feeling energized.

B. You’re feeling scared.

C. You’re feeling happy.

D. You’re feeling angry.

A

D. You’re feeling angry.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What will the following code output to the terminal?

$mood_color = “red”;

switch ($mood_color){

case "green": 

  echo "You're feeling happy.";

  break;

case "yellow": 

  echo "You're feeling energized.";

  break;

case "black": 

  echo "You're feeling scared.";

  break;

case "red":

  echo "You're feeling angry.";

  break;

}

A. You’re feeling angry.

B. You’re feeling energized.

C. You’re feeling happy.

D. You’re feeling scared.

A

A. You’re feeling angry.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What will the following code return?

$score = 77;

if ($score < 60) {

return “F”;

} elseif ($score < 70) {

return “D”;

} elseif ($score < 80) {

return “C”;

} elseif ($score < 90) {

return “B”;

} else {

return “A”;

}

A. "A"
B. "B"
C. "C"
D. "D"
E. "F"
A

“C”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What will the following print to the terminal?

$happy = FALSE;

if ($happy){

echo “I’m so happy right now!”;

} else {

echo “I’m so sad…”;

}

A. FALSE

B. I’m so sad…

C. Nothing

D. I’m so happy right now!

A

B. I’m so sad…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

“PHP runs on different platforms (Windows, Linux, Unix, etc.)”

A. Only on Windows
B. Only on Mac
C. Only on Linux/Unix
D. All operating systems mentioned above

A

D. All operating systems mentioned above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

A PHP script should start with ___ and end with ___:

A. < php >

B. < ? php ?>

C.

D.

A

D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

How do you display a double quote inside a string that begins and ends with double quotes?

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!

A

B. Use ", for example “He said "OK"”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Look at the following HTML form, then decide which one of the following statements is correct.

<p>Please enter your zip code:

</p>

A. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘zip-it’]

B. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘$zip-it’]

C. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘zipCode’]

D. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘$zipCode’]

E. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘zip code’]

A

C. When the processor executes zip-it.php, the zip code submitted by the user can be extracted from $_POST[‘zipCode’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

PHP scripts are executed on _______

A. ISP Computer
B. Client Computer
C. Server Computer
D. It depends on PHP scripts

A

C. Server Computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

PHP variable names must begin with

A. A lower-case letter
B. An upper-case letter
C. A dollar sign $
D. A number

A

C. A dollar sign $

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

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>”);

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

D. <p>Allow 0 hours for study</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

The arithmetic is wrong in the following PHP statement (it should be $price - $discount). Is this a syntax error or a logical error?

$salePrice = $discount - $price;

A. Syntax Error
B. Logical Error

A

B. Logical Error

36
Q

The following HTML form passes a value to sleepy-time.php with the name sleepHours. Which PHP statement would correctly receive this value and assign it to a PHP variable named $sleepHours?

<p>How many hours do you sleep each night:

</p>

A. $_POST[$sleepHours] = 'sleepHours';
B. $_POST['sleepHours'] = $sleepHours;
C. sleepHours = $_POST[$sleepHours];
D. $sleepHours = $_POST['sleepHours'];
E. $sleepHours = $_POST[$sleepHours];
A

D. $sleepHours = $_POST[‘sleepHours’];

37
Q

What is wrong with the following PHP code segment?
$discount = 2.50;
$itemCost = 10.50;
$reducedCost = $itemCost - $discount;
print (“REDUCED FOR QUICK SALE!! Your cost is only $” .$itemCost.”!<p></p>”);

A. The first and second statements are in the wrong order

B. The second and third statements are in the wrong order

C. The third and fourth statements are in the wrong order

D. The wrong variable is included in the print statement

E. The value stored in $reducedCost will be 10.50 when it should be 8.00

A

D. The wrong variable is included in the print statement

38
Q

What is wrong with the following PHP code segment?

$amount = 10.00;
$tax = $amount * 0.07;
$total = $tax + $amount;
print (“<p>TOTAL COST: $number_format($total, 2)</p>”);

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

C. The print statement will not display correctly.

39
Q

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>”);

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

A. The first and second statements are in the wrong order

40
Q

What value is stored in $result after this PHP instruction is executed?

$result = 2 + 3 * 5 - 1;

A. 14
B. 16
C. 20
D. 24
E. 28
A

B. 16

41
Q

What value is stored in $result after this PHP instruction is executed?

$result = (6 + 10) * (5 - 4);

A. 76
B. 16
C. 52
D. 100

A

B. 16

42
Q

What will be the output of the following PHP code ?

A. Hello World

B. Bye

C. Hello worldBye

D. Error

A

A. Hello World

43
Q

Which statement is true?

A. HTML files can contain HTML tags, text and PHP code
B. PHP files can contain PHP code but not HTML tags
C. PHP files can contain HTML tags, text and PHP code
D. PHP files can contain PHP code and text but not HTML tags
E. PHP files can contain HTML tags but no PHP code

A

C. PHP files can contain HTML tags, text and PHP code

44
Q

What does SQL stand for?

A. Standard Query Language
B. Static Query Language
C. Structured Query Language
D. Statistical Query Language

A

C. Structured Query Language

45
Q

Which clause is used with the ALTER TABLE statement?

A. JOIN
B. INTO
C. ADD COLUMN
D. SELECT

A

C. ADD COLUMN

46
Q

What would be correct syntax for a CREATE TABLE statement?

A. NEW TABLE meals (
name TEXT,
rating INTEGER
);

B. CREATE TABLE meals (
name TEXT,
rating INTEGER
);

C. CREATE meals (
name TEXT,
rating INTEGER
);

D. CREATE meals
name TEXT
rating INTEGER
);

A

B. CREATE TABLE meals (
name TEXT,
rating INTEGER
);

47
Q

What would you need to complete the associated UPDATE statement?

UPDATE ________
SET height = 6
WHERE id = 1;

A. A table name.
B. A row name.
C. The keyword INTO.
D. A column name.

A

A. A table name.

48
Q

What is the purpose of the * character?

SELECT * FROM celebs;

A. It selects the leftmost column in the table.
B. It selects every column in the table.
C. It only selects columns where values are not empty in the table.
D. It selects new values in the table.

A

B. It selects every column in the table.

49
Q

What is a relational database?

A. A database that organizes information into one or more tables.
B. A collection of data organized into rows and columns.
C. A single record in a table.
D. A set of data values of a particular type.

A

A. A database that organizes information into one or more tables.

50
Q

Which of the following statements is correct and complete?

A. WHERE flavor IS NULL;

B. WHERE flavor IS NULL
DELETE FROM icecream;

C. DELETE FROM icecream
WHERE flavor IS NULL;

D. DELETE icecream
WHERE flavor NULL;

A

C. DELETE FROM icecream

WHERE flavor IS NULL;

51
Q

What are common data types in SQL?

A. Integer, Text, Date, Real

B. Row, Column

C. id, name, age

D. PDF, JPEG, GIF, MP3

A

A. Integer, Text, Date, Real

52
Q

What is a NULL value?

A. An outdated value.

B. A numerical value.

C. A value that represents missing or unknown data.

D. A known value.

A

C. A value that represents missing or unknown data.

53
Q

What does the INSERT statement do?

A. Insert new columns into a table.

B. Insert new rows into a table.

C. Fetch data from a database.

D. Insert a new table into a database.

A

B. Insert new rows into a table.

54
Q

Which is correct?

A. A database contains tables and a table contains records and fields

B. A table contains databases and a database contains records and fields

C. A record contains tables and a table contains databases and fields

D. A database contains records and a record contains tables and fields

A

A. A database contains tables and a table contains records and fields

55
Q

Which is correct?

A. A table contains databases and a database contains records and fields.

B. A database contains tables and a table contains records and fields.

C. A database contains records and a record contains tables and fields.

D. A record contains fields and a field contains databases and tables.

A

B. A database contains tables and a table contains records and fields.

56
Q

Which of the following best describes a RDBMS?

A. A test database that is included with MySQL

B. A database used to store personnel data

C. A language used to submit queries

D. A system to store, manage and use relational databases

A

D. A system to store, manage and use relational databases

57
Q

A _____ is a sequence of characters of any length surrounded by quotation marks.

A. variable

B. string

C. data type

D. operator

A

B. string

58
Q

Fill in the code so that it outputs 5 to the terminal.

echo 35 [__________] 6;

A. **
B. +
C. \
D. *
E. -
F. %
A

F. %

59
Q

Fill in the code so that the quote by the creator of PHP is ignored by the interpreter.

A. / and /
B. /* and /*
C. */ and /
D. /
and */

A

D. /* and */

60
Q

Which symbol/statement would make sure the following is not executed: echo “Don’t print this”

A. /*
B. ?
C. delete
D. //

A

D. //

61
Q

Match the correct code so that if prints Pizza to the terminal

$favorite_food = “Red curry with egglplant”;
[ a ] [ b ] [ c ] ;
echo $favorite_food;

Choices:
A. $favorite_food
B. .
C. "Pizza"
D. =&
E. .=
F. $new_variable
G. =
A

a -> A. $favorite_food
b -> G. =
c -> C. “Pizza”

62
Q

Match the correct code so that it prints Tadpole, Princess of Dogulon to the terminal.

$name= “Tadpole”;
$title = “, Princess of Dogulon”;
[ a ] [ b ] [ c ] ;
echo $name;

Choices:
A. $name
B. .=
C. .
D. =
E. $title
F. =&
A

a -> A. $name
b -> B. .=
c -> E. $title

63
Q

What code would output the following to the terminal:

“Woah,” she said.
“Woah,” he agreed.

A. echo "Woah," she said.\n"Woah," he agreed.;

B. echo “"Woah," she said.”;
echo “"Woah," he agreed.”;

C. echo ““Woah,” she said.\n”Woah,” he agreed.”;

D. echo “"Woah," she said.\n"Woah," he agreed.”;

A

D. echo “"Woah," she said.\n"Woah," he agreed.”;

64
Q

What does the following code output to the terminal:

echo “one”;
echo “two”;
echo “three”;

A. one
two
three

B. one two three

C. onetwothree

A

C. onetwothree

65
Q

What must be used to terminate each statement in PHP?

A. #
B. A newline
C. ;
D. //

A

C. ;

66
Q

What will the following code output to the terminal:

$name = “Aisle Nevertell”;
$favorite_band = “I Panjohur”;
echo “Heya I’m $name and my favorite band is $favorite_band”;

A. Nothing. It will result in an error.

B. Heya I’m $name and my favorite band is $favorite_band

C. Heya I’m Aisle Nevertell and my favorite band is I Panjohur

D. Heya I’m AisleNevertell and my favorite band is IPanjohur

A

C. Heya I’m Aisle Nevertell and my favorite band is I Panjohur

67
Q

What will the following code output to the terminal:

“hello” . “ “ . “my” . “name” . “is” . “Aisle.”;

A. hello
B. hello mynameisAisle.

A

B. hello mynameisAisle.

68
Q

What will the following print to the terminal?

echo 1 + 3 * (9 / 3) ** (1 + 1);

A. 28
B. 11
C. 144

A

A. 28

69
Q

What will this code print to the terminal?

$number = 0;
$number += 5;
$number -= 1;
$number *= 2;
$number /= 4;
$number *= 5;
$number %= 3;
echo $number + $number;
A. 1
B. 2
C. 3
D. 6
E. 6.67
A

B. 2

70
Q

What will this code print to the terminal?

$special_number = 9;
echo $special_number + 1;
echo $special_number;

A. 10
9

B. 109

C. 1010

A

B. 109

71
Q

What’s the value of the $volume variable from the provided code?

$side_length = 2; $volume = $side_length ** 3;

A. 6
B. 8
C. 5

A

B. 8

72
Q

When creating a standalone PHP file, what is required?

A. The filename should end with .php, the code must start with .

B. The filename should end with .php and the code must start with . No closing tag is required.

C. The filename should end with .php. No opening or closing tags are required inside the file.

D. The filename should end with .php and the code must start with

A

A. The filename should end with .php, the code must start with .

73
Q

Which is true about dynamic web pages?

A. A dynamic PHP web page can provide a page that is customized for each visitor.

B. Dynamic web pages contain CSS animations.

C. Dynamic web pages provide the same response for each visitor.

D. Dynamic web pages must use JavaScript.

A

A. A dynamic PHP web page can provide a page that is customized for each visitor.

74
Q

Which of the following is an example of correctly declaring and assigning a PHP variable? There is more than one answer.

Answers:
A. $my_variable . “Quizzes are fun!”;

B. my_variable = “Quizzes are fun!”;

C. “my_variable” = “Quizzes are fun!”;

D. $my variable” = “Quizzes are fun!”;

E. $_my_variable = “Quizzes are fun!”;

F. $myVariable = “Quizzes are fun!”;

A

E. $_my_variable = “Quizzes are fun!”;

F. $myVariable = “Quizzes are fun!”;

75
Q

Which of the following is not equivalent to echo “Hello”; in PHP?

A. ec ho “Hello”;

B. Echo “Hello”;

C. echo “Hello”;

D. ECHO “Hello”;

A

A. ec ho “Hello”;

76
Q

Which operator can be used to perform string concatenation, or joining strings, in PHP?

A. +
B. =
C. .

A

C. .

77
Q

Which variable has an integer value assigned to it?

$num_one = -12763;
$num_two = -124.9;
$num_three = "3";
$num_four = 2.5;

A. $num_two
B. $num_three
C. $num_four
D. $num_one

A

D. $num_one

78
Q

When you enter a URL, you’re creating a(n) ____ link, which is the full and complete address for the target document on the web

A

absolute

79
Q

The first section below showing “https:” is the __________.

https://go.waketech.edu/student/public/ProgramsOfStudyDocs/A25590CP-Day.pdf

A

scheme

80
Q

What is the domain name of the Internet address that you will use to access Web pages delivered by your standalone server?

A

localhost

81
Q

Suppose your standalone Web server is installed on a USB drive in location H:\xampp. What would be the correct URL for a file stored in the following location: H:\xampp\htdocs\webtech\coursework\chapter02\my-work.html

A

http://localhost/webtech/coursework/chapter02/my-work.html

82
Q

What do we usually use to represent IP addresses?

A

An Internet domain name

83
Q

T/F. Your standalone Web server must be running in order for your Web browser to successfully connect to http://localhost

A

True

84
Q

Which of the following is NOT a characteristic of the Web server component of a Web application?

A

Submits a user’s request

85
Q

What is wrong with the following URL?

http://images/www.myweb.com/home.html

A

The file name is in the wrong location

images should be after home