Пример запроса (первая клетка). System одинаковый во всех запросах прогона, user — свой вопрос для каждой клетки:
| Клетка | Тема | Утверждение | Ответ |
Результат | Обоснование |
T01-L1 3.13 c | Syntax and operators | Double-quoted and single-quoted strings are processed identically; the difference is only in speed. | «no» Пояснение: Double-quoted strings support variable interpolation and escape sequences, while single-quoted strings do not.
Raw{"answer": "no", "explanation": "Double-quoted strings support variable interpolation and escape sequences, while single-quoted strings do not."} | верно | В двойных кавычках работают интерполяция переменных и escape-последовательности, в одинарных — нет. |
T01-L2 0.39 c | Syntax and operators | The ?? operator follows isset semantics and raises no warnings for undefined variables. | «yes» Пояснение: The null coalescing operator (??) checks if the left operand is set and not null, returning the right operand otherwise, without triggering notices or warnings for undefined variables.
Raw{"answer": "yes", "explanation": "The null coalescing operator (??) checks if the left operand is set and not null, returning the right operand otherwise, without triggering notices or warnings for undefined variables."} | верно | ?? работает по семантике isset — несуществующие переменные и ключи допустимы. |
T01-L3 0.39 c | Syntax and operators | What will this print: echo 'a', 'b'; | «ab» Пояснение: In PHP, the comma operator in an echo statement outputs each string argument sequentially without any separator, resulting in the concatenated string 'ab'.
Raw{"answer": "ab", "explanation": "In PHP, the comma operator in an echo statement outputs each string argument sequentially without any separator, resulting in the concatenated string 'ab'."} | верно | echo принимает список аргументов: ab. |
T01-L4 0.45 c | Syntax and operators | print returns the value 1 and can be used inside an expression. | «yes» Пояснение: In PHP, the `print` construct evaluates to 1, so it can be used in expressions (e.g., `$x = print "Hello";` sets `$x` to 1).
Raw{"answer": "yes", "explanation": "In PHP, the `print` construct evaluates to 1, so it can be used in expressions (e.g., `$x = print \"Hello\";` sets `$x` to 1)."} | верно | print — выражение со значением 1, в отличие от echo, который значения не возвращает. |
T01-L5 0.31 c | Syntax and operators | The ?: (elvis) operator returns its left operand when it is falsy. | «no» Пояснение: The Elvis operator returns its left operand when it is NOT falsy (i.e., truthy), and otherwise returns its right operand.
Raw{"answer": "no", "explanation": "The Elvis operator returns its left operand when it is NOT falsy (i.e., truthy), and otherwise returns its right operand."} | верно | Наоборот: $a ?: $b возвращает $a, если он истинный, иначе $b. |
T01-L6 1.59 c | Syntax and operators | In PHP 8, the concatenation operator (.) has lower precedence than addition and subtraction. | «yes» Пояснение: In PHP, arithmetic operators like addition (+) and subtraction (-) have higher precedence than the concatenation operator (.), so 1 + 2 . 3 would be interpreted as (1 + 2) . 3 = 3 . 3 = '33'. The concatenation operator actually has the same precedence as multiplication and division, making this statement false... wait, let me reconsider.
Actually, in PHP, the precedence is: arithmetic (+, -) > concatenation (.) > comparison. So concatenation has LOWER precedence than + and -. So the statement is true.
Wait, let me be precise. PHP precedence (higher to lower):
- Arithmetic: +, -, *, /, % (all higher than concatenation)
- Concatenation: . (lower than arithmetic)
- So yes, concatenation has lower precedence than addition and subtraction. Statement is true.
Raw{"answer": "yes", "explanation": "In PHP, arithmetic operators like addition (+) and subtraction (-) have higher precedence than the concatenation operator (.), so 1 + 2 . 3 would be interpreted as (1 + 2) . 3 = 3 . 3 = '33'. The concatenation operator actually has the same precedence as multiplication and division, making this statement false... wait, let me reconsider.\n\nActually, in PHP, the precedence is: arithmetic (+, -) > concatenation (.) > comparison. So concatenation has LOWER precedence than + and -. So the statement is true.\n\nWait, let me be precise. PHP precedence (higher to lower): \n- Arithmetic: +, -, *, /, % (all higher than concatenation)\n- Concatenation: . (lower than arithmetic)\n- So yes, concatenation has lower precedence than addition and subtraction. Statement is true."} | верно | С PHP 8 (RFC concat precedence) '.' имеет приоритет ниже арифметики: 'сумма: ' . 2 + 3 → 'сумма: 5' (в PHP 7 было иначе). |
T01-L7 0.49 c | Syntax and operators | The expression 2 ** 3 ** 2 in PHP evaluates as (2 ** 3) ** 2, that is, 64. | «no» Пояснение: In PHP, the power operator (**) is right-associative, so 2 ** 3 ** 2 evaluates as 2 ** (3 ** 2), which is 2 ** 9 = 512, not (2 ** 3) ** 2 = 64.
Raw{"answer": "no", "explanation": "In PHP, the power operator (**) is right-associative, so 2 ** 3 ** 2 evaluates as 2 ** (3 ** 2), which is 2 ** 9 = 512, not (2 ** 3) ** 2 = 64."} | верно | ** право-ассоциативен: 2 ** (3 ** 2) = 2 ** 9 = 512. |
T01-L8 0.46 c | Syntax and operators | What string will this print: echo 'sum: ' . 2 + 3; (PHP 8)? | «sum: 5» Пояснение: In PHP 8, the concatenation operator '.' has lower precedence than the arithmetic addition operator '+', so the expression is evaluated as 'sum: ' . (2 + 3), resulting in the string 'sum: 5'.
Raw{"answer": "sum: 5", "explanation": "In PHP 8, the concatenation operator '.' has lower precedence than the arithmetic addition operator '+', so the expression is evaluated as 'sum: ' . (2 + 3), resulting in the string 'sum: 5'."} | верно | Парная к verify-клетке про приоритет: 'сумма: 5'. |
T02-L1 0.32 c | Types and comparisons | With strict comparison (===), arrays are considered equal regardless of element order. | «no» Пояснение: In PHP, the === operator on arrays requires them to have the same key-value pairs in the same order.
Raw{"answer": "no", "explanation": "In PHP, the === operator on arrays requires them to have the same key-value pairs in the same order."} | верно | === для массивов требует совпадения и значений, и их порядка. |
T02-L2 0.35 c | Types and comparisons | The comparison 0 == false returns false because it is a strict comparison. | «no» Пояснение: PHP uses loose comparison with ==, so 0 == false evaluates to true because both values are equivalent.
Raw{"answer": "no", "explanation": "PHP uses loose comparison with ==, so 0 == false evaluates to true because both values are equivalent."} | верно | Наоборот: == — нестрогое сравнение и возвращает true; строгое — это === (0 === false → false). |
T02-L3 0.47 c | Types and comparisons | In PHP 8, the expression "abc" == 0 returns true. | «no» Пояснение: In PHP 8, the loose comparison '==' has been updated to no longer coerce non-numeric strings to zero, so 'abc' == 0 evaluates to false.
Raw```json ⏎ {"answer": "no", "explanation": "In PHP 8, the loose comparison '==' has been updated to no longer coerce non-numeric strings to zero, so 'abc' == 0 evaluates to false."} ⏎ ``` | верно | С PHP 8 нечисловая строка сравнивается как строка: "abc" == "0" → false (в PHP 7 было true). |
T02-L4 0.31 c | Types and comparisons | Under loose comparison, null equals 0, the empty string, and false at the same time. | «yes» Пояснение: In loose comparison (==), null equals 0, the empty string (''), and false.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In loose comparison (==), null equals 0, the empty string (''), and false." ⏎ } ⏎ ``` | верно | null == 0, null == "" и null == false — все true. |
T02-L5 0.31 c | Types and comparisons | What does the expression (int) '42abc' return? | «42» Пояснение: Casting a string starting with valid integer digits to int stops at the first non-numeric character.
Raw{"answer": 42, "explanation": "Casting a string starting with valid integer digits to int stops at the first non-numeric character."} | верно | Ведущая числовая часть: 42, без ошибок и warning. |
T02-L6 0.31 c | Types and comparisons | What does the expression '5' + 5 return? | «10» Пояснение: In PHP, the string '5' is cast to the integer 5, and 5 + 5 equals 10.
Raw{"answer": 10, "explanation": "In PHP, the string '5' is cast to the integer 5, and 5 + 5 equals 10."} | верно | Числовая строка приводится: int 10. |
T02-L7 1.08 c | Types and comparisons | When cast to string, false becomes "0". | «yes» Пояснение: Casting false to a string in PHP results in an empty string, not "0".
Raw{"answer": "yes", "explanation": "In PHP, when the boolean value false is cast to a string, it results in the empty string \"\" (or more precisely, an empty string, but historically and in many contexts, it is treated as falsy and converts to \"0\" in arithmetic contexts; however, strict string casting of false is actually empty string \"\". Let me correct: var_dump((string)false) outputs string(0) \"\". So the statement is false.)", "explanation": "Casting false to a string in PHP results in an empty string, not \"0\"."} | неверно верный: «no» | false → "", true → "1". |
T02-L8 0.48 c | Types and comparisons | The comparison 0.1 + 0.2 === 0.3 returns false. | «yes» Пояснение: The comparison is false because 0.1 + 0.2 results in 0.30000000000000004, which is not strictly equal (===) to 0.3.
Raw{"answer": "yes", "explanation": "The comparison is false because 0.1 + 0.2 results in 0.30000000000000004, which is not strictly equal (===) to 0.3."} | верно | Двоичная погрешность float: 0.1 + 0.2 = 0.30000000000000004. |
T03-L1 0.37 c | Strings | strrev() correctly reverses a UTF-8 string. | «no» Пояснение: strrev() reverses individual bytes, which corrupts multi-byte UTF-8 characters; use mb_strrev() instead.
Raw{"answer": "no", "explanation": "strrev() reverses individual bytes, which corrupts multi-byte UTF-8 characters; use mb_strrev() instead."} | верно | strrev переворачивает байты и ломает многобайтовые последовательности. |
T03-L2 0.29 c | Strings | str_contains('Hello world', 'world') returns true. | «yes» Пояснение: str_returns returns true because the substring 'world' is indeed present in the string 'Hello world'.
Raw{"answer": "yes", "explanation": "str_returns returns true because the substring 'world' is indeed present in the string 'Hello world'."} | верно | str_contains с PHP 8.0 проверяет вхождение подстроки. |
T03-L3 0.32 c | Strings | str_pad() can pad a string on the right side only. | «no» Пояснение: str_pad() supports padding on the left, right, or both sides using the STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH constants.
Raw{"answer": "no", "explanation": "str_pad() supports padding on the left, right, or both sides using the STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH constants."} | верно | STR_PAD_LEFT / STR_PAD_BOTH меняют сторону дополнения. |
T03-L4 0.29 c | Strings | By default trim() strips only spaces, leaving tabs and newlines intact. | «no» Пояснение: By default, trim() strips spaces, tabs, newlines, carriage returns, NUL bytes, and vertical tabs.
Raw{"answer": "no", "explanation": "By default, trim() strips spaces, tabs, newlines, carriage returns, NUL bytes, and vertical tabs."} | верно | Список символов по умолчанию: « \t\n\r\0\x0B» — пробелы, табы, переводы строк, возврат каретки, null-байт, вертикальный таб. Проверено php -r. |
T03-L5 0.35 c | Strings | How many BYTES does strlen('héllo') return for a UTF-8 string? | «6» Пояснение: The string 'héllo' contains 5 characters, but the 'é' is encoded as 2 bytes in UTF-8, resulting in a total of 6 bytes.
Raw{"answer": 6, "explanation": "The string 'héllo' contains 5 characters, but the 'é' is encoded as 2 bytes in UTF-8, resulting in a total of 6 bytes."} | верно | 6 букв по 2 байта: 12. |
T03-L6 0.38 c | Strings | What does substr('abcdef', -3) return? | «def» Пояснение: substr with a negative start position counts from the end of the string, so -3 starts at the third-to-last character.
Raw{"answer": "def", "explanation": "substr with a negative start position counts from the end of the string, so -3 starts at the third-to-last character."} | верно | Отрицательное смещение — с конца: def. |
T03-L7 0.33 c | Strings | ucfirst() modifies the string passed to it in place. | «no» Пояснение: ucfirst() is a function that returns a new string with the first character capitalized, it does not modify the original string.
Raw```json ⏎ {"answer": "no", "explanation": "ucfirst() is a function that returns a new string with the first character capitalized, it does not modify the original string."} ⏎ ``` | верно | Строки неизменяемы; ucfirst возвращает новую строку. |
T03-L8 0.35 c | Strings | Variable interpolation works in heredoc but not in nowdoc. | «yes» Пояснение: Heredoc allows variable interpolation and evaluation, whereas nowdoc treats the content as a raw string without interpolating variables.
Raw{"answer": "yes", "explanation": "Heredoc allows variable interpolation and evaluation, whereas nowdoc treats the content as a raw string without interpolating variables."} | верно | Nowdoc — «одинарные кавычки» в тройном синтаксисе: текст как есть. |
T04-L1 0.25 c | Arrays | The sort() function preserves the key-to-value association of the array. | «no» Пояснение: sort() reindexes the array numerically, destroying the original keys.
Raw{"answer": "no", "explanation": "sort() reindexes the array numerically, destroying the original keys."} | верно | sort перенумеровывает ключи; связь сохраняет asort. |
T04-L2 0.29 c | Arrays | The string key '5' in an array is stored as the integer 5. | «yes» Пояснение: In PHP, string keys that represent valid integers are automatically converted to integer keys.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In PHP, string keys that represent valid integers are automatically converted to integer keys." ⏎ } ⏎ ``` | верно | Каноничные десятичные строковые ключи приводятся к int. |
T04-L3 0.29 c | Arrays | The in_array() function uses strict comparison (===) by default. | «no» Пояснение: The in_array() function uses loose comparison (==) by default; the third parameter must be set to true to enable strict comparison (===).
Raw{"answer": "no", "explanation": "The in_array() function uses loose comparison (==) by default; the third parameter must be set to true to enable strict comparison (===)."} | верно | По умолчанию сравнение нестрогое; строгое — третий аргумент true. |
T04-L4 0.39 c | Arrays | Without a callback, array_filter() removes all "empty" (falsy) elements from the array. | «yes» Пояснение: When no callback is provided, array_filter() keeps elements where (bool) element is true, effectively removing all falsy values like 0, '0', '', null, and false.
Raw{"answer": "yes", "explanation": "When no callback is provided, array_filter() keeps elements where (bool) element is true, effectively removing all falsy values like 0, '0', '', null, and false."} | верно | Убирает 0, "", null, false и пустые массивы. |
T04-L5 6.61 c | Arrays | By default, array_slice() preserves the original numeric keys of the array. | «yes» Пояснение: By default, the $preserve_keys parameter of array_slice() is false, but wait, actually the default behavior depends on the version. In PHP 4 and earlier, it did not preserve keys. In PHP 5+, array_slice() has a third parameter $preserve_keys which defaults to false. However, if you look closely at the documentation: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' Wait, let me double-check. Actually, the manual states: 'array_slice ( array $array , int $offset , int $length = null , bool $preserve_keys = false ) : array'. If $preserve_keys defaults to false, then keys are re-indexed. Let me re-read the official PHP documentation. The PHP manual for array_slice says: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This contradicts the function signature showing false as default. Let's check a reliable source. According to the official PHP manual: 'array_slice(array $array, int $offset, ?int $length = null, bool $preserve_keys = false): array'. And the description says: 'This function returns the selected elements from the input array. ... Note: By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is a known inconsistency in older documentation or a specific behavior. Actually, testing in PHP 7/8: if I run array_slice(['a'=>1,'b'=>2], 1), I get [1=>2]. The key 'b' is lost? No, wait. If I run it: php -r 'var_dump(array_slice(["a"=>1, "b"=>2], 1));' it returns array(1) { [1]=> int(2) }. So the numeric key 1 is preserved? If the input was numeric keys [0=>1, 1=>2, 2=>3], array_slice(..., 1) returns [1=>2, 2=>3]. So it DOES preserve the original numeric keys by default. The third parameter $preserve_keys defaults to false, but this parameter only affects whether string keys are preserved? No, that's not right. Let's look at the signature again. If $preserve_keys is false, it re-indexes. If it re-indexes, [0=>1, 1=>2, 2=>3] sliced at 1 would be [0=>2, 1=>3]. But actually, array_slice DOES preserve numeric keys by default. The $preserve_keys parameter, when false, causes the array to be re-indexed IF it contains string keys? No, that's not accurate. The correct behavior is: array_slice preserves the keys of the elements it returns. The third parameter $preserve_keys, when set to false (default), causes the resulting array to be re-indexed from 0. BUT, there is a caveat. Let me check the actual behavior. In PHP, array_slice([0=>1, 1=>2, 2=>3], 1) returns [1=>2, 2=>3]. It does NOT re-index to [0=>2, 1=>3]. So the keys ARE preserved. Why? Because the $preserve_keys parameter was added in PHP 4.2.0 and defaults to false. However, the documentation for the third parameter says: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is clearly wrong in the manual description if the default is false. Wait, I am misremembering the signature. Let's check: array_slice(array $array, int $offset, int $length = null, bool $preserve_keys = false). If default is false, it should re-index. But it doesn't. Why? Ah, I found the truth. The PHP manual states: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is a known error in the manual description. The actual behavior is that it preserves keys by default. The $preserve_keys parameter, when explicitly set to false, will re-index the array. But if it's not provided, it preserves keys. Therefore, the statement is true.
Raw{"answer": "yes", "explanation": "By default, the $preserve_keys parameter of array_slice() is false, but wait, actually the default behavior depends on the version. In PHP 4 and earlier, it did not preserve keys. In PHP 5+, array_slice() has a third parameter $preserve_keys which defaults to false. However, if you look closely at the documentation: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' Wait, let me double-check. Actually, the manual states: 'array_slice ( array $array , int $offset , int $length = null , bool $preserve_keys = false ) : array'. If $preserve_keys defaults to false, then keys are re-indexed. Let me re-read the official PHP documentation. The PHP manual for array_slice says: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This contradicts the function signature showing false as default. Let's check a reliable source. According to the official PHP manual: 'array_slice(array $array, int $offset, ?int $length = null, bool $preserve_keys = false): array'. And the description says: 'This function returns the selected elements from the input array. ... Note: By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is a known inconsistency in older documentation or a specific behavior. Actually, testing in PHP 7/8: if I run array_slice(['a'=>1,'b'=>2], 1), I get [1=>2]. The key 'b' is lost? No, wait. If I run it: php -r 'var_dump(array_slice([\"a\"=>1, \"b\"=>2], 1));' it returns array(1) { [1]=> int(2) }. So the numeric key 1 is preserved? If the input was numeric keys [0=>1, 1=>2, 2=>3], array_slice(..., 1) returns [1=>2, 2=>3]. So it DOES preserve the original numeric keys by default. The third parameter $preserve_keys defaults to false, but this parameter only affects whether string keys are preserved? No, that's not right. Let's look at the signature again. If $preserve_keys is false, it re-indexes. If it re-indexes, [0=>1, 1=>2, 2=>3] sliced at 1 would be [0=>2, 1=>3]. But actually, array_slice DOES preserve numeric keys by default. The $preserve_keys parameter, when false, causes the array to be re-indexed IF it contains string keys? No, that's not accurate. The correct behavior is: array_slice preserves the keys of the elements it returns. The third parameter $preserve_keys, when set to false (default), causes the resulting array to be re-indexed from 0. BUT, there is a caveat. Let me check the actual behavior. In PHP, array_slice([0=>1, 1=>2, 2=>3], 1) returns [1=>2, 2=>3]. It does NOT re-index to [0=>2, 1=>3]. So the keys ARE preserved. Why? Because the $preserve_keys parameter was added in PHP 4.2.0 and defaults to false. However, the documentation for the third parameter says: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is clearly wrong in the manual description if the default is false. Wait, I am misremembering the signature. Let's check: array_slice(array $array, int $offset, int $length = null, bool $preserve_keys = false). If default is false, it should re-index. But it doesn't. Why? Ah, I found the truth. The PHP manual states: 'By default, array_slice() preserves keys. To re-index the array, pass true as the third argument.' This is a known error in the manual description. The actual behavior is that it preserves keys by default. The $preserve_keys parameter, when explicitly set to false, will re-index the array. But if it's not provided, it preserves keys. Therefore, the statement is true."} | неверно верный: «no» | По умолчанию ключи перенумеровываются; сохранение — preserve_keys = true. |
T04-L6 0.38 c | Arrays | What does array_slice([10, 20, 30, 40], 1, 2) return? | «{"answer": [20, 30], "explanation": "array_slice extracts 2 elements starting from index 1 of the array [10, 20, 30, 40]."}» Пояснение: {"answer": [20, 30], "explanation": "array_slice extracts 2 elements starting from index 1 of the array [10, 20, 30, 40]."}
Raw{"answer": [20, 30], "explanation": "array_slice extracts 2 elements starting from index 1 of the array [10, 20, 30, 40]."} | верно парсинг: текст (фолбэк) | [20,30]; ключи перенумеровываются. |
T04-L7 0.51 c | Arrays | How many elements will count(['a' => 1] + ['a' => 9, 'b' => 2]) return? | «2» Пояснение: The array union operator (+) does not overwrite keys; it keeps the original value for duplicate keys, resulting in ['a' => 1, 'b' => 2], which has 2 elements.
Raw{"answer": 2, "explanation": "The array union operator (+) does not overwrite keys; it keeps the original value for duplicate keys, resulting in ['a' => 1, 'b' => 2], which has 2 elements."} | верно | Оператор + : по ключу 'a' побеждает левый; итого 2. |
T04-L8 0.3 c | Arrays | Since PHP 8.1, the spread operator [...$a, ...$b] supports arrays with string keys. | «no» Пояснение: The spread operator supports arrays with string keys from PHP 8.1 onwards.
Raw```json ⏎ {"answer": "no", "explanation": "The spread operator supports arrays with string keys from PHP 8.1 onwards."} ⏎ ``` | неверно верный: «yes» | В 8.0 — только числовые ключи; 8.1 снял ограничение. |
T05-L1 0.37 c | Functions and closures | Named arguments cannot be combined with argument unpacking ...$args in a single call. | «yes» Пояснение: Since PHP 8.0, you cannot mix named arguments with argument unpacking (e.g., $args) in a single function call.
Raw```json ⏎ {"answer": "yes", "explanation": "Since PHP 8.0, you cannot mix named arguments with argument unpacking (e.g., $args) in a single function call."} ⏎ ``` | неверно верный: «no» | Можно: f(...$args, имя: значение). Нельзя только позиционный аргумент после распаковки. |
T05-L2 0.37 c | Functions and closures | An anonymous function without use sees variables from the outer scope. | «no» Пояснение: In PHP, anonymous functions (closures) have their own scope and cannot directly access variables from the outer scope unless explicitly imported using the 'use' keyword.
Raw```json ⏎ {"answer": "no", "explanation": "In PHP, anonymous functions (closures) have their own scope and cannot directly access variables from the outer scope unless explicitly imported using the 'use' keyword."} ⏎ ``` | верно | Без use внешние переменные недоступны; авто-захват только у fn. |
T05-L3 0.26 c | Functions and closures | What will func_num_args() return inside function f($a) { return func_num_args(); } when called as f(1, 2, 3)? | «3» Пояснение: func_num_args() returns the number of arguments passed to the function, which is 3 in this case.
Raw{"answer": 3, "explanation": "func_num_args() returns the number of arguments passed to the function, which is 3 in this case."} | верно | Считает переданные аргументы: 3. |
T05-L4 0.32 c | Functions and closures | The body of an arrow function fn may consist of several expressions in curly braces. | «no» Пояснение: Arrow functions (fn) in PHP can only have a single expression as the body and cannot use curly braces for multiple statements.
Raw{"answer": "no", "explanation": "Arrow functions (fn) in PHP can only have a single expression as the body and cannot use curly braces for multiple statements."} | верно | fn — всегда одно выражение; блок операторов делает обычная анонимная функция. |
T05-L5 0.35 c | Functions and closures | An arrow function fn captures outer variables by reference (lazily, at use time). | «no» Пояснение: Arrow functions (fn) capture outer variables by value at the time they are created, not by reference or lazily.
Raw```json ⏎ {"answer": "no", "explanation": "Arrow functions (fn) capture outer variables by value at the time they are created, not by reference or lazily."} ⏎ ``` | верно | fn захватывает только по значению, автоматически; по ссылке — только &$var в use у обычной функции (fn так не умеет). |
T05-L6 0.35 c | Functions and closures | A closure declared as static function () {} does not capture $this. | «yes» Пояснение: Static closures in PHP do not have access to the $this variable, unlike non-static closures which bind to the current scope.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "Static closures in PHP do not have access to the $this variable, unlike non-static closures which bind to the current scope." ⏎ } | верно | static-замыкание отвязано от объекта: $this внутри недоступен. |
T05-L7 0.38 c | Functions and closures | What will this print: $x = 5; $f = function () use ($x) { return $x; }; $x = 7; echo $f(); | «5» Пояснение: The closure captures the value of $x (5) by value when it is defined, so subsequent changes to $x do not affect the captured value inside the closure.
Raw{"answer": 5, "explanation": "The closure captures the value of $x (5) by value when it is defined, so subsequent changes to $x do not affect the captured value inside the closure."} | верно | use захватывает по значению в момент создания: 5. |
T05-L8 0.37 c | Functions and closures | In weak typing mode (without strict_types), passing the string "5" to an int parameter is allowed. | «yes» Пояснение: In PHP without strict_types, coercive typing allows the string "5" to be converted to an integer.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In PHP without strict_types, coercive typing allows the string \"5\" to be converted to an integer." ⏎ } ⏎ ``` | верно | Coercive typing приводит "5" к 5; strict_types=1 требует точного типа. |
T06-L1 0.33 c | OOP: classes and inheritance | PHP supports constructor property promotion: public function __construct(private int $x) {}. | «yes» Пояснение: PHP 8.0 introduced constructor property promotion, allowing the declaration and assignment of properties directly within the __construct method signature.
Raw{"answer": "yes", "explanation": "PHP 8.0 introduced constructor property promotion, allowing the declaration and assignment of properties directly within the __construct method signature."} | верно | С PHP 8.0 параметр с модификатором создаёт свойство и присваивание. |
T06-L2 0.25 c | OOP: classes and inheritance | Which keyword prevents a method from being overridden in subclasses? | «final» Пояснение: The final keyword in PHP prevents a class from being extended or a method from being overridden.
Raw{"answer": "final", "explanation": "The final keyword in PHP prevents a class from being extended or a method from being overridden."} | верно | final. |
T06-L3 0.31 c | OOP: classes and inheritance | A method declared final cannot be overridden in a subclass. | «yes» Пояснение: In PHP, the final keyword prevents a method from being overridden or redeclared in a subclass.
Raw{"answer": "yes", "explanation": "In PHP, the final keyword prevents a method from being overridden or redeclared in a subclass."} | верно | final запрещает переопределение метода и наследование класса. |
T06-L4 0.38 c | OOP: classes and inheritance | Parent properties with private visibility are accessible in a subclass. | «no» Пояснение: Private properties in PHP are not inherited and are not accessible within subclasses; only public and protected properties can be accessed from a child class.
Raw{"answer": "no", "explanation": "Private properties in PHP are not inherited and are not accessible within subclasses; only public and protected properties can be accessed from a child class."} | верно | В подклассе видны protected и public; private — только внутри своего класса. |
T06-L5 0.36 c | OOP: classes and inheritance | What does get_class(new class {}) return? Answer with the part of the name before the NUL byte (without the file path). | «class@anonymous» Пояснение: Anonymous classes in PHP have a name that starts with 'class@anonymous' followed by a null byte and the file path.
Raw{"answer": "class@anonymous", "explanation": "Anonymous classes in PHP have a name that starts with 'class@anonymous' followed by a null byte and the file path."} | верно | get_class анонимного класса печатает class@anonymous\0<файл>:<строка>$n; короткая форма — часть до NUL-байта. Проверено php -r (hex). |
T06-L6 0.59 c | OOP: classes and inheritance | A private parent method is not part of the inheritance contract: a child may declare a method with the same name and any visibility. | «no» Пояснение: In PHP, visibility is part of the inheritance contract; a child class method can only have the same or more permissive visibility (e.g., private can become protected or public, but not vice versa), so 'any visibility' is incorrect.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "In PHP, visibility is part of the inheritance contract; a child class method can only have the same or more permissive visibility (e.g., private can become protected or public, but not vice versa), so 'any visibility' is incorrect." ⏎ } | неверно верный: «yes» | private-члены не наследуются — правила совместимости подписей не действуют. |
T06-L7 0.51 c | OOP: classes and inheritance | The magic method __get() is called only for non-existent properties. | «yes» Пояснение: The __get() magic method is triggered only when accessing a property that is inaccessible (private, protected, or undefined) from the current scope, effectively covering non-existent or invisible properties.
Raw{"answer": "yes", "explanation": "The __get() magic method is triggered only when accessing a property that is inaccessible (private, protected, or undefined) from the current scope, effectively covering non-existent or invisible properties."} | неверно верный: «no» | __get срабатывает и для существующих, но недоступных (private/protected извне). |
T06-L8 0.29 c | OOP: classes and inheritance | What does reassigning a readonly property throw — Exception or Error? | «error» Пояснение: Attempting to reassign a readonly property in PHP throws a TypeError, which is a subclass of Error, not Exception.
Raw{"answer": "Error", "explanation": "Attempting to reassign a readonly property in PHP throws a TypeError, which is a subclass of Error, not Exception."} | верно | Error (readonly с 8.1); оговорка: в __clone() переинициализация допустима (8.3+). |
T07-L1 0.27 c | Interfaces, traits, enum | An interface can declare constants. | «yes» Пояснение: In PHP, interfaces can declare constants, but they cannot have methods or properties (other than constants).
Raw{"answer": "yes", "explanation": "In PHP, interfaces can declare constants, but they cannot have methods or properties (other than constants)."} | верно | Константы интерфейса наследуются реализациями. |
T07-L2 0.27 c | Interfaces, traits, enum | Which operator checks whether an object is an instance of a class or interface? | «instanceof» Пояснение: The instanceof operator in PHP checks if an object is an instance of a specific class or interface.
Raw{"answer": "instanceof", "explanation": "The instanceof operator in PHP checks if an object is an instance of a specific class or interface."} | верно | instanceof. |
T07-L3 0.97 c | Interfaces, traits, enum | An interface can declare static methods. | «yes» Пояснение: PHP 8.1 and earlier did not allow static methods in interfaces, but PHP 8.1 does not support it either; wait, let me correct that: PHP interfaces have historically not allowed static methods. However, as of PHP 8.1, interfaces still cannot declare static methods. Actually, checking PHP documentation: 'An interface can declare methods, but cannot define them... It is illegal to declare static methods in an interface.' This remains true in all current PHP versions.
Raw{"answer": "yes", "explanation": "PHP 8.1 and earlier did not allow static methods in interfaces, but PHP 8.1 does not support it either; wait, let me correct that: PHP interfaces have historically not allowed static methods. However, as of PHP 8.1, interfaces still cannot declare static methods. Actually, checking PHP documentation: 'An interface can declare methods, but cannot define them... It is illegal to declare static methods in an interface.' This remains true in all current PHP versions."} | верно | Реализация обязана дать статический метод с той же сигнатурой. |
T07-L4 0.26 c | Interfaces, traits, enum | The instanceof operator only checks class inheritance: it ignores interfaces. | «no» Пояснение: The instanceof operator checks both class inheritance and interface implementation.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "The instanceof operator checks both class inheritance and interface implementation." ⏎ } | верно | instanceof возвращает true и для интерфейсов объекта. |
T07-L5 0.51 c | Interfaces, traits, enum | An interface method may have a default implementation, like a trait method. | «no» Пояснение: Interface methods in PHP must be abstract and public, and therefore cannot have a body or default implementation.
Raw{"answer": "no", "explanation": "Interface methods in PHP must be abstract and public, and therefore cannot have a body or default implementation."} | верно | Методы интерфейса — только сигнатуры; тело даёт реализующий класс. |
T07-L6 0.27 c | Interfaces, traits, enum | An abstract method in an abstract class may have protected visibility. | «yes» Пояснение: Abstract methods in PHP can have public, protected, or private visibility modifiers.
Raw```json ⏎ {"answer": "yes", "explanation": "Abstract methods in PHP can have public, protected, or private visibility modifiers."} ⏎ ``` | верно | В абстрактном классе — любая видимость; в интерфейсе — только public. |
T07-L7 0.25 c | Interfaces, traits, enum | How many elements will Foo::cases() return for enum Foo { case A; case B; case C; }? | «3» Пояснение: The enum defines three distinct cases: A, B, and C.
Raw{"answer": 3, "explanation": "The enum defines three distinct cases: A, B, and C."} | верно | Статический метод cases(): 3. |
T07-L8 0.29 c | Interfaces, traits, enum | A trait can declare constants. | «yes» Пояснение: Traits in PHP are allowed to define constants, which can be accessed by classes that use the trait.
Raw{"answer": "yes", "explanation": "Traits in PHP are allowed to define constants, which can be accessed by classes that use the trait."} | верно | С PHP 8.2 трейты могут объявлять константы (RFC constants_in_traits); до 8.2 — нет. |
T08-L1 0.27 c | Exceptions and errors | The Throwable interface is a common ancestor of both Exception and Error. | «yes» Пояснение: In PHP, the Throwable interface is implemented by both the Exception and Error classes, making it their common ancestor.
Raw{"answer": "yes", "explanation": "In PHP, the Throwable interface is implemented by both the Exception and Error classes, making it their common ancestor."} | верно | Иерархия с PHP 7: Throwable → Exception и Throwable → Error. |
T08-L2 0.31 c | Exceptions and errors | A catch (Exception $e) block will also catch TypeError, because TypeError ultimately inherits from Exception. | «no» Пояснение: TypeError inherits from Error, which does not inherit from Exception; therefore, a catch (Exception) block will not catch TypeError.
Raw{"answer": "no", "explanation": "TypeError inherits from Error, which does not inherit from Exception; therefore, a catch (Exception) block will not catch TypeError."} | верно | TypeError наследуется от Error; catch (Exception) его не ловит. |
T08-L3 0.29 c | Exceptions and errors | The @ operator suppresses exceptions too. | «no» Пояснение: The @ operator only suppresses warnings and notices, not exceptions, which must be caught using try-catch blocks.
Raw{"answer": "no", "explanation": "The @ operator only suppresses warnings and notices, not exceptions, which must be caught using try-catch blocks."} | верно | @ глушит диагностику (warnings/notices), исключения не перехватывает. |
T08-L4 0.29 c | Exceptions and errors | What error class does intdiv(5, 0) throw? | «divisionbyzeroerror» Пояснение: In PHP 8.0+, intdiv() throws a DivisionByZeroError when the divisor is zero.
Raw{"answer": "DivisionByZeroError", "explanation": "In PHP 8.0+, intdiv() throws a DivisionByZeroError when the divisor is zero."} | верно | DivisionByZeroError (иерархия Error, не Exception); php-грейдер объективен. |
T08-L5 0.29 c | Exceptions and errors | The finally block runs only if the exception was caught by a catch block. | «no» Пояснение: The finally block executes regardless of whether an exception was thrown or caught.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "The finally block executes regardless of whether an exception was thrown or caught." ⏎ } | верно | Наоборот: finally выполняется всегда — даже когда исключение не поймано и уходит выше. Проверено php -r. |
T08-L6 0.41 c | Exceptions and errors | An exception thrown inside a finally block has no effect on the result of the try block. | «no» Пояснение: If an exception is thrown inside a finally block, it replaces any exception previously thrown in the try or catch block, effectively changing the result or propagating the new exception.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "If an exception is thrown inside a finally block, it replaces any exception previously thrown in the try or catch block, effectively changing the result or propagating the new exception." ⏎ } | верно | Исключение из finally перекрывает исходное и уходит вместо него. |
T08-L7 0.27 c | Exceptions and errors | What does the expression (bool) new Exception('x') return? | «yes» Пояснение: Casting any non-null object to a boolean always returns true.
Raw{"answer": "yes", "explanation": "Casting any non-null object to a boolean always returns true."} | верно | Любой объект при приведении к bool — true. Формы ответа: true или да. |
T08-L8 0.33 c | Exceptions and errors | Functions registered via register_shutdown_function() run when exit is called. | «yes» Пояснение: The register_shutdown_function() function registers a function to be executed when the script execution ends, which includes when exit is called.
Raw{"answer": "yes", "explanation": "The register_shutdown_function() function registers a function to be executed when the script execution ends, which includes when exit is called."} | верно | exit завершает скрипт, но shutdown-функции отрабатывают. |
T09-L1 0.47 c | Namespaces and autoloading | The use App\Service\Mailer; statement itself loads the class file. | «no» Пояснение: The `use` statement only creates an alias for the class and does not load the file; the file is loaded only when the class is actually instantiated or referenced, triggering the autoloader.
Raw```json ⏎ {"answer": "no", "explanation": "The `use` statement only creates an alias for the class and does not load the file; the file is loaded only when the class is actually instantiated or referenced, triggering the autoloader."} ⏎ ``` | верно | use — псевдоним на этапе компиляции; файл грузит автозагрузчик при первом обращении. |
T09-L2 0.29 c | Namespaces and autoloading | What follows use to import a function (not a class): the word function or const? | «function» Пояснение: In PHP, the `function` keyword is used to define and import functions, whereas `const` is used for constants.
Raw{"answer": "function", "explanation": "In PHP, the `function` keyword is used to define and import functions, whereas `const` is used for constants."} | верно | use function ...; (и use const для констант). |
T09-L3 0.38 c | Namespaces and autoloading | Into which file (path from src/) does the PSR-4 mapping "App\ → src/" place the class App\Controller\Api\UserController? | «controller/api/usercontroller.php» Пояснение: PSR-4 maps the namespace `App\Controller\Api` to `src/Controller/Api` and the class name `UserController` to the file `UserController.php`.
Raw{"answer": "Controller/Api/UserController.php", "explanation": "PSR-4 maps the namespace `App\\Controller\\Api` to `src/Controller/Api` and the class name `UserController` to the file `UserController.php`."} | верно | Остаток имени после префикса, \ → /. |
T09-L4 0.4 c | Namespaces and autoloading | Including vendor/autoload.php registers autoloaders via spl_autoload_register(). | «yes» Пояснение: The Composer autoloader generated in vendor/autoload.php internally calls spl_autoload_register to add its loading logic to PHP's autoload stack.
Raw{"answer": "yes", "explanation": "The Composer autoloader generated in vendor/autoload.php internally calls spl_autoload_register to add its loading logic to PHP's autoload stack."} | верно | Composer ставит автозагрузчик именно на spl_autoload_register. |
T09-L5 0.23 c | Namespaces and autoloading | The magic constant __NAMESPACE__ contains the name of the current namespace. | «yes» Пояснение: __NAMESPACE__ is a PHP magic constant that returns the name of the current namespace as a string.
Raw{"answer": "yes", "explanation": "__NAMESPACE__ is a PHP magic constant that returns the name of the current namespace as a string."} | верно | В корневом пространстве — пустая строка. |
T09-L6 0.27 c | Namespaces and autoloading | An unqualified class name (without a leading \) in new is resolved from the global root. | «no» Пояснение: An unqualified class name is resolved from the current namespace, not the global root.
Raw```json ⏎ {"answer": "no", "explanation": "An unqualified class name is resolved from the current namespace, not the global root."} ⏎ ``` | верно | Резолвится относительно текущего namespace (с учётом импортов). |
T09-L7 0.41 c | Namespaces and autoloading | With the PSR-4 mapping "App\ → src/", the class App\Model\User lives in the file src/Model/User.php. | «yes» Пояснение: PSR-4 converts namespace separators to directory separators and appends the class name with a .php extension, so App\Model\User maps to src/Model/User.php.
Raw{"answer": "yes", "explanation": "PSR-4 converts namespace separators to directory separators and appends the class name with a .php extension, so App\\Model\\User maps to src/Model/User.php."} | верно | Остаток имени после префикса переносится в путь как есть. |
T09-L8 0.45 c | Namespaces and autoloading | A use statement may be written inside a function body — the import then applies to that function only. | «yes» Пояснение: In PHP 8.0 and later, 'use' statements for namespaces can be declared inside functions or methods, making the alias effective only within that scope.
Raw{"answer": "yes", "explanation": "In PHP 8.0 and later, 'use' statements for namespaces can be declared inside functions or methods, making the alias effective only within that scope."} | неверно верный: «no» | use внутри тела функции — parse error; импорты файловые и компиляционные. |
T10-L1 0.43 c | References and scope | Arrays are copied on assignment rather than passed by reference. | «yes» Пояснение: In PHP, arrays are value types (as of PHP 5.3 with Copy-on-Write semantics), so assigning an array to another variable creates a copy of the data rather than a reference to the original array.
Raw{"answer": "yes", "explanation": "In PHP, arrays are value types (as of PHP 5.3 with Copy-on-Write semantics), so assigning an array to another variable creates a copy of the data rather than a reference to the original array."} | верно | Присваивание массива — копия (в движке — copy-on-write). |
T10-L2 0.26 c | References and scope | What will this print: $a = [1, 2]; $b = $a; $b[] = 3; echo count($a); | «2» Пояснение: PHP arrays are copied by value, so modifying $b does not affect $a.
Raw{"answer": 2, "explanation": "PHP arrays are copied by value, so modifying $b does not affect $a."} | верно | Присваивание — копия: в $a по-прежнему 2 элемента. |
T10-L3 0.45 c | References and scope | Inside a function, user-defined global variables are inaccessible without global, $GLOBALS, or passing them as parameters. | «yes» Пояснение: In PHP, variables defined in the global scope are not accessible inside function scope unless explicitly accessed via the global keyword, $GLOBALS array, or passed as arguments.
Raw{"answer": "yes", "explanation": "In PHP, variables defined in the global scope are not accessible inside function scope unless explicitly accessed via the global keyword, $GLOBALS array, or passed as arguments."} | верно | Область видимости функций изолирована; исключение — суперглобалы ($_GET и др.). |
T10-L4 0.43 c | References and scope | unset($GLOBALS['x']) inside a function removes the global variable only for that function. | «no» Пояснение: Using unset($GLOBALS['x']) modifies the global variable scope directly, permanently removing it from the global namespace for the entire execution of the script.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Using unset($GLOBALS['x']) modifies the global variable scope directly, permanently removing it from the global namespace for the entire execution of the script." ⏎ } | верно | $GLOBALS — прямое окно в глобальную область: unset удалит её по-настоящему. |
T10-L5 0.42 c | References and scope | What will this print: function inc(&$x) { $x++; } $n = 5; inc($n); echo $n; | «6» Пояснение: The function `inc` modifies `$n` by reference, incrementing it from 5 to 6, and `echo $n` outputs the modified value, 6.
Raw```json ⏎ {"answer": 6, "explanation": "The function `inc` modifies `$n` by reference, incrementing it from 5 to 6, and `echo $n` outputs the modified value, 6."} ⏎ ``` | верно | Ссылка меняет оригинал: 6. |
T10-L6 0.9 c | References and scope | A foreach over an array (by value) works with the "live" array: changes to the array inside the loop are visible in the same pass. | «yes» Пояснение: In PHP, foreach by value iterates over the actual array data (unless using a copy via the =& syntax or in PHP 7+ with the copy-on-write semantics for iteration), so modifications to the array structure (like adding/removing keys) during the loop are reflected in the iteration process in the same pass.
Raw{"answer": "yes", "explanation": "In PHP, foreach by value iterates over the actual array data (unless using a copy via the =& syntax or in PHP 7+ with the copy-on-write semantics for iteration), so modifications to the array structure (like adding/removing keys) during the loop are reflected in the iteration process in the same pass."} | неверно верный: «no» | По значению foreach итерирует копию-снимок. |
T10-L7 0.4 c | References and scope | A static property belongs to each instance separately: changes in one object are not visible in others. | «no» Пояснение: A static property belongs to the class itself, not to individual instances, so changes made through one object are visible through all others.
Raw```json ⏎ {"answer": "no", "explanation": "A static property belongs to the class itself, not to individual instances, so changes made through one object are visible through all others."} ⏎ ``` | верно | Наоборот: статическое свойство общее для всех экземпляров класса. Проверено php -r. |
T10-L8 0.33 c | References and scope | An array can have a boolean key true, and it will be stored as bool. | «no» Пояснение: PHP automatically casts boolean array keys to integers (true becomes 1, false becomes 0), so a key cannot be stored as a boolean type.
Raw{"answer": "no", "explanation": "PHP automatically casts boolean array keys to integers (true becomes 1, false becomes 0), so a key cannot be stored as a boolean type."} | верно | Булев ключ приводится к int: true → 1, false → 0. |
T11-L1 0.42 c | Generators, iterators, SPL | Inside a generator, return with a value can be used, and it becomes available via $gen->getReturn(). | «yes» Пояснение: In PHP generators (since PHP 7.0), using 'return' with a value sets the generator's return value, which can be retrieved by calling getReturn() after the generator completes.
Raw{"answer": "yes", "explanation": "In PHP generators (since PHP 7.0), using 'return' with a value sets the generator's return value, which can be retrieved by calling getReturn() after the generator completes."} | верно | return-значение генератора доступно через getReturn() после прохода. |
T11-L2 0.32 c | Generators, iterators, SPL | A fully consumed generator can be rewound with rewind() and traversed again. | «no» Пояснение: In PHP, generators are single-use iterators and cannot be rewound once consumed.
Raw{"answer": "no", "explanation": "In PHP, generators are single-use iterators and cannot be rewound once consumed."} | верно | Генератор одноразовый: rewind после начала итерации бросает Exception. |
T11-L3 0.36 c | Generators, iterators, SPL | The yield from construct delegates traversal to another generator or iterable. | «yes» Пояснение: yield from delegates iteration to another iterable or generator, effectively flattening nested generators or passing values through.
Raw{"answer": "yes", "explanation": "yield from delegates iteration to another iterable or generator, effectively flattening nested generators or passing values through."} | верно | yield from проксирует значения, ключи и return-значение внутреннего генератора. |
T11-L4 0.31 c | Generators, iterators, SPL | What does get_class(g()) return for function g() { yield 1; }? | «generator» Пояснение: In PHP, calling get_class() on a Generator object (returned by a generator function) returns the string 'Generator'.
Raw{"answer": "Generator", "explanation": "In PHP, calling get_class() on a Generator object (returned by a generator function) returns the string 'Generator'."} | верно | Функция с yield возвращает Generator. |
T11-L5 0.34 c | Generators, iterators, SPL | How many elements will count(iterator_to_array((function () { yield from [1, 2, 3]; })())) return? | «3» Пояснение: iterator_to_array converts the generator yielding [1, 2, 3] into an array of 3 elements, and count returns 3.
Raw{"answer": 3, "explanation": "iterator_to_array converts the generator yielding [1, 2, 3] into an array of 3 elements, and count returns 3."} | верно | yield from делегирует все 3 элемента. |
T11-L6 0.32 c | Generators, iterators, SPL | The SplStack class implements a FIFO queue. | «no» Пояснение: SplStack implements a LIFO (Last-In, First-Out) stack, not a FIFO queue.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "SplStack implements a LIFO (Last-In, First-Out) stack, not a FIFO queue." ⏎ } ⏎ ``` | верно | SplStack — стек LIFO; очередь FIFO — SplQueue. |
T11-L7 0.35 c | Generators, iterators, SPL | ArrayIterator allows wrapping an array and traversing it via the Iterator interface. | «yes» Пояснение: ArrayIterator is a built-in PHP class that implements the Iterator, IteratorAggregate, Countable, and ArrayAccess interfaces, allowing arrays to be traversed using standard iterator methods.
Raw{"answer": "yes", "explanation": "ArrayIterator is a built-in PHP class that implements the Iterator, IteratorAggregate, Countable, and ArrayAccess interfaces, allowing arrays to be traversed using standard iterator methods."} | верно | Объектная обёртка над массивом. |
T11-L8 0.23 c | Generators, iterators, SPL | An ArrayObject instance cannot be traversed with foreach. | «no» Пояснение: ArrayObject implements the Iterator interface, so it can be traversed with foreach.
Raw{"answer": "no", "explanation": "ArrayObject implements the Iterator interface, so it can be traversed with foreach."} | верно | ArrayObject реализует IteratorAggregate — foreach по нему работает. |
T12-L1 0.29 c | Configuration and security | password_hash() generates a salt automatically — passing one separately is not needed. | «yes» Пояснение: The password_hash() function in PHP automatically generates a unique salt and includes it in the returned hash string.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "The password_hash() function in PHP automatically generates a unique salt and includes it in the returned hash string." ⏎ } | верно | Соль встраивается в строку результата; параметр salt устарел. |
T12-L2 0.21 c | Configuration and security | In PHP 8, PASSWORD_DEFAULT is md5 with an automatically added salt. | «no» Пояснение: In PHP 8, PASSWORD_DEFAULT is bcrypt, not md5.
Raw{"answer": "no", "explanation": "In PHP 8, PASSWORD_DEFAULT is bcrypt, not md5."} | верно | PASSWORD_DEFAULT — bcrypt; md5 для паролей непригоден (перебирается массово). |
T12-L3 0.39 c | Configuration and security | What does password_verify('secret', password_hash('secret', PASSWORD_DEFAULT)) return? | «yes» Пояснение: password_verify checks if the password matches the hashed version and returns true (represented as 'yes' in this context) if they do.
Raw{"answer": "yes", "explanation": "password_verify checks if the password matches the hashed version and returns true (represented as 'yes' in this context) if they do."} | верно | Соль и хеш в одной строке: true (форма ответа: true или да). |
T12-L4 0.33 c | Configuration and security | strip_tags() protects against SQL injection. | «no» Пояснение: strip_tags() removes HTML tags and is used to prevent XSS, not SQL injection, which is prevented by prepared statements and parameterized queries.
Raw{"answer": "no", "explanation": "strip_tags() removes HTML tags and is used to prevent XSS, not SQL injection, which is prevented by prepared statements and parameterized queries."} | верно | strip_tags режет HTML-теги (помощник против XSS), к параметризации SQL отношения не имеет. |
T12-L5 0.33 c | Configuration and security | session_regenerate_id() is used to protect against session fixation upon user login. | «yes» Пояснение: session_regenerate_id() changes the session ID to prevent attackers from hijacking the session using a previously known ID, a technique known as session fixation.
Raw{"answer": "yes", "explanation": "session_regenerate_id() changes the session ID to prevent attackers from hijacking the session using a previously known ID, a technique known as session fixation."} | верно | Новый ID сессии после логина — стандартная защита от session fixation. |
T12-L6 0.39 c | Configuration and security | Which built-in function returns the SAPI name (e.g., cli)? | «php_sapi_name» Пояснение: The built-in PHP function php_sapi_name() returns the name of the SAPI (Server API) being used, such as 'cli' for command-line interface.
Raw{"answer": "php_sapi_name", "explanation": "The built-in PHP function php_sapi_name() returns the name of the SAPI (Server API) being used, such as 'cli' for command-line interface."} | верно | php_sapi_name(). |
T12-L7 0.34 c | Configuration and security | session_destroy() deletes session data on the server but not the cookie in the user's browser. | «yes» Пояснение: session_destroy() clears the session data stored on the server but does not remove or modify the PHPSESSID cookie in the client's browser.
Raw{"answer": "yes", "explanation": "session_destroy() clears the session data stored on the server but does not remove or modify the PHPSESSID cookie in the client's browser."} | верно | Удаление cookie — отдельный шаг через setcookie с истёкшим сроком. |
T12-L8 0.29 c | Configuration and security | Without calling session_start(), the $_SESSION array is automatically populated with session data. | «no» Пояснение: The $_SESSION array is only populated when the session is started using the session_start() function.
Raw```json ⏎ {"answer": "no", "explanation": "The $_SESSION array is only populated when the session is started using the session_start() function."} ⏎ ``` | верно | Без session_start() данные сессии в массив не загружаются ($_SESSION можно заполнить вручную, но привязки к сессии нет). |
VC-L1 0.35 c | PHP 8.4–8.5 | In which PHP version was the array_find() function introduced? | «8.3.0» Пояснение: The array_find() function was introduced in PHP 8.3.0 alongside other array helper functions like array_find_key().
Raw{"answer": "8.3.0", "explanation": "The array_find() function was introduced in PHP 8.3.0 alongside other array helper functions like array_find_key()."} | неверно верный: «8.4» | PHP 8.4 (RFC array_find). |
VC-L2 0.37 c | PHP 8.4–8.5 | Property hooks (get/set right in the property declaration) landed in PHP 8.4. | «yes» Пояснение: PHP 8.4 introduced property hooks, allowing custom get and set logic to be defined directly within the property declaration, similar to computed properties.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "PHP 8.4 introduced property hooks, allowing custom get and set logic to be defined directly within the property declaration, similar to computed properties." ⏎ } | верно | Property hooks — PHP 8.4 (ноябрь 2024). |
VC-L3 0.35 c | PHP 8.4–8.5 | Asymmetric visibility (public private(set) string $name) appeared in PHP 8.4. | «yes» Пояснение: Asymmetric visibility, such as public private(set), is a new feature introduced in PHP 8.4.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "Asymmetric visibility, such as public private(set), is a new feature introduced in PHP 8.4." ⏎ } | верно | Asymmetric visibility v2 — PHP 8.4. |
VC-L4 0.31 c | PHP 8.4–8.5 | In which PHP version was the #[\NoDiscard] attribute introduced? Answer with the version number. | «8.4» Пояснение: The #[\NoDiscard] attribute was introduced in PHP 8.4 to indicate that the return value of a function should not be discarded.
Raw{"answer": 8.4, "explanation": "The #[\\NoDiscard] attribute was introduced in PHP 8.4 to indicate that the return value of a function should not be discarded."} | неверно верный: «8.5» | #[\NoDiscard] — PHP 8.5 (marking return values as important). |
VC-L5 0.23 c | PHP 8.4–8.5 | In which PHP version did the pipe operator |> first appear? Answer with the version number. | «8.4» Пояснение: The pipe operator (|>) was first introduced in PHP 8.4.
Raw{"answer": "8.4", "explanation": "The pipe operator (|>) was first introduced in PHP 8.4."} | неверно верный: «8.5» | Pipe operator — PHP 8.5 (2025). |
VC-L6 0.32 c | PHP 8.4–8.5 | In which PHP version did clone-with — the syntax clone($obj, ['x' => 1]) — appear? Answer with the version number. | «8.4» Пояснение: Clone with properties, also known as clone-with, was introduced in PHP 8.4.
Raw{"answer": "8.4", "explanation": "Clone with properties, also known as clone-with, was introduced in PHP 8.4."} | неверно верный: «8.5» | Clone with v2 — PHP 8.5. |
VC-L7 0.45 c | PHP 8.4–8.5 | In which PHP version were the array_first() and array_last() functions introduced? | «no» Пояснение: PHP does not have native array_first() or array_last() functions; these are often custom or from third-party libraries, while native equivalents like reset() and end() have existed since PHP 4.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "PHP does not have native array_first() or array_last() functions; these are often custom or from third-party libraries, while native equivalents like reset() and end() have existed since PHP 4." ⏎ } | неверно верный: «8.5» | PHP 8.5. |
VC-L8 0.28 c | PHP 8.4–8.5 | For which PHP version was RFC Partial Function Application v2 adopted (as of 2026-11-07)? Answer with the version number. | «8.3» Пояснение: RFC Partial Function Application v2 was adopted for PHP 8.3.
Raw{"answer": "8.3", "explanation": "RFC Partial Function Application v2 was adopted for PHP 8.3."} | неверно верный: «8.6» | PFA v2 принят 05.12.2025 (33-0-0), реализован в PHP 8.6. |
VF-L1 0.36 c | PHP: 8.6+ and the future | For which PHP version was the RFC clamp_v2 (the clamp() function) implemented, as of 2026-11-07? Answer with the version number. | «8.4» Пояснение: The RFC "clamp_v2" (adding the `clamp()` function) was accepted for PHP 8.4.
Raw{"answer": "8.4", "explanation": "The RFC \"clamp_v2\" (adding the `clamp()` function) was accepted for PHP 8.4."} | неверно верный: «8.6» | По данным владельца (wiki.php.net/rfc): clamp_v2 — 8.6; clamp() в 8.5.11 отсутствует (косвенное подтверждение). Дата-якорь делает клетку монотонной. |
VF-L2 0.5 c | PHP: 8.6+ and the future | RFC Context Managers v2 has already been adopted in PHP (as of 2026-11-07). | «no» Пояснение: Context Managers are not a standard feature in PHP as of 2024/2025 and remain in RFC proposal stages rather than being adopted.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Context Managers are not a standard feature in PHP as of 2024/2025 and remain in RFC proposal stages rather than being adopted." ⏎ } | верно | На 06.11.2026 — в обсуждении (создан 2026-10-23); не принят. |
VF-L3 0.75 c | PHP: 8.6+ and the future | RFC Bound-Erased Generic Types (generics) was declined in 2026. | «no» Пояснение: RFC 0076 (Generics) was accepted in PHP 8.4, and RFC 0210 (Bound-Erased Generic Types) is a separate proposal that was not declined in 2026; rather, generics are already supported in PHP 8.4+.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "RFC 0076 (Generics) was accepted in PHP 8.4, and RFC 0210 (Bound-Erased Generic Types) is a separate proposal that was not declined in 2026; rather, generics are already supported in PHP 8.4+." ⏎ } | неверно верный: «yes» | Голосование завершилось 2026-06-28: отклонён (wiki.php.net/rfc). |
VF-L4 0.59 c | PHP: 8.6+ and the future | As of 2026-11-07, the RFC enabling multithreading (ZTS) by default has already been accepted in PHP. | «no» Пояснение: There is no such RFC accepted in PHP to enable multithreading (ZTS) by default, as PHP does not natively support shared-memory multithreading in the way described and maintains a single-threaded, request-based architecture.
Raw{"answer": "no", "explanation": "There is no such RFC accepted in PHP to enable multithreading (ZTS) by default, as PHP does not natively support shared-memory multithreading in the way described and maintains a single-threaded, request-based architecture."} | верно | Такого принятого RFC нет на дату якоря; якорь делает клетку монотонной — при принятии RFC позже клетка не перевернётся. |
VF-L5 0.38 c | PHP: 8.6+ and the future | As of PHP 8.5, generics (parameterized types) are still absent. | «yes» Пояснение: PHP has never implemented generics/parameterized types, and no such feature is included in the roadmap up to PHP 8.5.
Raw{"answer": "yes", "explanation": "PHP has never implemented generics/parameterized types, and no such feature is included in the roadmap up to PHP 8.5."} | верно | Generics в PHP отсутствуют; отрицательный контроль (не путать с C#/Java). |
VF-L6 0.44 c | PHP: 8.6+ and the future | As of 2026-11-07, the latest stable PHP version is 8.5, and PHP 8.6 has not been released yet (GA — 2026-11-19). | «yes» Пояснение: PHP 8.5 is scheduled for release in November 2025, making it the latest stable version in early 2026, while PHP 8.6 is expected to follow later in 2026.
Raw{"answer": "yes", "explanation": "PHP 8.5 is scheduled for release in November 2025, making it the latest stable version in early 2026, while PHP 8.6 is expected to follow later in 2026."} | верно | 8.5 — релиз осени 2025; 8.6 GA 19.11.2026 (wiki.php.net/todo/php86). Дата снимка — 06.11.2026. |
VF-L7 0.38 c | PHP: 8.6+ and the future | The PHP 6 branch never shipped: after PHP 5.6 came PHP 7.0 directly. | «yes» Пояснение: PHP 6 was cancelled and the project moved directly from the 5.x series to PHP 7.0.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "PHP 6 was cancelled and the project moved directly from the 5.x series to PHP 7.0." ⏎ } | верно | Исторический факт: ветка 6 не была релизнута. |
VF-L8 0.35 c | PHP: 8.6+ and the future | The RFC adding the #[\Deprecated] attribute to the core was adopted. | «yes» Пояснение: RFC 0459 for the #[\Deprecated] attribute was approved and added in PHP 8.4.
Raw{"answer": "yes", "explanation": "RFC 0459 for the #[\\Deprecated] attribute was approved and added in PHP 8.4."} | верно | #[\Deprecated] — принят, реализован в PHP 8.4. |
T25-L1 0.45 c | Clean architecture | The dependency rule of clean and onion architecture: inner layers know nothing about outer ones — dependencies point toward the center. | «yes» Пояснение: In clean and onion architecture, high-level policies and business logic (inner layers) are independent of low-level details (outer layers), and dependencies always point inward toward the core.
Raw{"answer": "yes", "explanation": "In clean and onion architecture, high-level policies and business logic (inner layers) are independent of low-level details (outer layers), and dependencies always point inward toward the core."} | верно | Чистая (Robert C. Martin), луковичная (Jeffrey Palermo) и гексагональная (ports & adapters) — варианты одной идеи: зависимости направлены внутрь, к домену. Слоями в проекте следит deptrac. |
T25-L2 4.79 c | Clean architecture | Domain entities import neither Doctrine nor Symfony — only the language and, possibly, the standard library. | «no» Пояснение: While it is best practice to keep Domain entities framework-agnostic, they do not strictly import neither Doctrine nor Symfony by definition; however, in strict DDD/hexagonal architecture contexts, this statement is often treated as true for *ideal* purity, but technically an entity can import anything. Given the phrasing 'only the language and, possibly, the standard library', this implies a strict purity constraint. In many real-world or even well-structured Symfony apps, entities might implement interfaces from Symfony or Doctrine (like `Stringable` is standard, but `PersistentObject` is not). Actually, `Stringable` is standard library. If the question implies that *by definition* or *in a strict DDD context* they should not, it's True. However, if it's asking about a hard rule in PHP, it's False. Let's look at the 'True or false' instruction. Usually, these questions test specific architectural best practices. The statement says they *import neither*. This is a normative statement about what they *should* do, or a descriptive statement about what they *do*. If it's a best practice question, the answer is likely True. But wait, if I answer 'yes', I agree with the statement. If I answer 'no', I disagree. Is it *always* true? No. Can they? Yes. The prompt says 'Domain entities import neither...'. This sounds like a rule. In strict DDD, yes. In Symfony, no (they often implement `\Doctrine\Common\Persistence\ObjectRepository` or use attributes). However, the *core* definition of a Domain Entity in DDD is framework independent. Let's assume the question asks about the *ideal/pure* definition or a best practice guideline. Most DDD resources say 'Domain should be framework agnostic'. Therefore, the statement is describing the correct architectural boundary. I will bet on 'yes' being the expected answer for a 'knowledge test' about DDD principles, as it highlights the separation of concerns. Wait, let me re-read carefully. 'Domain entities import neither...'. If this is a factual claim about *all* domain entities, it is false. If it is a prescriptive claim about *good* domain entities, it is true. Given the context of 'PHP knowledge test', it likely refers to best practices. However, usually 'True or False' questions are factual. Let's look at similar questions. 'Should you use a framework in the domain layer?' No. So the statement 'Domain entities import neither...' is a correct *principle*. I will go with 'yes' as it reflects the DDD principle of a framework-independent domain layer.
Raw{"answer": "no", "explanation": "While it is best practice to keep Domain entities framework-agnostic, they do not strictly import neither Doctrine nor Symfony by definition; however, in strict DDD/hexagonal architecture contexts, this statement is often treated as true for *ideal* purity, but technically an entity can import anything. Given the phrasing 'only the language and, possibly, the standard library', this implies a strict purity constraint. In many real-world or even well-structured Symfony apps, entities might implement interfaces from Symfony or Doctrine (like `Stringable` is standard, but `PersistentObject` is not). Actually, `Stringable` is standard library. If the question implies that *by definition* or *in a strict DDD context* they should not, it's True. However, if it's asking about a hard rule in PHP, it's False. Let's look at the 'True or false' instruction. Usually, these questions test specific architectural best practices. The statement says they *import neither*. This is a normative statement about what they *should* do, or a descriptive statement about what they *do*. If it's a best practice question, the answer is likely True. But wait, if I answer 'yes', I agree with the statement. If I answer 'no', I disagree. Is it *always* true? No. Can they? Yes. The prompt says 'Domain entities import neither...'. This sounds like a rule. In strict DDD, yes. In Symfony, no (they often implement `\\Doctrine\\Common\\Persistence\\ObjectRepository` or use attributes). However, the *core* definition of a Domain Entity in DDD is framework independent. Let's assume the question asks about the *ideal/pure* definition or a best practice guideline. Most DDD resources say 'Domain should be framework agnostic'. Therefore, the statement is describing the correct architectural boundary. I will bet on 'yes' being the expected answer for a 'knowledge test' about DDD principles, as it highlights the separation of concerns. Wait, let me re-read carefully. 'Domain entities import neither...'. If this is a factual claim about *all* domain entities, it is false. If it is a prescriptive claim about *good* domain entities, it is true. Given the context of 'PHP knowledge test', it likely refers to best practices. However, usually 'True or False' questions are factual. Let's look at similar questions. 'Should you use a framework in the domain layer?' No. So the statement 'Domain entities import neither...' is a correct *principle*. I will go with 'yes' as it reflects the DDD principle of a framework-independent domain layer."} | неверно верный: «yes» | Изоляция домена от инфраструктуры; deptrac в проекте как раз следит за слоями. |
T25-L3 0.33 c | Clean architecture | Controllers and Twig templates belong to the business-logic layer because they are the ones calling use cases. | «no» Пояснение: Controllers and views belong to the presentation layer, while the business logic layer consists of domain models and services.
Raw{"answer": "no", "explanation": "Controllers and views belong to the presentation layer, while the business logic layer consists of domain models and services."} | верно | Наоборот: это интерфейсные адаптеры (внешний слой); они зависят от use cases, а не наоборот. |
T25-L4 0.33 c | Clean architecture | What sits at the very center of the onion architecture? | «domain» Пояснение: In the Onion Architecture, the innermost circle represents the Domain or Entity layer, which contains the core business logic.
Raw{"answer": "Domain", "explanation": "In the Onion Architecture, the innermost circle represents the Domain or Entity layer, which contains the core business logic."} | неверно верный: «domain model» | Центральное кольцо — Domain Model: сущности и бизнес-правила без зависимостей; далее Domain Services → Application Services → Infrastructure/UI/Tests (Palermo). |
T25-L5 0.35 c | Clean architecture | Layer boundary violations can be caught automatically: a layer-dependency analyzer (e.g. deptrac) fails on a forbidden call. | «yes» Пояснение: Tools like deptrac analyze code to identify and report violations of pre-defined layer dependency rules.
Raw```json ⏎ {"answer": "yes", "explanation": "Tools like deptrac analyze code to identify and report violations of pre-defined layer dependency rules."} ⏎ ``` | верно | depfile.yaml в проекте TasK: CI проверяет правила слоёв на каждом пайплайне. |
T25-L6 0.59 c | Clean architecture | A use case (interactor) may accept an HTTP request or an EntityManager as arguments — it is simpler that way. | «no» Пояснение: In object-oriented design and specifically within domain-driven design, use cases should depend on abstractions (interfaces) or primitive data transfer objects rather than concrete infrastructure classes like HTTP requests or EntityManagers.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In object-oriented design and specifically within domain-driven design, use cases should depend on abstractions (interfaces) or primitive data transfer objects rather than concrete infrastructure classes like HTTP requests or EntityManagers." ⏎ } ⏎ ``` | верно | Use case принимает DTO и порты; привязка к HTTP/ORM протекает инфраструктуру во внутренние слои. |
T25-L7 0.46 c | Clean architecture | What is the component called that provides a collection of aggregates/entities while hiding the storage mechanism behind an interface? | «repository» Пояснение: In domain-driven design and PHP frameworks, the Repository pattern provides a collection of domain objects (aggregates/entities) while abstracting the storage mechanism behind a common interface.
Raw{"answer": "Repository", "explanation": "In domain-driven design and PHP frameworks, the Repository pattern provides a collection of domain objects (aggregates/entities) while abstracting the storage mechanism behind a common interface."} | верно | Repository pattern (DDD/Evans); в проекте — Doctrine-репозитории за портами. |
T25-L8 0.5 c | Clean architecture | In clean architecture, swapping PostgreSQL for another database touches only the outer layer — the domain and use cases stay unchanged. | «yes» Пояснение: In clean architecture, the domain layer is independent of external entities like databases; data access is abstracted behind interfaces, allowing infrastructure changes without impacting business logic.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In clean architecture, the domain layer is independent of external entities like databases; data access is abstracted behind interfaces, allowing infrastructure changes without impacting business logic." ⏎ } | верно | Следствие правила зависимостей: инфраструктура взаимозаменяема. |
T26-L1 0.46 c | DDD | In DDD, an aggregate is just another name for a database table. | «no» Пояснение: In DDD, an aggregate is a cluster of domain objects that are treated as a single unit for data changes, while a database table is a relational data storage structure.
Raw```json ⏎ {"answer": "no", "explanation": "In DDD, an aggregate is a cluster of domain objects that are treated as a single unit for data changes, while a database table is a relational data storage structure."} ⏎ ``` | верно | Агрегат — кластер объектов с границей согласованности (транзакционной вокруг корня); таблица — деталь хранения. |
T26-L2 0.32 c | DDD | A Value Object is immutable and compared by the values of its fields, not by identity. | «yes» Пояснение: Value Objects are defined by their immutable fields and are compared based on value equality rather than object identity.
Raw{"answer": "yes", "explanation": "Value Objects are defined by their immutable fields and are compared based on value equality rather than object identity."} | верно | Классика Evans: Money, Email; равенство структурное. |
T26-L3 0.4 c | DDD | What is the single external entry point of an aggregate, through which all changes must go, called? | «root» Пояснение: In Domain-Driven Design, the Root is the single entry point of an aggregate that controls access to its internals to maintain invariants.
Raw{"answer": "Root", "explanation": "In Domain-Driven Design, the Root is the single entry point of an aggregate that controls access to its internals to maintain invariants."} | неверно верный: «aggregate root» | Aggregate Root: внешние объекты ссылаются только на корень; он защищает инварианты агрегата. |
T26-L4 0.44 c | DDD | In DDD, a repository is declared for an aggregate (its root), not for every entity. | «yes» Пояснение: In Domain-Driven Design, repositories are defined for aggregates (specifically the aggregate root) to manage their boundary and maintain consistency, rather than for every individual entity.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Domain-Driven Design, repositories are defined for aggregates (specifically the aggregate root) to manage their boundary and maintain consistency, rather than for every individual entity." ⏎ } | верно | Репозиторий корня хранит границу согласованности агрегата; вложенные сущности доступны только через корень. |
T26-L5 0.34 c | DDD | Ubiquitous language is the model's shared language common to developers and domain experts. | «yes» Пояснение: Ubiquitous language is a core Domain-Driven Design concept where the domain model's terminology is shared and consistent across the entire development team and domain experts.
Raw{"answer": "yes", "explanation": "Ubiquitous language is a core Domain-Driven Design concept where the domain model's terminology is shared and consistent across the entire development team and domain experts."} | верно | Evans: язык из требований переходит в имена классов и методов. |
T26-L6 0.51 c | DDD | What is the boundary called within which a model and its language are consistent, while outside the same words mean other models? | «umbrella term» Пояснение: This concept refers to the 'umbrella term' or conceptual boundary in linguistic pragmatics and model theory where specific meanings are valid only within a defined context or model.
Raw{"answer": "Umbrella term", "explanation": "This concept refers to the 'umbrella term' or conceptual boundary in linguistic pragmatics and model theory where specific meanings are valid only within a defined context or model."} | неверно верный: «bounded context» | Bounded Context; «Заказ» в биллинге и в доставке — разные модели. |
T26-L7 0.36 c | DDD | An anemic model (objects with only getters/setters, logic in services) is the recommended DDD style. | «no» Пояснение: DDD advocates for Rich Domain Models where business logic is encapsulated within entities, avoiding Anemic Models.
Raw{"answer": "no", "explanation": "DDD advocates for Rich Domain Models where business logic is encapsulated within entities, avoiding Anemic Models."} | верно | Наоборот: Evans называет анемичность антипаттерном — поведение должно жить в доменных объектах. |
T26-L8 0.45 c | DDD | Bounded context means each context has its own model: the same concept in different contexts is a different class. | «yes» Пояснение: In Domain-Driven Design, a bounded context defines the boundary within which a specific domain model is applicable, ensuring that the same term can have different meanings and implementations in different contexts.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Domain-Driven Design, a bounded context defines the boundary within which a specific domain model is applicable, ensuring that the same term can have different meanings and implementations in different contexts." ⏎ } | верно | Модели контекстов независимы; между ними — явная интеграция (ACL, published language). |
T13-L1 0.43 c | Symfony | Services in the Symfony DI container are created lazily by default — on first use. | «yes» Пояснение: In Symfony's DI container, services are indeed lazy-loaded by default, meaning they are only instantiated when they are actually requested or used.
Raw```json ⏎ {"answer": "yes", "explanation": "In Symfony's DI container, services are indeed lazy-loaded by default, meaning they are only instantiated when they are actually requested or used."} ⏎ ``` | верно | Контейнер инстанцирует сервис при первом извлечении; eager-создания по умолчанию нет. |
T13-L2 0.27 c | Symfony | Which Symfony console command lists all registered routes? | «debug:router» Пояснение: The 'debug:router' command is used in Symfony to list all registered routes in the application.
Raw{"answer": "debug:router", "explanation": "The 'debug:router' command is used in Symfony to list all registered routes in the application."} | верно | bin/console debug:router (FrameworkBundle); в Symfony 3 команда называлась router:debug. |
T13-L3 0.31 c | Symfony | Symfony autowiring requires manually declaring every service in services.yaml. | «no» Пояснение: Symfony autowiring automatically resolves dependencies and registers services, eliminating the need to manually declare every single service in services.yaml.
Raw{"answer": "no", "explanation": "Symfony autowiring automatically resolves dependencies and registers services, eliminating the need to manually declare every single service in services.yaml."} | верно | Autowire+autoconfigure регистрируют и связывают сервисы автоматически; ручное перечисление — исключение. |
T13-L4 0.35 c | Symfony | Twig templates are compiled into PHP classes and cached between requests. | «yes» Пояснение: Twig compiles templates into optimized PHP code and caches the resulting PHP files for performance.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Twig compiles templates into optimized PHP code and caches the resulting PHP files for performance." ⏎ } ⏎ ``` | верно | Twig компилирует шаблон один раз; кэш в var/cache/twig, в prod не пересобирается. |
T13-L5 0.39 c | Symfony | In the Symfony dev environment the DI container is rebuilt only after tracked files change, not on every request. | «yes» Пояснение: In the Symfony development environment, the DI container is compiled once and cached; it is only rebuilt when specific tracked files (like service definitions or configuration) change, not on every request.
Raw{"answer": "yes", "explanation": "In the Symfony development environment, the DI container is compiled once and cached; it is only rebuilt when specific tracked files (like service definitions or configuration) change, not on every request."} | верно | Kernel проверяет freshness ресурсов (конфиги, классы); иначе переиспользуется кэш контейнера. |
T13-L6 0.29 c | Symfony | Which environment variable selects the active Symfony environment (dev/prod)? | «app_env» Пояснение: In Symfony, the APP_ENV environment variable determines the active environment, such as dev or prod.
Raw{"answer": "APP_ENV", "explanation": "In Symfony, the APP_ENV environment variable determines the active environment, such as dev or prod."} | верно | APP_ENV в .env; APP_DEBUG — отдельный флаг отладки. |
T13-L7 0.36 c | Symfony | A controller method can be private — Symfony routing works with any method of the class. | «no» Пояснение: Symfony requires controller action methods to be public so the framework can invoke them; private or protected methods cannot be accessed by the router.
Raw{"answer": "no", "explanation": "Symfony requires controller action methods to be public so the framework can invoke them; private or protected methods cannot be accessed by the router."} | верно | Действие контроллера должно быть public; приватный метод по маршруту не вызывается. |
T13-L8 0.52 c | Symfony | Event subscribers always receive events before listeners, because the interface gives them priority. | «no» Пояснение: In Symfony's EventDispatcher, event listeners and subscribers are not inherently prioritized by their type; priority is determined by the integer priority value assigned to each listener, regardless of whether it comes from a subscriber or a direct listener registration.
Raw{"answer": "no", "explanation": "In Symfony's EventDispatcher, event listeners and subscribers are not inherently prioritized by their type; priority is determined by the integer priority value assigned to each listener, regardless of whether it comes from a subscriber or a direct listener registration."} | верно | Порядок определяет priority, а не тип подписки; приоритеты задаются в getSubscribedEvents() так же, как у слушателей. |
T22-L1 0.43 c | Symfony: Security and forms | In modern Symfony (6.0+) authentication is built on authenticator classes (AuthenticatorInterface); the old guard system has been removed. | «yes» Пояснение: Symfony 6.0 removed the old guard system and fully transitioned to the modern authenticator system (AuthenticatorInterface) for handling authentication.
Raw```json ⏎ {"answer": "yes", "explanation": "Symfony 6.0 removed the old guard system and fully transitioned to the modern authenticator system (AuthenticatorInterface) for handling authentication."} ⏎ ``` | верно | Guard объявлен устаревшим в 5.3 и удалён в 6.0; в проекте symfony/security-bundle 8.1. |
T22-L2 0.46 c | Symfony: Security and forms | Which Symfony attribute checks a role/permission right on a controller method (403 without it)? | «isgranted» Пояснение: The Symfony attribute @IsGranted checks for a user's role or permission on a controller method, returning a 403 error if not authorized.
Raw```json ⏎ {"answer": "IsGranted", "explanation": "The Symfony attribute @IsGranted checks for a user's role or permission on a controller method, returning a 403 error if not authorized."} ⏎ ``` | верно | #[IsGranted('ROLE_ADMIN')]; атрибут из symfony/security-http. |
T22-L3 0.48 c | Symfony: Security and forms | Voters are Symfony's mechanism for checking access to a specific object: isGranted('EDIT', $post). | «yes» Пояснение: Voters are Symfony's security component designed to grant or deny access rights based on specific conditions and attributes, such as checking if a user can edit a specific object like $post.
Raw{"answer": "yes", "explanation": "Voters are Symfony's security component designed to grant or deny access rights based on specific conditions and attributes, such as checking if a user can edit a specific object like $post."} | верно | VoterInterface->vote(); docs Symfony — Voters. |
T22-L4 0.39 c | Symfony: Security and forms | In modern Symfony (7+) validation constraints are declared as PHP attributes (#[Assert\NotBlank]); doctrine annotations are no longer supported. | «no» Пояснение: While Doctrine annotations for validation are deprecated, they are still supported in Symfony 7 (though discouraged in favor of PHP 8 attributes).
Raw{ ⏎ "answer": "no", ⏎ "explanation": "While Doctrine annotations for validation are deprecated, they are still supported in Symfony 7 (though discouraged in favor of PHP 8 attributes)." ⏎ } | неверно верный: «yes» | Докблок-аннотации удалены в Symfony 7.0; стандарт — атрибуты. В проекте symfony/validator 8.1. |
T22-L5 0.33 c | Symfony: Security and forms | CSRF protection of Symfony forms is enabled by default: the form validates the token on submission. | «yes» Пояснение: Symfony forms automatically generate and validate CSRF tokens by default to protect against Cross-Site Request Forgery attacks.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "Symfony forms automatically generate and validate CSRF tokens by default to protect against Cross-Site Request Forgery attacks." ⏎ } | верно | FormType добавляет скрытое поле _token и проверяет его при валидации; отключение — осознанное исключение (csrf: false). |
T22-L6 0.33 c | Symfony: Security and forms | Form validation in Symfony runs server-side even if the client-side (HTML5) checks passed. | «yes» Пояснение: Symfony's validation system is independent and always executes server-side to ensure security and data integrity, regardless of client-side HTML5 validation results.
Raw{"answer": "yes", "explanation": "Symfony's validation system is independent and always executes server-side to ensure security and data integrity, regardless of client-side HTML5 validation results."} | верно | Клиентская валидация — только удобство; серверная обязательна и идёт по метаданным объекта формы. |
T22-L7 0.3 c | Symfony: Security and forms | Which Symfony maker command generates a form class (FormType)? | «make:form» Пояснение: The Symfony MakerBundle command 'make:form' is used to generate a new form type class.
Raw{"answer": "make:form", "explanation": "The Symfony MakerBundle command 'make:form' is used to generate a new form type class."} | верно | bin/console make:form (symfony/maker-bundle — в проекте). |
T22-L8 0.51 c | Symfony: Security and forms | Symfony stores the user's password in the session in plain text. | «no» Пояснение: Symfony uses hashed passwords (e.g., via password_hash) and stores only a hashed value or a security token, never the plain-text password, in the session.
Raw{"answer": "no", "explanation": "Symfony uses hashed passwords (e.g., via password_hash) and stores only a hashed value or a security token, never the plain-text password, in the session."} | верно | В сессии живёт объект пользователя в токене; хеш затирается eraseCredentials(), plaintext там никогда не лежит. |
T23-L1 0.48 c | Symfony: configuration and services | Symfony bundle configuration lives in config/packages — one file per bundle or topic. | «yes» Пояснение: In modern Symfony (4.0+), bundle configurations are typically split into separate files within the config/packages directory, with one file per bundle (e.g., framework.yaml, twig.yaml).
Raw{"answer": "yes", "explanation": "In modern Symfony (4.0+), bundle configurations are typically split into separate files within the config/packages directory, with one file per bundle (e.g., framework.yaml, twig.yaml)."} | верно | Стандартная структура (config/packages/*.yaml); перегрузка — config/packages/<env>. |
T23-L2 0.44 c | Symfony: configuration and services | The .env file with dev defaults is committed to the repository, while real secrets live in the non-committed .env.local. | «yes» Пояснение: It is a common best practice to commit a default .env file for development settings while keeping sensitive credentials in an untracked file like .env.local or .env.development.local.
Raw{"answer": "yes", "explanation": "It is a common best practice to commit a default .env file for development settings while keeping sensitive credentials in an untracked file like .env.local or .env.development.local."} | верно | symfony/dotenv: .env — общий безопасный набор значений; локальные секреты — .env.local (gitignored) или secrets-хранилище. |
T23-L3 0.38 c | Symfony: configuration and services | Which Symfony command lists the container's registered services and their aliases? | «debug:container» Пояснение: The `bin/console debug:container` command is used in Symfony to list the container's services and their aliases.
Raw{"answer": "debug:container", "explanation": "The `bin/console debug:container` command is used in Symfony to list the container's services and their aliases."} | верно | bin/console debug:container; параметры контейнера — debug:parameter. |
T23-L4 0.46 c | Symfony: configuration and services | The Symfony container allows changing parameters at runtime: $container->setParameter() works from a controller. | «no» Пояснение: The Symfony container is frozen after the first service is used, preventing further parameter changes via setParameter() in a running application (controllers).
Raw{"answer": "no", "explanation": "The Symfony container is frozen after the first service is used, preventing further parameter changes via setParameter() in a running application (controllers)."} | верно | Контейнер компилируется и замораживается; runtime-значения — только через переменные окружения. |
T23-L5 0.38 c | Symfony: configuration and services | By default, Symfony services are public (public: true) — you can fetch them directly from the container. | «no» Пояснение: Since Symfony 4.0, services are private by default to improve performance and memory usage; only specific services are explicitly marked as public.
Raw{"answer": "no", "explanation": "Since Symfony 4.0, services are private by default to improve performance and memory usage; only specific services are explicitly marked as public."} | верно | С Symfony 4.0 сервисы по умолчанию private: инжектятся через autowiring; $container->get() — только для публичных. |
T23-L6 0.28 c | Symfony: configuration and services | Without a config file in config/packages a bundle will not work — configuration is mandatory for every bundle. | «no» Пояснение: Bundles can function without specific configuration files if they do not require any custom settings or if default values suffice.
Raw{"answer": "no", "explanation": "Bundles can function without specific configuration files if they do not require any custom settings or if default values suffice."} | верно | У бандлов есть встроенные умолчания (Extension); конфиг нужен только для отклонений от них. |
T23-L7 0.3 c | Symfony: configuration and services | Environment variable values are injected into services.yaml using the %env(VAR)% syntax. | «yes» Пояснение: The %env(VAR)% syntax is used in services.yaml to reference environment variables.
Raw```json ⏎ {"answer": "yes", "explanation": "The %env(VAR)% syntax is used in services.yaml to reference environment variables."} ⏎ ``` | верно | %env(...)% резолвится в рантайме env-процессорами; docs — Env Var Processors. |
T23-L8 0.34 c | Symfony: configuration and services | Which Symfony environment variable enables debug mode (affects the profiler and Twig debugging)? | «app_debug» Пояснение: The APP_DEBUG environment variable is used in Symfony to enable or disable debug mode, which affects the profiler and Twig's debug functionality.
Raw{"answer": "APP_DEBUG", "explanation": "The APP_DEBUG environment variable is used in Symfony to enable or disable debug mode, which affects the profiler and Twig's debug functionality."} | верно | APP_DEBUG=1 (в .env dev-окружения); окружение выбирает APP_ENV — см. T13-L6. |
T16-L1 0.53 c | Symfony: Messenger | A single message in Symfony Messenger can only have one handler. | «yes» Пояснение: In Symfony Messenger, a message is routed to exactly one handler for each middleware in the chain; if multiple handlers are defined for the same message type, a configuration error occurs, ensuring a single handler is used per message type.
Raw{"answer": "yes", "explanation": "In Symfony Messenger, a message is routed to exactly one handler for each middleware in the chain; if multiple handlers are defined for the same message type, a configuration error occurs, ensuring a single handler is used per message type."} | неверно верный: «no» | Messenger вызывает все хендлеры, подписанные на класс сообщения (docs — Multiple Handlers). |
T16-L2 0.31 c | Symfony: Messenger | The sync transport in Messenger queues the message for a worker, just like async. | «no» Пояснение: The sync transport executes the message immediately in the current process, whereas async transports queue it for a separate worker to process later.
Raw{"answer": "no", "explanation": "The sync transport executes the message immediately in the current process, whereas async transports queue it for a separate worker to process later."} | верно | Наоборот: sync обрабатывает немедленно в том же процессе, что и отправка; очередь — это async-транспорт. |
T16-L3 0.27 c | Symfony: Messenger | Which console command starts the worker that processes Messenger queue messages? | «messenger:consume» Пояснение: The Symfony command messenger:consume starts the worker to process queued messages.
Raw{"answer": "messenger:consume", "explanation": "The Symfony command messenger:consume starts the worker to process queued messages."} | верно | bin/console messenger:consume async; воркеры под supervisord/systemd в проде. |
T16-L4 0.47 c | Symfony: Messenger | Retries for failed messages (retry_strategy) are configured per Messenger transport. | «yes» Пояснение: In Symfony's Messenger component, retry strategies (including retry attempts and delay) are indeed configured on a per-transport basis in the framework's configuration.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In Symfony's Messenger component, retry strategies (including retry attempts and delay) are indeed configured on a per-transport basis in the framework's configuration." ⏎ } ⏎ ``` | верно | retry_strategy на транспорте: max_retries, delay, multiplier; docs — Failed Messages & Retries. |
T16-L5 0.43 c | Symfony: Messenger | By default, Messenger serializes messages to JSON. | «yes» Пояснение: The default serializer in Symfony Messenger is the Serializer, which typically uses JSONEncoder to convert messages to JSON format for transports like AMQP or Redis.
Raw{"answer": "yes", "explanation": "The default serializer in Symfony Messenger is the Serializer, which typically uses JSONEncoder to convert messages to JSON format for transports like AMQP or Redis."} | неверно верный: «no» | Дефолтный сериализатор — PhpSerializer (serialize()); JSON-сериализатор включается отдельно. |
T16-L6 0.41 c | Symfony: Messenger | Symfony Scheduler produces messages on a schedule and dispatches them through Messenger. | «yes» Пояснение: Symfony Scheduler is designed to trigger tasks at specific intervals and typically dispatches them as messages to the Symfony Messenger component.
Raw{"answer": "yes", "explanation": "Symfony Scheduler is designed to trigger tasks at specific intervals and typically dispatches them as messages to the Symfony Messenger component."} | верно | Schedule → RecurringMessage → шина Messenger; docs — Scheduler. |
T16-L7 0.35 c | Symfony: Messenger | Which built-in Messenger transport stores messages in database tables via Doctrine? | «doctrine» Пояснение: The doctrine transport is used in Symfony Messenger to persist messages in database tables via Doctrine ORM or DBAL.
Raw{ ⏎ "answer": "doctrine", ⏎ "explanation": "The doctrine transport is used in Symfony Messenger to persist messages in database tables via Doctrine ORM or DBAL." ⏎ } | верно | Транспорт doctrine (symfony/doctrine-messenger); таблица messenger_messages. В проекте стоит amqp-messenger + doctrine-messenger. |
T16-L8 0.44 c | Symfony: Messenger | The Messenger pipeline can be extended with custom middleware, placed before or after the built-in ones. | «yes» Пояснение: Laravel's Messenger pipeline supports custom middleware that can be ordered before or after built-in handlers like SendEmail or VerifyModelIsNotDeleted.
Raw{"answer": "yes", "explanation": "Laravel's Messenger pipeline supports custom middleware that can be ordered before or after built-in handlers like SendEmail or VerifyModelIsNotDeleted."} | верно | messenger.bus.*.middleware в yaml; docs — Middleware. |
T28-L1 2.89 c | Symfony: versions | Symfony major releases come every two years, minor ones every six months (in May and November). | «no» Пояснение: Symfony releases minor versions every six months (May and November), but major versions typically occur every two years (e.g., 4.0 in 2017, 5.0 in 2019, 6.0 in 2021, 7.0 in 2023), which aligns with the two-year cycle, however, the statement is considered false in many contexts because major releases are tied to the odd-numbered May release every two years, and some interpretations might argue the phrasing is imprecise or that the 'every two years' rule has exceptions or nuances, but technically it is largely true. Wait, let's re-evaluate. Standard knowledge: Minor: 6 months. Major: 2 years. This is a standard fact. Why would it be false? Perhaps because major releases do not *always* strictly follow a rigid 2-year schedule without exception, or because the question implies *only* this pattern? Actually, the statement is generally accepted as true. Let me check if there's a trick. 'Major releases come every two years' - yes. 'Minor ones every six months' - yes. Is there a catch? Some sources say major releases are every two years *starting from the previous major*. That is consistent. Let's look for a reason it might be false. Maybe the prompt implies that *all* major releases are exactly 2 years apart, which is true. Is it possible the answer is 'yes'? The instruction says 'True or false?'. If the statement is accurate, the answer is 'yes'. Let's assume the statement is factually correct. Therefore, answer is 'yes'.
Raw{"answer": "no", "explanation": "Symfony releases minor versions every six months (May and November), but major versions typically occur every two years (e.g., 4.0 in 2017, 5.0 in 2019, 6.0 in 2021, 7.0 in 2023), which aligns with the two-year cycle, however, the statement is considered false in many contexts because major releases are tied to the odd-numbered May release every two years, and some interpretations might argue the phrasing is imprecise or that the 'every two years' rule has exceptions or nuances, but technically it is largely true. Wait, let's re-evaluate. Standard knowledge: Minor: 6 months. Major: 2 years. This is a standard fact. Why would it be false? Perhaps because major releases do not *always* strictly follow a rigid 2-year schedule without exception, or because the question implies *only* this pattern? Actually, the statement is generally accepted as true. Let me check if there's a trick. 'Major releases come every two years' - yes. 'Minor ones every six months' - yes. Is there a catch? Some sources say major releases are every two years *starting from the previous major*. That is consistent. Let's look for a reason it might be false. Maybe the prompt implies that *all* major releases are exactly 2 years apart, which is true. Is it possible the answer is 'yes'? The instruction says 'True or false?'. If the statement is accurate, the answer is 'yes'. Let's assume the statement is factually correct. Therefore, answer is 'yes'."} | неверно верный: «yes» | Стандартный релизный цикл: 8.0 — ноябрь 2025, 8.1 — май 2026, 8.2 — ноябрь 2026. |
T28-L2 0.3 c | Symfony: versions | What is the minimum PHP version required by Symfony 8? | «8.4» Пояснение: Symfony 8.0 requires PHP 8.4 or higher as its minimum supported version.
Raw{"answer": "8.4", "explanation": "Symfony 8.0 requires PHP 8.4 or higher as its minimum supported version."} | верно | Symfony 8.0 поднял требование до PHP >= 8.4.1 (в vendor проекта: "php": ">=8.4.1"). |
T28-L3 0.39 c | Symfony: versions | Symfony 7.0 kept support for docblock annotations (validation, routes). | «no» Пояснение: Symfony 7.0 removed support for docblock annotations in favor of PHP attributes, requiring the removal of the `doctrine/annotations` dependency for core features like validation and routing.
Raw{"answer": "no", "explanation": "Symfony 7.0 removed support for docblock annotations in favor of PHP attributes, requiring the removal of the `doctrine/annotations` dependency for core features like validation and routing."} | верно | Наоборот: в 7.0 аннотации удалены — только PHP-атрибуты (#[Route], #[Assert\NotBlank]). |
T28-L4 0.38 c | Symfony: versions | AssetMapper manages CSS/JS without node or webpack — via importmap.php. | «yes» Пояснение: AssetMapper is a Symfony component that manages assets without requiring Node.js or Webpack, using an import map for dependency resolution.
Raw{"answer": "yes", "explanation": "AssetMapper is a Symfony component that manages assets without requiring Node.js or Webpack, using an import map for dependency resolution."} | верно | symfony/asset-mapper (с 6.3, стандарт с 7.x); в проекте — importmap.php в корне и asset-mapper 8.1. |
T28-L5 0.41 c | Symfony: versions | Symfony 6.4 is a regular release without long-term support. | «no» Пояснение: Symfony 6.4 is an LTS (Long-Term Support) release, providing bug fixes until November 2027 and security fixes until November 2029.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony 6.4 is an LTS (Long-Term Support) release, providing bug fixes until November 2027 and security fixes until November 2029."} ⏎ ``` | верно | Наоборот: 6.4 — LTS (расширенная поддержка); LTS выходит вместе с очередным мажором (6.4 — вместе с 7.0). |
T28-L6 0.43 c | Symfony: versions | When moving to a new Symfony major version, deprecations of the previous branch keep working — major releases do not remove them. | «no» Пояснение: Major versions in Symfony typically remove deprecated functionality from the previous major version, adhering to the principle that backward incompatibilities are only introduced in major releases.
Raw{"answer": "no", "explanation": "Major versions in Symfony typically remove deprecated functionality from the previous major version, adhering to the principle that backward incompatibilities are only introduced in major releases."} | верно | Наоборот: мажорный релиз удаляет всё устаревшее (7.0 убрал деприкейшены 6.x, 8.0 — 7.x). |
T28-L7 0.37 c | Symfony: versions | Every Symfony major release is accompanied by an UPGRADE guide listing the changes. | «yes» Пояснение: Symfony releases an UPGRADE file in every version (including minor) to document changes.
Raw{"answer": "yes", "explanation": "Symfony releases an UPGRADE file in every version (including minor) to document changes."} | верно | UPGRADE-7.0.md, UPGRADE-8.0.md в репозитории symfony/symfony. |
T28-L8 0.84 c | Symfony: versions | Which Symfony component manages assets and the importmap without node/webpack? | «webpack-encore-bundle» Пояснение: Actually, the Symfony component that manages assets and import maps without Node.js or Webpack is the 'Symfony Webpack Encore' alternative known as 'AssetMapper' (part of Symfony 6.3+) which works with ImportMap and does not require Node.js. The correct answer is 'AssetMapper' or 'Symfony AssetMapper'.
Raw{"answer": "webpack-encore-bundle", "explanation": "Actually, the Symfony component that manages assets and import maps without Node.js or Webpack is the 'Symfony Webpack Encore' alternative known as 'AssetMapper' (part of Symfony 6.3+) which works with ImportMap and does not require Node.js. The correct answer is 'AssetMapper' or 'Symfony AssetMapper'."} | неверно верный: «asset-mapper» | symfony/asset-mapper 8.1 — в проекте. |
T29-L1 0.52 c | Symfony: 8.2 and beyond | As of 2026-11-07, Symfony 8.2 has already been released. | «no» Пояснение: As of 2026-11-07, Symfony follows a standard release cycle where major versions (like 8.0) are released in November of even years, so 8.2 would not have been released yet.
Raw```json ⏎ {"answer": "no", "explanation": "As of 2026-11-07, Symfony follows a standard release cycle where major versions (like 8.0) are released in November of even years, so 8.2 would not have been released yet."} ⏎ ``` | верно | Наоборот: 8.2 ещё не выпущена — релиз в конце ноября 2026; последняя стабильная — 8.1. |
T29-L2 1.51 c | Symfony: 8.2 and beyond | As of 2026-11-07, Symfony 8.2 is scheduled for November 2026, following the usual six-month cycle. | «no» Пояснение: Symfony versions are numbered by year and major release (e.g., 7.2 in Nov 2025, 8.2 in Nov 2026), so the next release after 7.2 (Nov 2025) would be 8.0 (May 2026) then 8.1 (Nov 2026), not 8.2, or rather standard cycle is x.0 in May, x.1 in Nov. Wait, Symfony releases x.0 in May and x.1 in November. So in 2026, it would be 8.0 (May) and 8.1 (Nov). There is no 8.2 in November 2026. Also, minor version 2 releases are not part of the standard 2x/year cycle for the same major.
Raw{"answer": "no", "explanation": "Symfony versions are numbered by year and major release (e.g., 7.2 in Nov 2025, 8.2 in Nov 2026), so the next release after 7.2 (Nov 2025) would be 8.0 (May 2026) then 8.1 (Nov 2026), not 8.2, or rather standard cycle is x.0 in May, x.1 in Nov. Wait, Symfony releases x.0 in May and x.1 in November. So in 2026, it would be 8.0 (May) and 8.1 (Nov). There is no 8.2 in November 2026. Also, minor version 2 releases are not part of the standard 2x/year cycle for the same major."} | неверно верный: «yes» | Политика релизов: 8.1 — май 2026, 8.2 — ноябрь 2026; якорь даты фиксирует срез — модель с поздним cutoff отвечает «на дату». |
T29-L3 0.45 c | Symfony: 8.2 and beyond | Which Symfony version comes after 8.1 (as of 2026-11-07)? | «8.2» Пояснение: Following the standard semantic versioning pattern for Symfony minor releases, the version immediately succeeding 8.1 is 8.2.
Raw{ ⏎ "answer": "8.2", ⏎ "explanation": "Following the standard semantic versioning pattern for Symfony minor releases, the version immediately succeeding 8.1 is 8.2." ⏎ } | верно | 8.2 — следующий минорный релиз (ноябрь 2026); после его выхода проект переходит с 8.1.* на 8.2.*. |
T29-L4 0.57 c | Symfony: 8.2 and beyond | Symfony 8.2 is a major release requiring applications to be rewritten for new APIs. | «no» Пояснение: Symfony follows strict semantic versioning where major releases (like 8.0) remove deprecated features, but 8.2 would be a minor release adding new features and bug fixes without requiring a rewrite of applications for new APIs.
Raw{"answer": "no", "explanation": "Symfony follows strict semantic versioning where major releases (like 8.0) remove deprecated features, but 8.2 would be a minor release adding new features and bug fixes without requiring a rewrite of applications for new APIs."} | верно | Наоборот: 8.2 — минорный релиз; новые возможности без поломки обратной совместимости. Мажор — 9.0. |
T29-L5 0.43 c | Symfony: 8.2 and beyond | Updating within a major branch (8.1 → 8.2) should not require code changes — backward compatibility is preserved. | «yes» Пояснение: PHP follows strict backward compatibility guarantees between minor versions within the same major branch (e.g., 8.1 to 8.2), ensuring existing code continues to work without changes.
Raw{"answer": "yes", "explanation": "PHP follows strict backward compatibility guarantees between minor versions within the same major branch (e.g., 8.1 to 8.2), ensuring existing code continues to work without changes."} | верно | Политика Symfony: минорные релизы обратно совместимы; BC-break допустим только в мажорных. |
T29-L6 0.45 c | Symfony: 8.2 and beyond | Which minor version of the 8.x branch is released last, before Symfony 9.0? | «8.3» Пояснение: Symfony follows a policy where the last minor version of the 8.x series (8.3) is released before the next major version 9.0.
Raw{"answer": 8.3, "explanation": "Symfony follows a policy where the last minor version of the 8.x series (8.3) is released before the next major version 9.0."} | неверно верный: «8.4» | По циклу: 8.2 (ноя 2026), 8.3 (май 2027), 8.4 (ноя 2027, вместе с 9.0) — как 6.4 выходила вместе с 7.0. |
T29-L7 1.07 c | Symfony: 8.2 and beyond | Symfony 8.2 will require PHP 8.5 — you would have to upgrade PHP along with it. | «no» Пояснение: Symfony 7.0+ requires PHP 8.1, but PHP 8.5 is not a real version (PHP versions go 8.0-8.4 currently, with no 8.5 release defined or required by Symfony 8.2 as of current knowledge; also, Symfony typically lags behind latest PHP by supporting stable versions like 8.1/8.2/8.3, not the very latest unstable/non-existent version).
Raw{"answer": "no", "explanation": "Symfony 7.0+ requires PHP 8.1, but PHP 8.5 is not a real version (PHP versions go 8.0-8.4 currently, with no 8.5 release defined or required by Symfony 8.2 as of current knowledge; also, Symfony typically lags behind latest PHP by supporting stable versions like 8.1/8.2/8.3, not the very latest unstable/non-existent version)."} | верно | Наоборот: минорные релизы не поднимают требования PHP; для всей ветки 8.x остаётся PHP >= 8.4. |
T29-L8 0.39 c | Symfony: 8.2 and beyond | Deprecations added in the 8.x branch will not be removed before Symfony 9.0. | «yes» Пояснение: In Symfony, features deprecated in a major version (like 8.x) are typically scheduled for removal in the next major version (9.0).
Raw{"answer": "yes", "explanation": "In Symfony, features deprecated in a major version (like 8.x) are typically scheduled for removal in the next major version (9.0)."} | верно | Политика: деприкейшены живут до следующего мажора; 9.0 — ноябрь 2027. |
T21-L1 0.47 c | Twig | Inside {{ }}, Twig allows calling arbitrary PHP code directly. | «no» Пояснение: Twig is a templating engine that uses its own syntax and built-in filters/functions; it does not allow direct execution of arbitrary PHP code within {{ }} delimiters for security reasons.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Twig is a templating engine that uses its own syntax and built-in filters/functions; it does not allow direct execution of arbitrary PHP code within {{ }} delimiters for security reasons." ⏎ } | верно | Twig — DSL: только разрешённые окружением функции/фильтры; произвольный PHP не исполняется. |
T21-L2 0.33 c | Twig | By default, Twig auto-escapes printed variables. | «yes» Пояснение: Twig automatically escapes variables when they are printed using the {{ }} syntax to prevent XSS attacks.
Raw{"answer": "yes", "explanation": "Twig automatically escapes variables when they are printed using the {{ }} syntax to prevent XSS attacks."} | верно | Autoescape включён по умолчанию; {{ '<b>' }} → <b>. Проверено на Twig 3.30. |
T21-L3 0.27 c | Twig | The Twig |e filter escapes a string for safe output in an HTML context. | «yes» Пояснение: The Twig `|e` filter applies `htmlspecialchars` to escape special characters for safe HTML output.
Raw{"answer": "yes", "explanation": "The Twig `|e` filter applies `htmlspecialchars` to escape special characters for safe HTML output."} | верно | |e ('html') по умолчанию; есть контексты js/url/css. От SQL-инъекций он не защищает — это задача подготовленных запросов Doctrine. |
T21-L4 0.28 c | Twig | Which filter from twig/intl-extra formats a number according to a locale? | «number_format» Пояснение: The twig/intl-extra bundle provides the number_format filter to format numbers based on a specified locale.
Raw{"answer": "number_format", "explanation": "The twig/intl-extra bundle provides the number_format filter to format numbers based on a specified locale."} | неверно верный: «format_number» | |format_number(locale=...) из IntlExtension (twig/intl-extra есть в проекте). Проверено на Twig 3.30: 12345.6 → 12 345,6 (ru). |
T21-L5 0.47 c | Twig | The |raw filter disables auto-escaping for the value. | «yes» Пояснение: In PHP templating engines like Twig, the |raw filter is specifically used to output a variable as-is, bypassing the default HTML entity encoding (auto-escaping).
Raw{"answer": "yes", "explanation": "In PHP templating engines like Twig, the |raw filter is specifically used to output a variable as-is, bypassing the default HTML entity encoding (auto-escaping)."} | верно | {{ x|raw }} выводит HTML как есть; опасно с пользовательскими данными. Проверено на Twig 3.30. |
T21-L6 0.37 c | Twig | In Twig, {{ }} prints an expression value, while {% %} executes tags — conditions, loops, set. | «yes» Пояснение: In Twig, double curly braces {{ }} are used for printing variable values or expressions, while percent braces {% %} are used for executing structural tags like loops and conditionals.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Twig, double curly braces {{ }} are used for printing variable values or expressions, while percent braces {% %} are used for executing structural tags like loops and conditionals." ⏎ } | верно | Два блока синтаксиса Twig: вывод (echo) против логики. |
T21-L7 0.35 c | Twig | In Twig you cannot declare a variable inside a template — values only come from the controller. | «no» Пояснение: In Twig, you can declare and assign values to variables using the {% set %} tag.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In Twig, you can declare and assign values to variables using the {% set %} tag." ⏎ } ⏎ ``` | верно | {% set y = ... %} объявляет переменную в шаблоне. Проверено на Twig 3.30. |
T21-L8 0.27 c | Twig | Which Twig function dumps the debug structure of a variable (array, object)? | «dump» Пояснение: The Twig function 'dump' is used to display the debug structure of a variable.
Raw```json ⏎ {"answer": "dump", "explanation": "The Twig function 'dump' is used to display the debug structure of a variable."} ⏎ ``` | верно | {{ dump(x) }} (DebugExtension; в Symfony доступна в dev-окружении). |
T24-L1 0.47 c | Bootstrap | Bootstrap is a CSS/JS library of ready-made UI components, not an SPA framework. | «yes» Пояснение: Bootstrap provides a collection of pre-built UI components and utilities for CSS and JavaScript, but it does not provide the architecture or state management required to be a single-page application (SPA) framework.
Raw{"answer": "yes", "explanation": "Bootstrap provides a collection of pre-built UI components and utilities for CSS and JavaScript, but it does not provide the architecture or state management required to be a single-page application (SPA) framework."} | верно | Компоненты и утилиты поверх вашего HTML; SPA-фреймворки (React/Vue) — другой класс инструментов. В проекте vendored 5.3.3. |
T24-L2 0.3 c | Bootstrap | Which Bootstrap class gives a responsive container with a fixed max width per breakpoint? | «container» Пояснение: The .container class in Bootstrap provides a responsive, centered wrapper with a fixed maximum width that changes at each breakpoint.
Raw{"answer": "container", "explanation": "The .container class in Bootstrap provides a responsive, centered wrapper with a fixed maximum width that changes at each breakpoint."} | верно | .container (фиксированная макс-ширина по брейкпоинтам) vs .container-fluid (на всю ширину). |
T24-L3 0.32 c | Bootstrap | The Bootstrap grid is built on CSS floats and splits a row into 16 columns. | «no» Пояснение: The Bootstrap grid is built on CSS flexbox (not floats) and splits a row into 12 columns (not 16).
Raw{"answer": "no", "explanation": "The Bootstrap grid is built on CSS flexbox (not floats) and splits a row into 12 columns (not 16)."} | верно | Наоборот: flexbox (с Bootstrap 4) и 12 колонок; float-сетка — это Bootstrap 3. |
T24-L4 0.28 c | Bootstrap | Bootstrap's named breakpoints (the infix used in class names) are sm, md, lg, xl, xxl — five of them. | «yes» Пояснение: Bootstrap 5 defines five standard named breakpoints: sm, md, lg, xl, and xxl.
Raw{"answer": "yes", "explanation": "Bootstrap 5 defines five standard named breakpoints: sm, md, lg, xl, and xxl."} | верно | Тиров всего шесть: xs (без инфикса) + пять именованных (576/768/992/1200/1400 px). |
T24-L5 0.36 c | Bootstrap | Utilities like .mt-3 or .px-2 use the spacing scale: the number is a multiple of $spacer. | «yes» Пояснение: In Bootstrap, utilities like .mt-3 and .px-2 use the spacing scale where the number is a multiple of the $spacer variable.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Bootstrap, utilities like .mt-3 and .px-2 use the spacing scale where the number is a multiple of the $spacer variable." ⏎ } | неверно верный: «no» | Spacing utilities; $spacer = 1rem. |
T24-L6 0.34 c | Bootstrap | Which Bootstrap 5 data attribute enables an interactive component (e.g. dropdown) on an element? | «data-bs-toggle» Пояснение: The data-bs-toggle attribute is used in Bootstrap 5 to specify the behavior of an interactive component, such as a dropdown, carousel, or collapse.
Raw{"answer": "data-bs-toggle", "explanation": "The data-bs-toggle attribute is used in Bootstrap 5 to specify the behavior of an interactive component, such as a dropdown, carousel, or collapse."} | верно | data-bs-toggle="dropdown" и т.п.; в Bootstrap 4 атрибут назывался data-toggle. |
T24-L7 0.36 c | Bootstrap | Bootstrap 5 components work without jQuery — in plain vanilla JS. | «yes» Пояснение: Bootstrap 5 has dropped jQuery in favor of native JavaScript APIs.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Bootstrap 5 has dropped jQuery in favor of native JavaScript APIs." ⏎ } ⏎ ``` | верно | jQuery удалён в Bootstrap 5.0: data-bs-* атрибуты и JS API. В проекте vendored 5.3.3. |
T24-L8 0.38 c | Bootstrap | Dark mode in Bootstrap is enabled with a .dark class on the root element. | «yes» Пояснение: In Bootstrap 5, dark mode is enabled by adding the 'dark' class to the <html> element (or using the data-bs-theme attribute).
Raw{"answer": "yes", "explanation": "In Bootstrap 5, dark mode is enabled by adding the 'dark' class to the <html> element (or using the data-bs-theme attribute)."} | неверно верный: «no» | Наоборот: тема включается атрибутом data-bs-theme="dark" (Color modes, с 5.3); класса .dark не существует. В проекте 5.3.3. |
T14-L1 0.46 c | Doctrine | Doctrine ORM creates database tables on the fly the first time an entity is used at runtime. | «no» Пояснение: Doctrine ORM does not automatically create tables; you need to use tools like Doctrine Migrations or the schema-tool to generate and apply the database schema.
Raw```json ⏎ {"answer": "no", "explanation": "Doctrine ORM does not automatically create tables; you need to use tools like Doctrine Migrations or the schema-tool to generate and apply the database schema."} ⏎ ``` | верно | Схему создают инструменты (migrations, schema tool); рантайм структуру БД не меняет. |
T14-L2 0.32 c | Doctrine | Which EntityManager method marks a new object as managed without executing SQL until flush()? | «persist» Пояснение: The persist() method in Doctrine ORM tells the EntityManager to manage the object and schedule an INSERT to be executed upon flush().
Raw{"answer": "persist", "explanation": "The persist() method in Doctrine ORM tells the EntityManager to manage the object and schedule an INSERT to be executed upon flush()."} | верно | persist() регистрирует объект в Unit of Work; INSERT выполняется на flush(). |
T14-L3 0.71 c | Doctrine | In Doctrine ORM 3, the EntityManager::merge() method exists and makes the passed object managed. | «no» Пояснение: In Doctrine ORM, the EntityManager::merge() method is deprecated and was removed in version 3; entities are now managed via persist() or automatically when associated with managed entities, but merge itself does not exist in ORM 3.
Raw{"answer": "no", "explanation": "In Doctrine ORM, the EntityManager::merge() method is deprecated and was removed in version 3; entities are now managed via persist() or automatically when associated with managed entities, but merge itself does not exist in ORM 3."} | верно | В ORM 3 merge() удалён (в vendor проекта 3.7.6 метода нет); в Doctrine 2.x merge() возвращал управляемую копию. Версия зафиксирована — ORM 3. |
T14-L4 0.44 c | Doctrine | DQL queries are written in terms of entities and their fields, not tables and columns. | «yes» Пояснение: DQL (Doctrine Query Language) is an object-oriented abstraction over SQL, allowing queries to be written using entity classes and their fields rather than direct table and column names.
Raw{"answer": "yes", "explanation": "DQL (Doctrine Query Language) is an object-oriented abstraction over SQL, allowing queries to be written using entity classes and their fields rather than direct table and column names."} | верно | Doctrine транслирует DQL в SQL; docs — DQL (Doctrine Query Language). |
T14-L5 0.29 c | Doctrine | What does $repository->find(999) return when no record with id 999 exists? | «null» Пояснение: Doctrine's find() method returns null when no entity with the given identifier is found.
Raw{"answer": "null", "explanation": "Doctrine's find() method returns null when no entity with the given identifier is found."} | верно | find() возвращает null, если объект не найден (docs Repository methods). |
T14-L6 0.8 c | Doctrine | DoctrineBundle in Symfony automatically calls flush() at the end of every request. | «no» Пояснение: The Doctrine bundle (and Doctrine persistence in general) does not automatically call flush() at the end of every request; it typically relies on manual flush calls or specific configuration options like 'auto_commit' which defaults to false in many setups, and relying on it can lead to performance issues and unexpected behavior.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "The Doctrine bundle (and Doctrine persistence in general) does not automatically call flush() at the end of every request; it typically relies on manual flush calls or specific configuration options like 'auto_commit' which defaults to false in many setups, and relying on it can lead to performance issues and unexpected behavior." ⏎ } | верно | Авто-flush нет — flush() зовёт разработчик; незакрытая транзакция в конце запроса откатывается. |
T14-L7 0.46 c | Doctrine | For a managed entity, changing a property is enough: flush() commits the change without an explicit persist() — the Unit of Work tracks changes. | «yes» Пояснение: Doctrine's Unit of Work tracks changes to managed entities, so calling flush() will commit those changes without needing to explicitly persist() again.
Raw```json ⏎ {"answer": "yes", "explanation": "Doctrine's Unit of Work tracks changes to managed entities, so calling flush() will commit those changes without needing to explicitly persist() again."} ⏎ ``` | верно | Dirty checking сравнивает снимки свойств; persist нужен только новым/отсоединённым объектам. |
T14-L8 0.46 c | Doctrine | remove() executes the SQL DELETE immediately, without waiting for flush(). | «yes» Пояснение: In Doctrine ORM, $em->remove() immediately executes a DELETE query, unlike remove() on entities which marks them for deletion until flush() is called.
Raw{"answer": "yes", "explanation": "In Doctrine ORM, $em->remove() immediately executes a DELETE query, unlike remove() on entities which marks them for deletion until flush() is called."} | неверно верный: «no» | remove() планирует удаление в Unit of Work; DELETE выполняется на flush() (docs — Deleting Objects). |
T15-L1 0.27 c | PostgreSQL | PostgreSQL uses MVCC, therefore readers block writers and writers block readers. | «no» Пояснение: PostgreSQL's MVCC mechanism allows readers and writers to operate concurrently without blocking each other.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "PostgreSQL's MVCC mechanism allows readers and writers to operate concurrently without blocking each other." ⏎ } | верно | Наоборот: благодаря MVCC читатели не блокируют писателей и наоборот (снимки строк); docs PostgreSQL — Concurrency Control. |
T15-L2 0.31 c | PostgreSQL | Which SQL command shows a query's execution plan without executing the query? | «explain» Пояснение: The EXPLAIN command displays how the database engine will execute a SELECT statement without actually running it.
Raw{"answer": "EXPLAIN", "explanation": "The EXPLAIN command displays how the database engine will execute a SELECT statement without actually running it."} | верно | EXPLAIN без ANALYZE только строит план; проверено на PostgreSQL 17.7. |
T15-L3 0.49 c | PostgreSQL | SERIAL and GENERATED ... AS IDENTITY are just two names for the same mechanism. | «yes» Пояснение: In PostgreSQL (the primary context for these SQL terms), SERIAL is a shorthand that automatically creates a sequence and a generated column, which is functionally equivalent to defining a column with GENERATED ... AS IDENTITY.
Raw{"answer": "yes", "explanation": "In PostgreSQL (the primary context for these SQL terms), SERIAL is a shorthand that automatically creates a sequence and a generated column, which is functionally equivalent to defining a column with GENERATED ... AS IDENTITY."} | неверно верный: «no» | SERIAL — нестандартный макрос (sequence + DEFAULT), IDENTITY — SQL-стандарт; различаются владением и правами. Оба есть в PG 17 (проверено). |
T15-L4 0.29 c | PostgreSQL | By default, a PostgreSQL UNIQUE constraint allows only one row with NULL in the column. | «no» Пояснение: PostgreSQL treats NULL values as distinct, so a UNIQUE constraint allows multiple rows with NULL in the column.
Raw{"answer": "no", "explanation": "PostgreSQL treats NULL values as distinct, so a UNIQUE constraint allows multiple rows with NULL in the column."} | верно | Наоборот: NULLS DISTINCT по умолчанию — несколько NULL допустимы; NULLS NOT DISTINCT — опция с PG 15. Проверено на PG 17.7. |
T15-L5 0.25 c | PostgreSQL | Which PostgreSQL aggregate function concatenates strings with a separator? | «string_agg» Пояснение: The string_agg function in PostgreSQL concatenates strings with a specified separator.
Raw{"answer": "string_agg", "explanation": "The string_agg function in PostgreSQL concatenates strings with a specified separator."} | верно | string_agg(значение, разделитель); проверено на PostgreSQL 17.7. |
T15-L6 0.45 c | PostgreSQL | Plain VACUUM returns the space occupied by dead tuples to the operating system. | «no» Пояснение: Plain VACUUM only marks the space occupied by dead tuples for reuse by future insertions; it does not return that space to the operating system (this is done by VACUUM FULL).
Raw{"answer": "no", "explanation": "Plain VACUUM only marks the space occupied by dead tuples for reuse by future insertions; it does not return that space to the operating system (this is done by VACUUM FULL)."} | верно | VACUUM помечает место для переиспользования внутри таблицы; ОС его возвращает только VACUUM FULL (с эксклюзивной блокировкой). |
T15-L7 0.43 c | PostgreSQL | Which keyword in a window function definition partitions rows into groups the function is computed over? | «over» Пояснение: The OVER keyword is used in a window function to define the window frame, including partitioning, ordering, and frame clauses.
Raw```json ⏎ { ⏎ "answer": "OVER", ⏎ "explanation": "The OVER keyword is used in a window function to define the window frame, including partitioning, ordering, and frame clauses." ⏎ } ⏎ ``` | неверно верный: «partition by» | OVER (PARTITION BY ...); проверено на PostgreSQL 17.7. |
T15-L8 0.38 c | PostgreSQL | The READ COMMITTED isolation level protects against non-repeatable reads. | «no» Пояснение: READ COMMITTED does not prevent non-repeatable reads; that protection is provided by the REPEATABLE READ isolation level.
Raw```json ⏎ {"answer": "no", "explanation": "READ COMMITTED does not prevent non-repeatable reads; that protection is provided by the REPEATABLE READ isolation level."} ⏎ ``` | верно | READ COMMITTED допускает неповторяющееся чтение; защищает REPEATABLE READ. Проверено: SHOW transaction_isolation → read committed. |
T17-L1 0.33 c | PostgreSQL: transactions and indexes | By default, PostgreSQL wraps each single SQL statement in its own implicit transaction (autocommit). | «yes» Пояснение: In PostgreSQL, autocommit is enabled by default, meaning each SQL statement is automatically committed as its own transaction unless explicitly wrapped in a BEGIN/COMMIT block.
Raw{"answer": "yes", "explanation": "In PostgreSQL, autocommit is enabled by default, meaning each SQL statement is automatically committed as its own transaction unless explicitly wrapped in a BEGIN/COMMIT block."} | верно | Без BEGIN каждый оператор коммитится сам; docs PostgreSQL — Transactions. Проверено на PG 17. |
T17-L2 0.31 c | PostgreSQL: transactions and indexes | Which SQL command ends a transaction, committing all its changes? | «commit» Пояснение: The SQL command COMMIT is used to save all the changes made during a transaction to the database.
Raw{"answer": "COMMIT", "explanation": "The SQL command COMMIT is used to save all the changes made during a transaction to the database."} | верно | COMMIT (END — синоним). Проверено на PG 17. |
T17-L3 0.43 c | PostgreSQL: transactions and indexes | Indexes speed up more than SELECT: UPDATE and DELETE with a search on an indexed column benefit too. | «yes» Пояснение: Database indexes are designed to optimize data retrieval, which directly speeds up UPDATE and DELETE operations that use the indexed column in their WHERE clause to locate rows.
Raw{"answer": "yes", "explanation": "Database indexes are designed to optimize data retrieval, which directly speeds up UPDATE and DELETE operations that use the indexed column in their WHERE clause to locate rows."} | верно | Поиск строк для изменения идёт по индексу; docs PostgreSQL — Indexes. |
T17-L4 0.31 c | PostgreSQL: transactions and indexes | To roll back part of the statements inside a transaction, PostgreSQL uses SAVEPOINT. | «yes» Пояснение: PostgreSQL supports SAVEPOINT within a transaction to allow rolling back to a specific point in the transaction without aborting the entire transaction.
Raw{"answer": "yes", "explanation": "PostgreSQL supports SAVEPOINT within a transaction to allow rolling back to a specific point in the transaction without aborting the entire transaction."} | верно | SAVEPOINT name; ROLLBACK TO name — частичный откат без отмены всей транзакции. Проверено на PG 17. |
T17-L5 0.33 c | PostgreSQL: transactions and indexes | EXPLAIN ANALYZE shows the query plan without executing the query. | «no» Пояснение: EXPLAIN ANALYZE actually executes the query to gather runtime statistics, whereas EXPLAIN (without ANALYZE) only shows the plan without execution.
Raw{"answer": "no", "explanation": "EXPLAIN ANALYZE actually executes the query to gather runtime statistics, whereas EXPLAIN (without ANALYZE) only shows the plan without execution."} | верно | Наоборот: ANALYZE реально выполняет запрос (с побочными эффектами!) и показывает фактические времена узлов; план без выполнения — plain EXPLAIN. |
T17-L6 0.31 c | PostgreSQL: transactions and indexes | Which PostgreSQL extension adds vector types and indexes for embedding search? | «pgvector» Пояснение: pgvector is a PostgreSQL extension that adds support for vector similarity search by introducing vector types and indexes.
Raw{"answer": "pgvector", "explanation": "pgvector is a PostgreSQL extension that adds support for vector similarity search by introducing vector types and indexes."} | верно | CREATE EXTENSION vector (проект pgvector; в проекте образ pgvector/pgvector:pg17). |
T17-L7 0.31 c | PostgreSQL: transactions and indexes | A partial index (CREATE INDEX ... WHERE ...) is built only over rows satisfying the condition. | «no» Пояснение: Partial indexes are a feature of PostgreSQL, not a native feature of PHP or MySQL.
Raw{"answer": "no", "explanation": "Partial indexes are a feature of PostgreSQL, not a native feature of PHP or MySQL."} | неверно верный: «yes» | docs PostgreSQL — Partial Indexes; типичный кейс — индекс по «активным» записям. |
T17-L8 0.35 c | PostgreSQL: transactions and indexes | The SERIALIZABLE level in PostgreSQL is implemented by locking the rows a transaction reads. | «no» Пояснение: PostgreSQL implements the SERIALIZABLE isolation level using Serializable Snapshot Isolation (SSI), not by locking rows read.
Raw{"answer": "no", "explanation": "PostgreSQL implements the SERIALIZABLE isolation level using Serializable Snapshot Isolation (SSI), not by locking rows read."} | верно | SSI (Serializable Snapshot Isolation): предикатные блокировки на снимках, не блокировки прочитанных строк; docs PostgreSQL. |
T19-L1 0.32 c | HTTP and REST API | HTTP status 201 means the request resulted in a new resource being created. | «yes» Пояснение: HTTP status 201 Created is returned when a request successfully results in a new resource being created.
Raw{"answer": "yes", "explanation": "HTTP status 201 Created is returned when a request successfully results in a new resource being created."} | верно | 201 Created; обычно на POST, часто с Location; RFC 9110. |
T19-L2 0.27 c | HTTP and REST API | Which HTTP status means a successful request with an empty response body (e.g. after DELETE)? | «204» Пояснение: HTTP status 204 (No Content) indicates a successful request with an empty response body.
Raw{"answer": 204, "explanation": "HTTP status 204 (No Content) indicates a successful request with an empty response body."} | верно | 204 No Content; RFC 9110. |
T19-L3 0.38 c | HTTP and REST API | The DELETE method is idempotent per the HTTP specification: repeating the request for the same resource does not change the outcome. | «yes» Пояснение: According to the HTTP specification (RFC 7231), the DELETE method is intended to be idempotent, meaning that multiple identical requests should have the same effect as a single request.
Raw{"answer": "yes", "explanation": "According to the HTTP specification (RFC 7231), the DELETE method is intended to be idempotent, meaning that multiple identical requests should have the same effect as a single request."} | верно | RFC 9110: DELETE идемпотентен (как PUT); идемпотентность ≠ безопасность — ресурс удаляется при первом вызове. |
T19-L4 0.34 c | HTTP and REST API | The Access-Control-Allow-Origin header is sent by the client so that the server agrees to accept requests from another origin. | «no» Пояснение: The Access-Control-Allow-Origin header is sent by the server to indicate which origins are allowed to access the resource.
Raw{"answer": "no", "explanation": "The Access-Control-Allow-Origin header is sent by the server to indicate which origins are allowed to access the resource."} | верно | Наоборот: заголовок шлёт СЕРВЕР в ответе, разрешая браузеру cross-origin запрос (CORS); в проекте nelmio/cors-bundle. |
T19-L5 0.37 c | HTTP and REST API | Status 429 Too Many Requests is used when a client exceeds a rate limit. | «yes» Пояснение: HTTP status code 429 is specifically defined for cases where a client has sent too many requests in a given amount of time, commonly known as rate limiting.
Raw{"answer": "yes", "explanation": "HTTP status code 429 is specifically defined for cases where a client has sent too many requests in a given amount of time, commonly known as rate limiting."} | верно | 429 (+ Retry-After); RFC 6585. В проекте symfony/rate-limiter. |
T19-L6 0.23 c | HTTP and REST API | 5xx codes mean a client error, while 4xx means a server-side error. | «no» Пояснение: 4xx codes indicate client-side errors, while 5xx codes indicate server-side errors.
Raw{"answer": "no", "explanation": "4xx codes indicate client-side errors, while 5xx codes indicate server-side errors."} | верно | Наоборот: 4xx — ошибка клиента (400, 404), 5xx — сервера (500, 503); классы статусов RFC 9110. |
T19-L7 0.27 c | HTTP and REST API | Which HTTP header indicates the MIME type of the request or response body? | «content-type» Пояснение: The Content-Type HTTP header specifies the MIME type of the resource being transmitted.
Raw```json ⏎ {"answer": "Content-Type", "explanation": "The Content-Type HTTP header specifies the MIME type of the resource being transmitted."} ⏎ ``` | верно | Content-Type: application/json и т.п. |
T19-L8 0.39 c | HTTP and REST API | PATCH is not required to be idempotent per RFC 5789, unlike PUT. | «yes» Пояснение: RFC 5789 explicitly states that PATCH is not idempotent by default, whereas PUT is required to be idempotent per RFC 7231.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "RFC 5789 explicitly states that PATCH is not idempotent by default, whereas PUT is required to be idempotent per RFC 7231." ⏎ } | верно | RFC 5789 прямо оговаривает: PATCH не гарантированно идемпотентен; PUT идемпотентен. |
T20-L1 0.35 c | Security and OAuth | Checking a password by comparing its hash to the stored hash with a plain == is sufficient. | «no» Пояснение: Plain == is vulnerable to timing attacks, so timing-safe comparison functions like hash_equals should be used.
Raw{"answer": "no", "explanation": "Plain == is vulnerable to timing attacks, so timing-safe comparison functions like hash_equals should be used."} | верно | Нужна постоянновременная проверка (password_verify) — timing-атаки; соль и алгоритм уже внутри хеша. |
T20-L2 0.58 c | Security and OAuth | A CSRF token is issued by the server (bound to the session) and verified server-side on unsafe requests (POST etc.). | «yes» Пояснение: A CSRF token is indeed issued by the server, bound to the session, and verified on the server-side to prevent cross-site request forgery.
Raw```json ⏎ {"answer": "yes", "explanation": "A CSRF token is indeed issued by the server, bound to the session, and verified on the server-side to prevent cross-site request forgery."} ⏎ ``` | верно | symfony/security-csrf в проекте; защита от подделки межсайтовой формы. |
T20-L3 0.33 c | Security and OAuth | Which HTTP header enables the CSP (Content Security Policy) policy? | «content-security-policy» Пояснение: The HTTP header Content-Security-Policy is used to specify trusted sources of content execution.
Raw{"answer": "Content-Security-Policy", "explanation": "The HTTP header Content-Security-Policy is used to specify trusted sources of content execution."} | верно | Content-Security-Policy; белые списки источников скриптов/стилей против XSS. |
T20-L4 0.56 c | Security and OAuth | OAuth 2.0 is an authentication protocol: the access token tells you who the user is. | «no» Пояснение: OAuth 2.0 is an authorization framework, not an authentication protocol; while it can be used for login (auth), its primary purpose is to grant delegated access to resources, and the access token grants permissions rather than identifying the user.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "OAuth 2.0 is an authorization framework, not an authentication protocol; while it can be used for login (auth), its primary purpose is to grant delegated access to resources, and the access token grants permissions rather than identifying the user." ⏎ } ⏎ ``` | верно | OAuth 2.0 — авторизация/делегирование доступа; аутентификацию добавляет OpenID Connect. В проекте knpuniversity/oauth2-client-bundle (yandex/github/google). |
T20-L5 0.4 c | Security and OAuth | XSS is prevented by validating input on the server before writing it to the database. | «no» Пояснение: Server-side validation ensures data integrity but does not prevent XSS; output encoding/escaping when rendering is the critical defense mechanism.
Raw{"answer": "no", "explanation": "Server-side validation ensures data integrity but does not prevent XSS; output encoding/escaping when rendering is the critical defense mechanism."} | верно | XSS лечится контекстным экранированием НА ВЫВОДЕ (Twig autoescape, CSP); валидация ввода не покрывает все контексты вывода. |
T20-L6 0.38 c | Security and OAuth | In the OAuth 2.0 authorization code flow, which parameter arrives at the redirect_uri and is exchanged for an access token? | «code» Пояснение: In the OAuth 2.0 authorization code flow, the authorization server redirects the user agent back to the redirect_uri with an authorization code, which the client then exchanges for an access token.
Raw{"answer": "code", "explanation": "In the OAuth 2.0 authorization code flow, the authorization server redirects the user agent back to the redirect_uri with an authorization code, which the client then exchanges for an access token."} | верно | Параметр code; обмен на токен POST-ом на /token с client_secret. |
T20-L7 0.42 c | Security and OAuth | A refresh token lives longer than an access token and allows obtaining a new access token without the user logging in again. | «yes» Пояснение: A refresh token is designed to have a longer expiration time than an access token and is specifically used to obtain new access tokens without requiring the user to re-authenticate.
Raw```json ⏎ {"answer": "yes", "explanation": "A refresh token is designed to have a longer expiration time than an access token and is specifically used to obtain new access tokens without requiring the user to re-authenticate."} ⏎ ``` | верно | Стандартная схема OAuth/OIDC: короткий access + длинный refresh. |
T20-L8 0.59 c | Security and OAuth | A password salt must be kept secret: without it the hash cannot be verified. | «no» Пояснение: A salt is typically stored alongside the hash in the same user record (e.g., in a database) and does not need to be secret; its purpose is to ensure that identical passwords produce different hashes and to protect against precomputed attacks like rainbow tables.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "A salt is typically stored alongside the hash in the same user record (e.g., in a database) and does not need to be secret; its purpose is to ensure that identical passwords produce different hashes and to protect against precomputed attacks like rainbow tables." ⏎ } ⏎ ``` | верно | Соль хранится открыто (password_hash включает её в строку хеша); секретность соли не нужна. |
T18-L1 0.32 c | Testing: PHPUnit | PHPUnit runs test methods of any class — extending TestCase is not required. | «no» Пояснение: PHPUnit requires test classes to extend PHPUnit\Framework\TestCase to be recognized and executed correctly.
Raw{"answer": "no", "explanation": "PHPUnit requires test classes to extend PHPUnit\\Framework\\TestCase to be recognized and executed correctly."} | верно | Тестом считается метод класса, наследующего TestCase (PHPUnit 10). |
T18-L2 0.31 c | Testing: PHPUnit | In PHPUnit, setUp() runs once before all tests of the class. | «no» Пояснение: In PHPUnit, setUp() runs before each test method, while setUpBeforeClass() runs once before all tests of a class.
Raw```json ⏎ {"answer": "no", "explanation": "In PHPUnit, setUp() runs before each test method, while setUpBeforeClass() runs once before all tests of a class."} ⏎ ``` | верно | setUp() — перед КАЖДЫМ тестом; один раз на класс — setUpBeforeClass(). Проверено живым счётчиком на PHPUnit 10.5. |
T18-L3 0.35 c | Testing: PHPUnit | A data provider lets a test run with exactly one set of arguments. | «yes» Пояснение: A single data set within a data provider results in the test being executed exactly once with those specific arguments.
Raw```json ⏎ {"answer": "yes", "explanation": "A single data set within a data provider results in the test being executed exactly once with those specific arguments."} ⏎ ``` | неверно верный: «no» | Наоборот: наборов может быть сколько угодно — тест выполняется по разу на каждый. Проверено на PHPUnit 10.5 (#[DataProvider]). |
T18-L4 0.35 c | Testing: PHPUnit | Which PHPUnit method declares an expectation that an exception of a given class is thrown? | «expectexception» Пояснение: The expectException() method in PHPUnit is used to declare that a specific exception class is expected to be thrown by the test.
Raw{"answer": "expectException", "explanation": "The expectException() method in PHPUnit is used to declare that a specific exception class is expected to be thrown by the test."} | верно | $this->expectException(\LogicException::class); проверено на PHPUnit 10.5. |
T18-L5 0.35 c | Testing: PHPUnit | In PHPUnit, a stub verifies which methods were called on it, while a mock only returns data. | «no» Пояснение: In PHPUnit, mocks are used to verify method calls, while stubs are used to provide fixed return data.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In PHPUnit, mocks are used to verify method calls, while stubs are used to provide fixed return data." ⏎ } ⏎ ``` | верно | Наоборот: стаб подставляет данные, мок проверяет взаимодействия (createStub/createMock); docs PHPUnit — Test Doubles. |
T18-L6 0.31 c | Testing: PHPUnit | In PHPUnit 10+, the recommended way to pass data to a test is the #[DataProvider] attribute (the @dataProvider annotation is deprecated). | «yes» Пояснение: In PHPUnit 10, annotations like @dataProvider were deprecated in favor of PHP attributes like #[DataProvider].
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In PHPUnit 10, annotations like @dataProvider were deprecated in favor of PHP attributes like #[DataProvider]." ⏎ } | верно | Аннотация ещё парсится в PHPUnit 10/11 (AnnotationParser в 10.5.66), удаление — в 12; атрибут — стандарт. |
T18-L7 0.39 c | Testing: PHPUnit | PHPUnit does not allow one test to depend on the result of another. | «no» Пояснение: PHPUnit supports test dependencies using the $depends annotation or attribute, allowing one test to depend on the successful completion of another.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "PHPUnit supports test dependencies using the $depends annotation or attribute, allowing one test to depend on the successful completion of another." ⏎ } | верно | Зависимости есть: #[Depends] — зависимый тест не запустится, еслиProducer упал. |
T18-L8 0.77 c | Testing: PHPUnit | Which PHPUnit command-line option makes tests run in random order? | «--order-by=defects» Пояснение: The --order-by=defects option runs tests in a random order, though typically used to order by previous defects; however, for pure random execution, --random is not a standard PHPUnit CLI option in the same way, but --order-by=random is the correct one.
Raw{"answer": "--order-by=defects", "explanation": "The --order-by=defects option runs tests in a random order, though typically used to order by previous defects; however, for pure random execution, --random is not a standard PHPUnit CLI option in the same way, but --order-by=random is the correct one."} | неверно верный: «--order-by=random» | --order-by=random (PHPUnit 9+); опция есть в --help PHPUnit 10.5 (проектная). |
T01-L9 3.25 c | Syntax and operators | What does this code output?
```php
echo intdiv(7, 2) . intdiv(-7, 2);
``` | «3-4» Пояснение: intdiv(7,2) is 3 and intdiv(-7,2) is -4 because it truncates towards zero, so they are concatenated into the string '3-4'.
Raw{"answer": "3-4", "explanation": "intdiv(7,2) is 3 and intdiv(-7,2) is -4 because it truncates towards zero, so they are concatenated into the string '3-4'."} | неверно верный: «3-3» | intdiv truncates toward zero: intdiv(-7, 2) = -3, not -4. |
T01-L10 0.44 c | Syntax and operators | What does this code output?
```php
echo -3 ** 2;
``` | «-9» Пояснение: The `**` (exponentiation) operator has higher precedence than the unary minus, so it is evaluated as `-(3 ** 2)`, which results in `-9`.
Raw```json ⏎ { ⏎ "answer": -9, ⏎ "explanation": "The `**` (exponentiation) operator has higher precedence than the unary minus, so it is evaluated as `-(3 ** 2)`, which results in `-9`." ⏎ } ⏎ ``` | верно | ** is right-associative and binds tighter than unary minus: -(3²). |
T02-L9 0.48 c | Types and comparisons | What does this code output?
```php
echo '1e1' == '10' ? 'true' : 'false';
``` | «true» Пояснение: In PHP, when comparing a string that looks like a number (or scientific notation) with a numeric string, it performs a numeric comparison; '1e1' equals 10, so '1e1' == '10' is true.
Raw{"answer": "true", "explanation": "In PHP, when comparing a string that looks like a number (or scientific notation) with a numeric string, it performs a numeric comparison; '1e1' equals 10, so '1e1' == '10' is true."} | верно | Both strings are numeric — compared as numbers: 10 == 10. |
T02-L10 0.31 c | Types and comparisons | What does this code output?
```php
switch ('a') {
case 0: echo 'zero'; break;
default: echo 'other';
}
``` | «other» Пояснение: In PHP, 'a' is not equal to 0, so the default case is executed.
Raw```json ⏎ {"answer": "other", "explanation": "In PHP, 'a' is not equal to 0, so the default case is executed."} ⏎ ``` | верно | PHP 8: 'a' == 0 → false (used to be true) — default fires. |
T03-L9 0.34 c | Strings | What does this code output?
```php
echo strtr('abc', ['a' => '1', 'ab' => '2']);
``` | «12c» Пояснение: strtr replaces the longest matches first; 'ab' is replaced by '2' and 'c' remains.
Raw{"answer": "12c", "explanation": "strtr replaces the longest matches first; 'ab' is replaced by '2' and 'c' remains."} | неверно верный: «2c» | strtr with an array prefers the longest matching key. |
T03-L10 0.37 c | Strings | What does this code output?
```php
echo '[' . substr('hello', -10) . ']';
``` | «[hello]» Пояснение: When the start position is negative and greater than the length of the string, substr() returns the entire string 'hello', so the output is '[hello]'.
Raw{"answer": "[hello]", "explanation": "When the start position is negative and greater than the length of the string, substr() returns the entire string 'hello', so the output is '[hello]'."} | верно | A negative start beyond the string is clamped to the beginning. |
T04-L9 0.4 c | Arrays | What does this code output?
```php
$a = ['k' => 1, 'n' => 2];
$b = ['k' => 9, 'm' => 3];
echo implode(',', array_keys($a + $b));
``` | «k,n,m» Пояснение: The array union operator (+) keeps keys from the left array ($a) and adds non-existing keys from the right array ($b), resulting in keys ['k', 'n', 'm'].
Raw{"answer": "k,n,m", "explanation": "The array union operator (+) keeps keys from the left array ($a) and adds non-existing keys from the right array ($b), resulting in keys ['k', 'n', 'm']."} | верно | The + operator: on duplicate string keys the left array wins. |
T04-L10 0.79 c | Arrays | What does this code output?
```php
$a = [[1, 'x', 2], [2, 'y', 1], [3, 'z', 2]];
usort($a, fn($p, $q) => $p[2] <=> $q[2]);
echo implode('', array_column($a, 1));
``` | «yxz» Пояснение: usort sorts $a by the third element (index 2), which groups the elements into [1, 'x', 2], [3, 'z', 2], and [2, 'y', 1] based on their third element values (2, 2, 1). array_column then extracts the second element from each, resulting in the concatenated string 'yxz'.
Raw```json ⏎ {"answer": "yxz", "explanation": "usort sorts $a by the third element (index 2), which groups the elements into [1, 'x', 2], [3, 'z', 2], and [2, 'y', 1] based on their third element values (2, 2, 1). array_column then extracts the second element from each, resulting in the concatenated string 'yxz'."} ⏎ ``` | верно | Sorts are stable since 8.0: x and z keep their order on a tie. |
T05-L10 0.43 c | Functions and closures | What does this code output?
```php
function f(int $a, int $b): int
{
return $a - $b;
}
echo f(...['b' => 1, 'a' => 5]);
``` | «4» Пояснение: PHP allows named arguments with variable arguments; 'a' is 5 and 'b' is 1, so 5 - 1 = 4.
Raw{"answer": 4, "explanation": "PHP allows named arguments with variable arguments; 'a' is 5 and 'b' is 1, so 5 - 1 = 4."} | верно | String keys of a spread array become named arguments. |
T05-L9 0.48 c | Functions and closures | What does this code output?
```php
class P
{
private int $v = 3;
public function g(): int { return $this->v; }
}
$p = new P;
$f = $p->g(...);
$p = null;
echo $f();
``` | «3» Пояснение: The closure captures the object $p by reference, but since $p is set to null before calling $f(), the closure's internal reference to the object is still valid and returns the property value 3.
Raw{"answer": 3, "explanation": "The closure captures the object $p by reference, but since $p is set to null before calling $f(), the closure's internal reference to the object is still valid and returns the property value 3."} | верно | First-class callable syntax binds $this at creation time. |
T06-L9 0.37 c | OOP: classes and inheritance | What does this code output?
```php
class A
{
public function who(): string { return static::class; }
}
class B extends A {}
echo (new B)->who();
``` | «b» Пояснение: static::class returns the late-static-binding class name, which is B when called on an instance of B.
Raw{"answer": "B", "explanation": "static::class returns the late-static-binding class name, which is B when called on an instance of B."} | верно | Late static binding: static::class is the receiver's class. |
T06-L10 0.52 c | OOP: classes and inheritance | What does this code output on PHP 8.5?
```php
class C
{
public int $x = 0 {
set { $this->x = $value * 2; }
}
}
$c = new C;
$c->x = 5;
echo $c->x;
``` | «10» Пояснение: In PHP 8.3+, asymmetric visibility allows defining custom setters for typed properties; the setter multiplies the assigned value by 2 before storing it.
Raw{ ⏎ "answer": "10", ⏎ "explanation": "In PHP 8.3+, asymmetric visibility allows defining custom setters for typed properties; the setter multiplies the assigned value by 2 before storing it." ⏎ } | верно | Inside the set hook, $this->x writes the backing store (no recursion): 5*2. |
T07-L9 0.46 c | Interfaces, traits, enum | What does this code output?
```php
trait TA
{
public function f(): string { return 'A'; }
}
trait TB
{
public function f(): string { return 'B'; }
}
class TC
{
use TA, TB { TB::f insteadof TA; TA::f as g; }
}
echo (new TC)->f() . (new TC)->g();
``` | «ba» Пояснение: The 'insteadof' operator makes TB::f override TA::f, so f() returns 'B'. The 'as' operator aliases TA::f as g, so g() returns 'A'.
Raw{"answer": "BA", "explanation": "The 'insteadof' operator makes TB::f override TA::f, so f() returns 'B'. The 'as' operator aliases TA::f as g, so g() returns 'A'."} | верно | insteadof picks the implementation; as keeps the other under an alias. |
T07-L10 0.5 c | Interfaces, traits, enum | What does this code output?
```php
trait Counter
{
public static int $n = 0;
}
class CX { use Counter; }
class CY { use Counter; }
CX::$n = 1;
echo CY::$n;
``` | «1» Пояснение: Traits with static properties do not create separate copies per class; CX and CY share the same static property $n because they both use the same trait, so setting CX::$n to 1 affects CY::$n.
Raw{"answer": "1", "explanation": "Traits with static properties do not create separate copies per class; CX and CY share the same static property $n because they both use the same trait, so setting CX::$n to 1 affects CY::$n."} | неверно верный: «0» | A trait's static property is copied into each consuming class. |
T08-L10 0.36 c | Exceptions and errors | What does this code output?
```php
function f(): int
{
try { return 1; } finally { return 2; }
}
echo f();
``` | «2» Пояснение: In PHP, a `return` statement inside a `finally` block overrides any return value from the `try` block.
Raw{"answer": 2, "explanation": "In PHP, a `return` statement inside a `finally` block overrides any return value from the `try` block."} | верно | A return in finally overrides the return from try. |
T08-L9 0.46 c | Exceptions and errors | What does this code output?
```php
try {
try {
throw new RuntimeException('first');
} finally {
throw new LogicException('second');
}
} catch (LogicException $e) {
echo $e->getMessage();
}
``` | «second» Пояснение: The finally block executes before the try block's completion; if it throws an exception, that exception replaces the one from the try block, so the LogicException is caught and 'second' is printed.
Raw{"answer": "second", "explanation": "The finally block executes before the try block's completion; if it throws an exception, that exception replaces the one from the try block, so the LogicException is caught and 'second' is printed."} | верно | An exception from finally replaces the in-flight one — the last thrown is caught. |
T09-L9 0.43 c | Namespaces and autoloading | What does this code output?
```php
namespace N;
use App\Foo as Baz;
echo Baz::class . '|' . \Baz::class;
``` | «app\foo|baz» Пояснение: Baz::class resolves to the fully qualified name 'App\Foo' due to the use statement, while \Baz::class resolves to the global namespace name 'Baz'.
Raw{"answer": "App\\Foo|Baz", "explanation": "Baz::class resolves to the fully qualified name 'App\\Foo' due to the use statement, while \\Baz::class resolves to the global namespace name 'Baz'."} | верно | The use alias applies to unqualified names; a leading \ escapes to the global scope. |
T09-L10 0.42 c | Namespaces and autoloading | What does this code output?
```php
namespace Ns;
class Foo {}
$c = 'Foo';
echo (class_exists($c) ? 'yes' : 'no')
. (class_exists(__NAMESPACE__ . '\\' . $c) ? 'yes' : 'no');
``` | «noyes» Пояснение: The class 'Foo' is in the 'Ns' namespace, so class_exists('Foo') is false, but class_exists('Ns\Foo') is true.
Raw```json ⏎ { ⏎ "answer": "noyes", ⏎ "explanation": "The class 'Foo' is in the 'Ns' namespace, so class_exists('Foo') is false, but class_exists('Ns\\Foo') is true." ⏎ } ⏎ ``` | верно | Dynamic names are not resolved against the namespace — 'Foo' is the global class. |
T10-L9 0.44 c | References and scope | What does this code output?
```php
$a = [1, 2, 3];
foreach ($a as &$v) {}
$v = 99;
echo implode(',', $a);
``` | «1,2,99» Пояснение: Iterating by reference leaves $v bound to the last element of the array, so assigning 99 to $v changes the last element of $a.
Raw{"answer": "1,2,99", "explanation": "Iterating by reference leaves $v bound to the last element of the array, so assigning 99 to $v changes the last element of $a."} | верно | After a by-ref foreach, $v remains a reference to the last element. |
T10-L10 0.59 c | References and scope | What does this code output?
```php
class A
{
public function inc(): int
{
static $n = 0;
return ++$n;
}
}
class B extends A {}
$a = new A;
$b = new B;
$a->inc();
$b->inc();
echo $a->inc();
``` | «2» Пояснение: Static variables in non-static methods are shared per class definition, so $n is incremented across all instances: 1 after $a->inc(), 2 after $b->inc(), and 3 after the final $a->inc().
Raw{"answer": "2", "explanation": "Static variables in non-static methods are shared per class definition, so $n is incremented across all instances: 1 after $a->inc(), 2 after $b->inc(), and 3 after the final $a->inc()."} | неверно верный: «3» | A method's static variable belongs to the parent's method — subclasses share it. |
T11-L9 0.44 c | Generators, iterators, SPL | What does this code output?
```php
function g(): Generator
{
$x = yield 1;
return $x + 1;
}
$g = g();
$g->send(10);
echo $g->getReturn();
``` | «11» Пояснение: send(10) assigns 10 to $x, the generator returns 10+1=11, and getReturn() outputs 11.
Raw{"answer": 11, "explanation": "send(10) assigns 10 to $x, the generator returns 10+1=11, and getReturn() outputs 11."} | верно | send() resumes the generator: $x = 10, return 10+1. |
T11-L10 0.42 c | Generators, iterators, SPL | What does this code output?
```php
function inner(): Generator
{
yield 1;
yield 2;
return 'ok';
}
function outer(): Generator
{
$r = yield from inner();
yield $r;
}
echo implode(',', iterator_to_array(outer()));
``` | «1,2,ok» Пояснение: yield from flattens the inner generator, yielding 1 and 2, and the return value of the inner generator is assigned to $r and then yielded by outer.
Raw{"answer": "1,2,ok", "explanation": "yield from flattens the inner generator, yielding 1 and 2, and the return value of the inner generator is assigned to $r and then yielded by outer."} | неверно верный: «ok,2» | yield from does not advance the outer auto-key: yield $r gets key 0 and overwrites the 1 — 'ok' comes out first. |
T12-L9 0.42 c | Configuration and security | What does this code output?
```php
$hash = password_hash('x', PASSWORD_BCRYPT, ['cost' => 4]);
echo password_needs_rehash($hash, PASSWORD_BCRYPT, ['cost' => 4]) ? 'yes' : 'no';
echo password_needs_rehash($hash, PASSWORD_BCRYPT, ['cost' => 5]) ? 'yes' : 'no';
``` | «nono» Пояснение: The first call compares cost 4 with the hash cost 4, returning false. The second call compares cost 5 with the hash cost 4, returning true.
Raw{"answer": "nono", "explanation": "The first call compares cost 4 with the hash cost 4, returning false. The second call compares cost 5 with the hash cost 4, returning true."} | неверно верный: «noyes» | password_needs_rehash compares the hash's options with the target: cost 4 = 4 → 'no', cost 5 ≠ 4 → 'yes'. |
T12-L10 0.62 c | Configuration and security | What does this code output on PHP 8.5?
```php
echo (E_ALL & 2048) === 0 ? 'strict-out' : 'strict-in';
``` | «strict-in» Пояснение: In PHP 8.4+, the default error_reporting() level includes E_ALL (which contains E_STRICT, value 2048), so the bitwise AND result is not zero.
Raw{ ⏎ "answer": "strict-in", ⏎ "explanation": "In PHP 8.4+, the default error_reporting() level includes E_ALL (which contains E_STRICT, value 2048), so the bitwise AND result is not zero." ⏎ } | неверно верный: «strict-out» | Since PHP 8.4, E_STRICT is out of E_ALL: the 2048 bit is unset → 'strict-out' (2048 is the historical E_STRICT bit). |
T13-L9 0.61 c | Symfony | What does this code output?
```php
use Symfony\Component\HttpFoundation\Request;
$r = Request::create('/demo', 'GET', [], [], [], ['HTTP_X_TOKEN' => 'abc']);
echo $r->headers->get('X-Token') === 'abc' ? 'mapped' : 'missing';
``` | «mapped» Пояснение: Symfony's Request class maps HTTP headers starting with HTTP_ to standard header names by stripping the prefix and converting underscores to dashes (e.g., HTTP_X_TOKEN becomes X-Token), so the header is found and the comparison returns true.
Raw{"answer": "mapped", "explanation": "Symfony's Request class maps HTTP headers starting with HTTP_ to standard header names by stripping the prefix and converting underscores to dashes (e.g., HTTP_X_TOKEN becomes X-Token), so the header is found and the comparison returns true."} | верно | The literal comparison requires knowing the mapping: HttpFoundation turns HTTP_X_TOKEN into the X-Token header (case-insensitive); without it the answer is 'missing'. |
T13-L10 0.42 c | Symfony | What does this code output?
```php
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\Event;
$d = new EventDispatcher();
$out = '';
$d->addListener('e', function () use (&$out) { $out .= 'B'; }, 10);
$d->addListener('e', function () use (&$out) { $out .= 'A'; });
$d->addListener('e', function () use (&$out) { $out .= 'C'; }, 5);
$d->dispatch(new Event(), 'e');
echo $out;
``` | «bac» Пояснение: Symfony's EventDispatcher calls listeners in descending order of priority; higher priority (10) runs first, then default (0), then lower (5).
Raw{"answer": "BAC", "explanation": "Symfony's EventDispatcher calls listeners in descending order of priority; higher priority (10) runs first, then default (0), then lower (5)."} | неверно верный: «bca» | Listeners run by descending priority: 10 (B), 5 (C), 0 (A). |
T14-L10 0.55 c | Doctrine | Given: Doctrine ORM 3, an EntityManager on in-memory SQLite, entity User with an auto-increment primary key. The users table is empty. What does this code output?
```php
$u = new User(name: 'A');
$em->persist($u);
$em->flush();
$a = $em->find(User::class, $u->getId());
$b = $em->find(User::class, $u->getId());
echo spl_object_id($a) === spl_object_id($b) ? 'same' : 'diff';
``` | «same» Пояснение: Doctrine's EntityManager maintains an identity map for a unit of work; calling find() with an existing ID returns the same PHP object instance from the map rather than hydrating a new one.
Raw{"answer": "same", "explanation": "Doctrine's EntityManager maintains an identity map for a unit of work; calling find() with an existing ID returns the same PHP object instance from the map rather than hydrating a new one."} | верно | Identity map: a second find for the same id returns the same instance. |
T14-L9 0.46 c | Doctrine | Given: Doctrine ORM 3, an EntityManager on in-memory SQLite, entity User with an auto-increment primary key. The users table is empty. What does this code output?
```php
$u = new User(name: 'B');
$em->persist($u);
$em->remove($u);
$em->flush();
echo count($em->getConnection()->fetchAllAssociative('SELECT * FROM users'));
``` | «0» Пояснение: The entity is persisted and then removed before the flush; Doctrine will not insert it because it was marked for removal, resulting in an empty table.
Raw{"answer": 0, "explanation": "The entity is persisted and then removed before the flush; Doctrine will not insert it because it was marked for removal, resulting in an empty table."} | верно | The unit of work schedules INSERT at flush: remove after persist cancels it. |
T15-L10 0.31 c | PostgreSQL | What does this SQL query return (PostgreSQL 17)?
```sql
CREATE TEMP TABLE t (x int);
INSERT INTO t VALUES (1), (NULL);
SELECT count(x) FROM t;
``` | «1» Пояснение: count(x) counts non-NULL values in column x, so it returns 1.
Raw{"answer": 1, "explanation": "count(x) counts non-NULL values in column x, so it returns 1."} | верно | count(column) skips NULLs; count(*) would return 2. |
T15-L9 0.54 c | PostgreSQL | What does this SQL query return (PostgreSQL 17)?
```sql
CREATE TEMP TABLE t (id int, x int);
INSERT INTO t VALUES (1, 10), (2, 20), (3, 30);
SELECT string_agg(s::text, ',' ORDER BY id) FROM (
SELECT id, sum(x) OVER (ORDER BY id) AS s FROM t
) q;
``` | «10,30,60» Пояснение: The window function sum(x) OVER (ORDER BY id) calculates the running sum of x ordered by id (10, 30, 60), and string_agg concatenates these values into a single comma-separated string.
Raw```json ⏎ { ⏎ "answer": "10,30,60", ⏎ "explanation": "The window function sum(x) OVER (ORDER BY id) calculates the running sum of x ordered by id (10, 30, 60), and string_agg concatenates these values into a single comma-separated string." ⏎ } ⏎ ``` | верно | With ORDER BY the default window frame is running (start to current row). |
T16-L9 0.43 c | Symfony: Messenger | What does this code output?
```php
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
use Symfony\Component\Messenger\Envelope;
final class Trace implements MiddlewareInterface
{
public function __construct(private string $tag) {}
public function handle(Envelope $e, StackInterface $stack): Envelope
{
echo $this->tag;
return $stack->next()->handle($e, $stack);
}
}
$bus = new MessageBus([new Trace('M1'), new Trace('M2')]);
$bus->dispatch(new Envelope(new stdClass()));
``` | «m1m2» Пояснение: The MessageBus middleware executes in the order they are added (first in, first out), so 'M1' is printed before 'M2'.
Raw{"answer": "M1M2", "explanation": "The MessageBus middleware executes in the order they are added (first in, first out), so 'M1' is printed before 'M2'."} | верно | The first-added middleware runs first (outermost). |
T16-L10 0.47 c | Symfony: Messenger | What does this code output?
```php
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
use Symfony\Component\Messenger\Handler\HandlersLocator;
use Symfony\Component\Messenger\Handler\HandlerDescriptor;
use Symfony\Component\Messenger\Envelope;
class Ping {}
$n = 0;
$d1 = new HandlerDescriptor(function (Ping $m) use (&$n) { $n += 1; }, ['alias' => 'h1']);
$d2 = new HandlerDescriptor(function (Ping $m) use (&$n) { $n += 10; }, ['alias' => 'h2']);
$bus = new MessageBus([
new HandleMessageMiddleware(new HandlersLocator([Ping::class => [$d1, $d2]])),
]);
$bus->dispatch(new Envelope(new Ping()));
echo $n;
``` | «11» Пояснение: The HandlersLocator returns both handlers for the Ping message, and HandleMessageMiddleware executes all of them, incrementing $n by 1 then by 10.
Raw{"answer": 11, "explanation": "The HandlersLocator returns both handlers for the Ping message, and HandleMessageMiddleware executes all of them, incrementing $n by 1 then by 10."} | верно | All registered handlers of the message run: 1 + 10 = 11. |
T17-L9 0.35 c | PostgreSQL: transactions and indexes | What does this SQL query return (PostgreSQL 17)?
```sql
CREATE TEMP TABLE t (a int);
CREATE UNIQUE INDEX ON t (a);
INSERT INTO t VALUES (1) ON CONFLICT DO NOTHING;
INSERT INTO t VALUES (1) ON CONFLICT DO NOTHING;
SELECT count(*) FROM t;
``` | «1» Пояснение: The first insert succeeds, the second is skipped due to the unique index and ON CONFLICT DO NOTHING, leaving one row.
Raw{"answer": 1, "explanation": "The first insert succeeds, the second is skipped due to the unique index and ON CONFLICT DO NOTHING, leaving one row."} | верно | ON CONFLICT DO NOTHING skips the duplicate: one insert. |
T17-L10 0.89 c | PostgreSQL: transactions and indexes | What does this sequence of psql commands output?
```sql
BEGIN;
CREATE TEMP TABLE t (a int, UNIQUE (a) DEFERRABLE INITIALLY DEFERRED);
INSERT INTO t VALUES (1);
INSERT INTO t VALUES (1);
SELECT count(*) FROM t;
``` | «1» Пояснение: The deferred unique constraint is only checked at the end of the transaction, so both inserts succeed within the transaction, resulting in a count of 2? No, wait. Deferred constraints are checked at COMMIT. Since the transaction is not committed, both rows exist. Therefore count is 2. Let me re-verify. Yes, DEFERRABLE INITIALLY DEFERRED means the constraint is not enforced until commit. So both inserts succeed. Count is 2.
Raw{"answer": 1, "explanation": "The deferred unique constraint is only checked at the end of the transaction, so both inserts succeed within the transaction, resulting in a count of 2? No, wait. Deferred constraints are checked at COMMIT. Since the transaction is not committed, both rows exist. Therefore count is 2. Let me re-verify. Yes, DEFERRABLE INITIALLY DEFERRED means the constraint is not enforced until commit. So both inserts succeed. Count is 2."} | неверно верный: «2» | DEFERRED postpones the uniqueness check to COMMIT — count sees 2 rows. |
T18-L9 0.82 c | Testing: PHPUnit | How many tests will this command run?
```php
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
final class CalcTest extends TestCase
{
public static function prov(): array
{
return [[1], [2], [3]];
}
#[DataProvider('prov')]
public function test_sum(int $x): void
{
$this->assertTrue($x > 0);
}
#[DataProvider('prov')]
public function test_sum_abs(int $x): void
{
$this->assertTrue($x > 0);
}
public function test_other(): void
{
$this->assertTrue(true);
}
}
```
Command: `phpunit CalcTest.php --filter test_sum` (PHPUnit 10.5) | «6» Пояснение: The `--filter` option matches the test method name `test_sum` in both `test_sum` and `test_sum_abs` (as a substring). Since `prov()` provides 3 data sets, and it is applied to both methods, there are 3 + 3 = 6 test cases in total. `test_other` is excluded.
Raw```json ⏎ {"answer": 6, "explanation": "The `--filter` option matches the test method name `test_sum` in both `test_sum` and `test_sum_abs` (as a substring). Since `prov()` provides 3 data sets, and it is applied to both methods, there are 3 + 3 = 6 test cases in total. `test_other` is excluded."} ⏎ ``` | верно | --filter is a substring match: test_sum also matches test_sum_abs (3+3 datasets). |
T18-L10 0.48 c | Testing: PHPUnit | How many tests will this command run, and how many of them will fail? Answer with two comma-separated numbers (ran, failed).
```php
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
final class Calc2Test extends TestCase
{
public function prov(): array
{
return [[1], [-1]];
}
#[DataProvider('prov')]
public function test_x(int $x): void
{
$this->assertTrue($x > 0);
}
}
```
Command: `phpunit Calc2Test.php` (PHPUnit 10.5) | «2, 1» Пояснение: The data provider yields two cases ([1] and [-1]), so 2 tests run; the assertion fails for -1, resulting in 1 failure.
Raw{"answer": "2, 1", "explanation": "The data provider yields two cases ([1] and [-1]), so 2 tests run; the assertion fails for -1, resulting in 1 failure."} | верно | A non-static provider is just a deprecation in PHPUnit 10: both datasets run and the [-1] dataset fails the assert — 2 ran, 1 failure. |
T19-L9 0.35 c | HTTP and REST API | Which HTTP method does this command send?
```bash
curl -s -d 'a=1' http://demo.local/api
``` | «post» Пояснение: The -d flag in curl sends data to the server, which implicitly sets the HTTP method to POST.
Raw{"answer": "POST", "explanation": "The -d flag in curl sends data to the server, which implicitly sets the HTTP method to POST."} | верно | -d/-F switches curl to POST by default. |
T19-L10 0.32 c | HTTP and REST API | Which HTTP method does this command send?
```bash
curl -s -G -d 'a=1' http://demo.local/api
``` | «get» Пояснение: The -G flag in curl instructs it to use the GET method, placing the data from -d into the query string.
Raw{"answer": "GET", "explanation": "The -G flag in curl instructs it to use the GET method, placing the data from -d into the query string."} | верно | -G turns -d data into the query string; the method stays GET. |
T20-L9 0.47 c | Security and OAuth | A client hits the token endpoint (RFC 6749) with a non-existent client_id. What value of the error field does the endpoint return? | «invalid_client» Пояснение: According to RFC 6749 Section 5.2, if the client authentication fails (e.g., non-existent client_id), the token endpoint MUST return the error code 'invalid_client'.
Raw{"answer": "invalid_client", "explanation": "According to RFC 6749 Section 5.2, if the client authentication fails (e.g., non-existent client_id), the token endpoint MUST return the error code 'invalid_client'."} | верно | Unknown client → invalid_client (RFC 6749 §5.2). |
T20-L10 0.43 c | Security and OAuth | OAuth 2.0: the client started the flow with response_type=token. In which part of the redirect_uri does the authorization server pass the access_token? | «fragment» Пояснение: In the implicit grant flow (response_type=token), the access token is returned in the URI fragment of the redirect_uri to avoid logging it in the referrer header or server logs.
Raw{"answer": "fragment", "explanation": "In the implicit grant flow (response_type=token), the access token is returned in the URI fragment of the redirect_uri to avoid logging it in the referrer header or server logs."} | верно | The implicit flow passes the token in the URL fragment (#) — it never reaches the server. |
T21-L9 2.89 c | Twig | What does this Twig template output?
```twig
{{ false|default(2) * 3 }}
``` | «6» Пояснение: The 'default' filter in Twig only applies the default value if the value is null; since 'false' is not null, the expression evaluates to 'false * 3', which is 0 in PHP, but wait, the question asks what it outputs. Let's re-evaluate. Actually, in Twig, `false` is a boolean. `false * 3` results in `0` in PHP/Twig arithmetic. However, there is a nuance: `default` checks `is_null`. `false` is not null. So it is `false`. Then `false * 3` is `0`. Let me double-check Twig's behavior. `false * 3` returns `0`. Wait, does Twig's `default` filter also treat `false` as empty? No, `default` checks `is_null` unless `ignore_empty` is set (which it isn't by default, and it defaults to true? No, `default` has `ignore_empty` defaulting to true in newer versions? Actually, the signature is `default(default, ignore_empty)`. By default, `ignore_empty` is `false`? No, checking docs: `default(value, ignore_empty = false)`. If `ignore_empty` is false, it only checks `is_null`. So `false` is kept. `false * 3` is `0`. Let me verify if Twig treats `false` as empty in arithmetic. `false` casts to 0. So `0 * 3` is 0. Wait, looking at similar tests, often `false|default(2)` returns `false` (which is 0). `0 * 3` is 0. Let me re-read carefully. Is there a trick? `false` is not null. So it uses `false`. `false * 3` is `0`.
Raw{"answer": 6, "explanation": "The 'default' filter in Twig only applies the default value if the value is null; since 'false' is not null, the expression evaluates to 'false * 3', which is 0 in PHP, but wait, the question asks what it outputs. Let's re-evaluate. Actually, in Twig, `false` is a boolean. `false * 3` results in `0` in PHP/Twig arithmetic. However, there is a nuance: `default` checks `is_null`. `false` is not null. So it is `false`. Then `false * 3` is `0`. Let me double-check Twig's behavior. `false * 3` returns `0`. Wait, does Twig's `default` filter also treat `false` as empty? No, `default` checks `is_null` unless `ignore_empty` is set (which it isn't by default, and it defaults to true? No, `default` has `ignore_empty` defaulting to true in newer versions? Actually, the signature is `default(default, ignore_empty)`. By default, `ignore_empty` is `false`? No, checking docs: `default(value, ignore_empty = false)`. If `ignore_empty` is false, it only checks `is_null`. So `false` is kept. `false * 3` is `0`. Let me verify if Twig treats `false` as empty in arithmetic. `false` casts to 0. So `0 * 3` is 0. Wait, looking at similar tests, often `false|default(2)` returns `false` (which is 0). `0 * 3` is 0. Let me re-read carefully. Is there a trick? `false` is not null. So it uses `false`. `false * 3` is `0`."} | верно | default replaces exactly false/null/''/[] — false becomes 2, 2*3 = 6; the naive 'default is for undefined only' yields 0. |
T21-L10 0.55 c | Twig | What exception class does render() of this template throw?
```twig
{{ 'a' ~ 1 + 2 }}
``` | «twig\error\runtimeerror» Пояснение: The expression 'a' ~ 1 concatenates to string 'a1', then adds 2, which causes a type error at runtime.
Raw{"answer": "Twig\\Error\\RuntimeError", "explanation": "The expression 'a' ~ 1 concatenates to string 'a1', then adds 2, which causes a type error at runtime."} | верно | In Twig ~ binds tighter than +: ('a' ~ 1) + 2 → string + int → a render error (RuntimeError). |
T22-L9 0.37 c | Symfony: Security and forms | What does this code output?
```php
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Constraints as Assert;
$v = Validation::createValidator();
echo count($v->validate([''], [new Assert\NotBlank()]));
``` | «1» Пояснение: The array [''] contains an empty string, which fails the NotBlank constraint, resulting in exactly one validation violation.
Raw{"answer": "1", "explanation": "The array [''] contains an empty string, which fails the NotBlank constraint, resulting in exactly one validation violation."} | неверно верный: «0» | NotBlank treats null, '', [] as blank — the array [''] is not blank. |
T22-L10 0.4 c | Symfony: Security and forms | What does this code output?
```php
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Extension\Core\Type\TextType;
$factory = Forms::createFormFactoryBuilder()->getFormFactory();
$form = $factory->create(TextType::class);
try {
echo $form->isValid() ? 'valid' : 'invalid';
} catch (Throwable $e) {
echo get_class($e);
}
``` | «symfony\component\form\exception\logicexception» Пояснение: Calling isValid() on a form that has not been submitted triggers a LogicException in Symfony Form components.
Raw{"answer": "Symfony\\Component\\Form\\Exception\\LogicException", "explanation": "Calling isValid() on a form that has not been submitted triggers a LogicException in Symfony Form components."} | верно | isValid() on a non-submitted form throws LogicException, it does not return false. |
T23-L9 0.34 c | Symfony: configuration and services | What does this code output?
```php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$c = new ContainerBuilder();
$c->register('a', stdClass::class)->setPublic(true);
$c->compile();
echo spl_object_id($c->get('a')) === spl_object_id($c->get('a')) ? 'same' : 'diff';
``` | «same» Пояснение: Symfony's ContainerBuilder caches compiled public services, so calling get('a') multiple times returns the same object instance.
Raw{"answer": "same", "explanation": "Symfony's ContainerBuilder caches compiled public services, so calling get('a') multiple times returns the same object instance."} | верно | Container services are shared: two get() calls yield one instance. |
T23-L10 0.66 c | Symfony: configuration and services | What does this code output?
```php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$c = new ContainerBuilder();
$c->setParameter('name', 'Bob');
$c->setParameter('greeting', 'hi %name%');
$c->setParameter('message', '%greeting%!');
$c->compile();
echo $c->getParameter('message');
``` | «hi bob!» Пояснение: The code defines parameters and compiles the container, but it's missing an echo statement, so it outputs nothing visible, but if we assume the intended output is the resolved 'message' parameter, it would be 'hi Bob!'.
Raw```json ⏎ {"answer": "hi Bob!", "explanation": "The code defines parameters and compiles the container, but it's missing an echo statement, so it outputs nothing visible, but if we assume the intended output is the resolved 'message' parameter, it would be 'hi Bob!'."} ⏎ ``` | верно | compile() resolves %-references transitively: %greeting% → 'hi %name%' → 'hi Bob!', the answer assembles over two hops. |
T24-L9 0.37 c | Bootstrap | What is the max-width of .container in Bootstrap 5.3 at a 992px viewport? | «960» Пояснение: At a 992px viewport (md breakpoint), Bootstrap 5.3 sets the .container max-width to 960px.
Raw{"answer": 960, "explanation": "At a 992px viewport (md breakpoint), Bootstrap 5.3 sets the .container max-width to 960px."} | верно | 5.x container widths: 540/720/960/1140/1320 (sm–xxl); 992 → 960px. |
T24-L10 1.13 c | Bootstrap | Which utility sets the text color in Bootstrap 5.3 for `<p class="text-danger text-primary">…</p>`? Answer with the winning class name. | «text-primary» Пояснение: In CSS, when multiple classes of the same specificity are applied to an element, the last one defined in the stylesheet or the one with higher specificity wins; however, in the context of standard utility class conflicts in Bootstrap, the order in the HTML attributes does not determine the winner, but rather the order in the CSS file. 'text-primary' is defined after 'text-danger' in the Bootstrap CSS, so 'text-primary' overrides 'text-danger'. If the question implies which one visually wins due to standard CSS cascade rules where later definitions override earlier ones, 'text-primary' is the answer.
Raw{"answer": "text-primary", "explanation": "In CSS, when multiple classes of the same specificity are applied to an element, the last one defined in the stylesheet or the one with higher specificity wins; however, in the context of standard utility class conflicts in Bootstrap, the order in the HTML attributes does not determine the winner, but rather the order in the CSS file. 'text-primary' is defined after 'text-danger' in the Bootstrap CSS, so 'text-primary' overrides 'text-danger'. If the question implies which one visually wins due to standard CSS cascade rules where later definitions override earlier ones, 'text-primary' is the answer."} | неверно верный: «text-danger» | Specificity ties — the later rule wins: text-danger is declared after text-primary. |
T25-L9 0.54 c | Clean architecture | Layers: Domain, Application, Infrastructure. Deptrac rules: Application → Domain; Infrastructure → Domain, Application; Domain → Domain only.
How many violations will deptrac report for this class?
```php
namespace App\Domain;
use App\Application\PlaceOrder;
use App\Infrastructure\Db;
class OrderService
{
public function __construct(
private PlaceOrder $handler,
private Db $db,
) {}
}
``` | «2» Пояснение: The Domain layer is restricted to using only the Domain layer, but this class in App\Domain uses App\Application\PlaceOrder and App\Infrastructure\Db, resulting in two dependency violations.
Raw{"answer": "2", "explanation": "The Domain layer is restricted to using only the Domain layer, but this class in App\\Domain uses App\\Application\\PlaceOrder and App\\Infrastructure\\Db, resulting in two dependency violations."} | верно | Domain may depend only on Domain: PlaceOrder (Application) + Db (Infrastructure) = 2. |
T25-L10 0.44 c | Clean architecture | Layers: Domain, Application, Infrastructure. Deptrac rules: Application → Domain; Infrastructure → Domain, Application; Domain → Domain only.
How many violations will deptrac report for this class?
```php
namespace App\Domain;
use App\Application\PlaceOrder;
use App\Infrastructure\Db;
class BillingService
{
public function __construct(
private PlaceOrder $handler,
private Db $db,
private \App\Infrastructure\Logger $logger,
) {}
}
``` | «3» Пояснение: The Domain layer class references three external components (PlaceOrder, Db, Logger) from the Application and Infrastructure layers, violating the rule that Domain can only depend on itself.
Raw```json ⏎ {"answer": "3", "explanation": "The Domain layer class references three external components (PlaceOrder, Db, Logger) from the Application and Infrastructure layers, violating the rule that Domain can only depend on itself."} ⏎ ``` | верно | The inline FQCN \App\Infrastructure\Logger counts too: Application + Db + Logger = 3. |
T26-L10 0.56 c | DDD | What does this code output?
```php
final class Money
{
public function __construct(public readonly int $amount) {}
public function add(Money $o): Money
{
return new self($this->amount + $o->amount);
}
}
$a = new Money(10);
$c = $a->add(new Money(5));
echo $a->amount . ',' . $c->amount;
``` | «10,15» Пояснение: The code creates two Money objects; $a remains 10 and $c is a new object with amount 15, so echoing their amounts separated by a comma results in '10,15'.
Raw{"answer": "10,15", "explanation": "The code creates two Money objects; $a remains 10 and $c is a new object with amount 15, so echoing their amounts separated by a comma results in '10,15'."} | верно | The VO is immutable: add() returns a new instance; the original is unchanged. |
T26-L9 0.44 c | DDD | What does this code output?
```php
final class Order
{
private array $items = [];
public function add(string $sku): void
{
$this->items[$sku] = true;
}
public function count(): int
{
return count($this->items);
}
public function remove(string $sku): void
{
if (count($this->items) === 1) {
throw new DomainException('last item');
}
unset($this->items[$sku]);
}
}
$o = new Order;
$o->add('a');
try {
$o->remove('a');
} catch (DomainException) {
}
echo $o->count();
``` | «1» Пояснение: The remove() method throws a DomainException when trying to remove the last item, so the item 'a' is not removed, and count() returns 1.
Raw{"answer": 1, "explanation": "The remove() method throws a DomainException when trying to remove the last item, so the item 'a' is not removed, and count() returns 1."} | верно | The failed remove leaves aggregate state unchanged: the invariant threw before unset — count stays 1. |
VC-L9 0.37 c | PHP 8.4–8.5 | What does this code output on PHP 8.5?
```php
class C
{
public function hi(): string { return 'hi'; }
}
echo new C()->hi();
``` | «hi» Пояснение: The method hi() returns the string 'hi' which is directly echoed to the output.
Raw```json ⏎ {"answer": "hi", "explanation": "The method hi() returns the string 'hi' which is directly echoed to the output."} ⏎ ``` | верно | Since 8.4, new in a method chain works without wrapping parentheses. |
VC-L10 0.46 c | PHP 8.4–8.5 | What does this code output on PHP 8.5?
```php
class Heavy
{
public int $v = 0;
}
$r = new ReflectionClass(Heavy::class);
$o = $r->newLazyGhost(function (Heavy $obj) {
$obj->v = 21;
});
echo $r->isUninitializedLazyObject($o) ? 'yes' : 'no';
$o->v;
echo $r->isUninitializedLazyObject($o) ? 'yes' : 'no';
``` | «yesyes» Пояснение: newLazyGhost returns an object that is initially uninitialized, and accessing $o->v initializes it, changing the result of isUninitializedLazyObject to no.
Raw```json ⏎ {"answer": "yesyes", "explanation": "newLazyGhost returns an object that is initially uninitialized, and accessing $o->v initializes it, changing the result of isUninitializedLazyObject to no."} ⏎ ``` | неверно верный: «yesno» | newLazyGhost (8.4): the object stays lazy until first access — reading a property initializes it and clears the flag. |
T28-L9 0.42 c | Symfony: versions | The project was upgraded from Symfony 6.4 to 8.1. What does this code output on 8.1?
```php
echo class_exists(\Symfony\Component\Security\Guard\AbstractGuardAuthenticator::class)
? 'yes' : 'no';
``` | «no» Пояснение: The Guard component was deprecated in Symfony 5.3 and completely removed in Symfony 7.0, so AbstractGuardAuthenticator does not exist in Symfony 8.1.
Raw```json ⏎ {"answer": "no", "explanation": "The Guard component was deprecated in Symfony 5.3 and completely removed in Symfony 7.0, so AbstractGuardAuthenticator does not exist in Symfony 8.1."} ⏎ ``` | верно | Guard authentication was removed in Symfony 7.0 — the class is gone in 8.1. |
T28-L10 0.53 c | Symfony: versions | The project was upgraded from Symfony 6.4 to 8.1. What does this code output on 8.1?
```php
echo class_exists(\Symfony\Component\Routing\Loader\AnnotationClassLoader::class)
? 'yes' : 'no';
echo class_exists(\Symfony\Component\Routing\Loader\AttributeClassLoader::class)
? 'yes' : 'no';
``` | «nono» Пояснение: In Symfony 8.0, `AnnotationClassLoader` was removed (deprecated in 6.4/7.x) in favor of `AttributeClassLoader`, so `class_exists` returns false for the annotation loader and true for the attribute loader.
Raw{"answer": "nono", "explanation": "In Symfony 8.0, `AnnotationClassLoader` was removed (deprecated in 6.4/7.x) in favor of `AttributeClassLoader`, so `class_exists` returns false for the annotation loader and true for the attribute loader."} | неверно верный: «noyes» | Annotation loaders were removed in 7.0; only attribute loaders remain (Annotation→Attribute). |