Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YML Syntax corrections in Strings Patterns #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/arrays.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ questions:
question: 'Which from the following list is not an appropriate use of an array?'
answers:
- {value: 'As a list', correct: false}
- {value: 'All of these uses are valid ', correct: true}
- {value: 'All of these uses are valid', correct: true}
- {value: 'As a Lookup Table', correct: false}
- {value: 'A Stack', correct: false}
- {value: 'As a hash table', correct: false}
Expand Down Expand Up @@ -142,7 +142,7 @@ questions:
answers:
- {value: '$array_three = array_merge(array_reverse($array_one), $array_two);', correct: false}
- {value: '$array_three = array_combine($array_one, $array_two);', correct: false}
- {value: '$array_three = array_combine(array_reverse($array_one), $array_two); ', correct: true}
- {value: '$array_three = array_combine(array_reverse($array_one), $array_two);', correct: true}
- {value: '$array_three = array_merge($array_one, $array_two);', correct: false}
- {value: '$array_three = array_reverse($array_one) + $array_two;', correct: false}
-
Expand Down Expand Up @@ -173,7 +173,7 @@ questions:
- {value: 'import_variables', correct: false}
- {value: 'list', correct: true}
-
question: |
question: |
The following code snippet displays what for the resultant array?
$a = [1 => 0, 3 => 2, 4 => 6];
$b = [3 => 1, 4 => 3, 6 => 4];
Expand Down
4 changes: 2 additions & 2 deletions data/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ questions:
-
question: 'What is the best way to iterate and modify every element of an array using PHP?'
answers:
- {value: You cannot modify an array during iteration., correct: false}
- {value: 'You cannot modify an array during iteration.', correct: false}
- {value: 'for ($i = 0; $i < count($array); $i++) { /* ... * / }', correct: false}
- {value: 'foreach ($array as $key => &$val) { /* ... * / }', correct: true}
- {value: 'foreach ($array as $key => $val) { /* ... * / }', correct: false}
Expand All @@ -31,7 +31,7 @@ questions:
echo $array[$array[FOO]] * $array["FOO"];

answers:
- {value: FOO, correct: false}
- {value: 'FOO', correct: false}
- {value: 100, correct: false}
- {value: 200, correct: true}
- {value: 20, correct: false}
Expand Down
4 changes: 2 additions & 2 deletions data/functions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
category: Functions
questions:
-
question: What is the best way to ensure that a user-defined function is always passed an object as its single parameter?
question: 'What is the best way to ensure that a user-defined function is always passed an object as its single parameter?'
answers:
- {value: 'function myfunction(stdClass $a)', correct: true}
- {value: 'function myfunction($a = stdClass)', correct: false}
Expand Down Expand Up @@ -34,7 +34,7 @@ questions:
- {value: '__halt_compiler();', correct: true}
- {value: 'exit();', correct: true}
-
question: What is the difference between the ``include`` and ``require`` language constructs?
question: 'What is the difference between the ``include`` and ``require`` language constructs?'
answers:
- {value: 'Require constructs can''t be used with URL filenames', correct: false}
- {value: 'Include constructs cause a fatal error if the file doesn''t exist', correct: false}
Expand Down
4 changes: 2 additions & 2 deletions data/input-output.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
category: Input/Output
questions:
-
question: How does one access standard input/output and error streams in PHP?
question: 'How does one access standard input/output and error streams in PHP?'
answers:
- {value: 'STDIN, STDOUT and STDERR constants', correct: true}
- {value: 'Use stdin(), stdout() and stderr() functions', correct: false}
- {value: 'PHP::STDIN, PHP::STDOUT and PHP::STDERR class constants', correct: false}
- {value: 'Use PHP::stdin(), PHP::stdout() and PHP::stderr() class functions', correct: false}
-
question: How to access standard error stream in PHP?
question: 'How to access standard error stream in PHP?'
answers:
- {value: '$stderr = STDERR;', correct: true}
- {value: '$stderr = fopen("php://stderr", "w");', correct: true}
Expand Down
14 changes: 7 additions & 7 deletions data/strings-patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ questions:
- {value: '$a = "Value: $value";', correct: false}
- {value: '$a = "Value: {$value[''val'']}";', correct: false}
-
question: |
question: |
What variable reference would go in the spots indicated by ????? in the code segment below?
$msg = "The Quick Brown Foxed Jumped Over the Lazy Dog";
$state = true;
Expand All @@ -37,7 +37,7 @@ questions:
- {value: 'chr($msg);', correct: false}
- {value: 'substr($msg, $i, 2);', correct: false}
-
question: |
question: |
Given the two values below, which of the following possibilities will print 10 foos20 bars?
$var1 = "10 foos";
$var2 = "20 bars";
Expand Down Expand Up @@ -71,7 +71,7 @@ questions:
- {value: 'preg_split("-=-", $string);', correct: false}
- {value: 'explode("-=-", $string);', correct: true}
-
question: |
question: |
What is the output of the following code?
$string = "14302";
$string[$string[2]] = "4";
Expand Down Expand Up @@ -99,7 +99,7 @@ questions:
- {value: 'str_compare()', correct: false}
- {value: 'strstr()', correct: false}
-
question: |
question: |
Consider the following script:
$oranges = 10;
$apples = 5;
Expand All @@ -115,7 +115,7 @@ questions:
- {value: 'print sprintf($apples, $oranges);', correct: false}
- {value: 'sprintf($string, $oranges, $apples);', correct: false}
-
question: |
question: |
Which functions would be needed to translate the following string:
I love PHP
to the following?
Expand All @@ -127,11 +127,11 @@ questions:
- {value: 'str_reverse()', correct: false}
- {value: 'strrev()', correct: true}
-
question: |
question: |
Which string does the following PCRE regular expression match?
$regex = "/^([a-z]{5})[1-5]+([a-z]+)/";
answers:
- {value: Hello34262343goodbye', correct: false}
- {value: 'Hello34262343goodbye', correct: false}
- {value: 'frank12345abc', correct: true}
- {value: 'hello34212343goodbye', correct: true}
- {value: 'abcdefghi12345abc', correct: false}
Expand Down
4 changes: 2 additions & 2 deletions data/web-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ questions:
- {value: 'Use the session_regenerate_id() function', correct: false}
- {value: 'Implement a custom session handler', correct: false}
-
question: |
question: |
Consider the following HTML fragment:
<select name="?????" multiple>
<option value="1">Item #1</option>
Expand Down Expand Up @@ -92,7 +92,7 @@ questions:
- {value: 'Use the $_SERVER[''PHP_AUTH_USER''] and $_SERVER[''PHP_AUTH_PW''] variables', correct: true}
- {value: 'Parse the $_SERVER[''REQUEST_URI''] variable', correct: false}
-
question: |
question: |
Consider the following function:
function redirect($url) {
// Check to make sure we haven't already sent
Expand Down