Пример запроса (первая клетка). System одинаковый во всех запросах прогона, user — свой вопрос для каждой клетки:
| Клетка | Тема | Утверждение | Ответ |
Результат | Обоснование |
T01-L1 3.25 c | Syntax and operators | Double-quoted and single-quoted strings are processed identically; the difference is only in speed. | «no» Пояснение: Single-quoted strings are literal and faster, while double-quoted strings allow variable interpolation and escape sequences, meaning they are not processed identically.
Raw{"answer": "no", "explanation": "Single-quoted strings are literal and faster, while double-quoted strings allow variable interpolation and escape sequences, meaning they are not processed identically."} | верно | В двойных кавычках работают интерполяция переменных и escape-последовательности, в одинарных — нет. |
T01-L2 0.35 c | Syntax and operators | The ?? operator follows isset semantics and raises no warnings for undefined variables. | «yes» Пояснение: The null coalescing operator (??) checks if a variable is set and not null, suppressing warnings for undefined variables just like isset.
Raw{"answer": "yes", "explanation": "The null coalescing operator (??) checks if a variable is set and not null, suppressing warnings for undefined variables just like isset."} | верно | ?? работает по семантике isset — несуществующие переменные и ключи допустимы. |
T01-L3 0.37 c | Syntax and operators | What will this print: echo 'a', 'b'; | «ab» Пояснение: In PHP, using a comma to separate expressions in an echo statement concatenates their outputs without adding spaces, resulting in 'ab'.
Raw{"answer": "ab", "explanation": "In PHP, using a comma to separate expressions in an echo statement concatenates their outputs without adding spaces, resulting in 'ab'."} | верно | echo принимает список аргументов: ab. |
T01-L4 1.79 c | Syntax and operators | print returns the value 1 and can be used inside an expression. | «no» Пояснение: In PHP, the print statement returns the integer 1, but it is a language construct, not a function, and while it can be used inside an expression (e.g., $x = print 'hi';), the primary statement about it 'returning a value' that distinguishes it from echo is often considered false in the context of general PHP semantics because it is a statement, not a function call that returns a value in the typical sense; however, strictly speaking, it does return 1. Let's re-evaluate: The statement says 'print returns the value 1 and can be used inside an expression.' This is actually **True** in PHP. `echo` does not return a value (returns null implicitly in a loose sense, but is a statement), whereas `print` is an expression that evaluates to 1. So you can do `$y = print 'hello';` and `$y` will be 1. Therefore, the statement is True.
Raw{"answer": "no", "explanation": "In PHP, the print statement returns the integer 1, but it is a language construct, not a function, and while it can be used inside an expression (e.g., $x = print 'hi';), the primary statement about it 'returning a value' that distinguishes it from echo is often considered false in the context of general PHP semantics because it is a statement, not a function call that returns a value in the typical sense; however, strictly speaking, it does return 1. Let's re-evaluate: The statement says 'print returns the value 1 and can be used inside an expression.' This is actually **True** in PHP. `echo` does not return a value (returns null implicitly in a loose sense, but is a statement), whereas `print` is an expression that evaluates to 1. So you can do `$y = print 'hello';` and `$y` will be 1. Therefore, the statement is True."} | неверно верный: «yes» | print — выражение со значением 1, в отличие от echo, который значения не возвращает. |
T01-L5 0.38 c | Syntax and operators | The ?: (elvis) operator returns its left operand when it is falsy. | «no» Пояснение: The Elvis operator ($a ?: $b) returns the right operand when the left operand is falsy, and the left operand when it is truthy.
Raw{"answer": "no", "explanation": "The Elvis operator ($a ?: $b) returns the right operand when the left operand is falsy, and the left operand when it is truthy."} | верно | Наоборот: $a ?: $b возвращает $a, если он истинный, иначе $b. |
T01-L6 0.45 c | Syntax and operators | In PHP 8, the concatenation operator (.) has lower precedence than addition and subtraction. | «yes» Пояснение: In PHP, arithmetic operators like + and - have higher precedence than the concatenation operator (.), so expressions like $a + $b . $c are evaluated as ($a + $b) . $c.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In PHP, arithmetic operators like + and - have higher precedence than the concatenation operator (.), so expressions like $a + $b . $c are evaluated as ($a + $b) . $c." ⏎ } | верно | С PHP 8 (RFC concat precedence) '.' имеет приоритет ниже арифметики: 'сумма: ' . 2 + 3 → 'сумма: 5' (в PHP 7 было иначе). |
T01-L7 0.43 c | Syntax and operators | The expression 2 ** 3 ** 2 in PHP evaluates as (2 ** 3) ** 2, that is, 64. | «no» Пояснение: In PHP, the exponentiation operator ** is right-associative, so 2 ** 3 ** 2 evaluates as 2 ** (3 ** 2) = 2 ** 9 = 512, not 64.
Raw{"answer": "no", "explanation": "In PHP, the exponentiation operator ** is right-associative, so 2 ** 3 ** 2 evaluates as 2 ** (3 ** 2) = 2 ** 9 = 512, not 64."} | верно | ** право-ассоциативен: 2 ** (3 ** 2) = 2 ** 9 = 512. |
T01-L8 0.47 c | Syntax and operators | What string will this print: echo 'sum: ' . 2 + 3; (PHP 8)? | «sum: 5» Пояснение: In PHP 8, the dot operator has lower precedence than the addition operator, so the expression is parsed as 'sum: ' . (2 + 3), resulting in the string 'sum: 5'.
Raw{"answer": "sum: 5", "explanation": "In PHP 8, the dot operator has lower precedence than the addition operator, so the expression is parsed as 'sum: ' . (2 + 3), resulting in the string 'sum: 5'."} | верно | Парная к verify-клетке про приоритет: 'сумма: 5'. |
T02-L1 0.38 c | Types and comparisons | With strict comparison (===), arrays are considered equal regardless of element order. | «no» Пояснение: Strict comparison (===) considers arrays equal only if they have the same key/value pairs in the same order and of the same type.
Raw```json ⏎ {"answer": "no", "explanation": "Strict comparison (===) considers arrays equal only if they have the same key/value pairs in the same order and of the same type."} ⏎ ``` | верно | === для массивов требует совпадения и значений, и их порядка. |
T02-L2 0.4 c | Types and comparisons | The comparison 0 == false returns false because it is a strict comparison. | «no» Пояснение: 0 == false uses loose comparison, and since both 0 and false evaluate to the same scalar value (0), it returns true.
Raw```json ⏎ {"answer": "no", "explanation": "0 == false uses loose comparison, and since both 0 and false evaluate to the same scalar value (0), it returns true."} ⏎ ``` | верно | Наоборот: == — нестрогое сравнение и возвращает true; строгое — это === (0 === false → false). |
T02-L3 0.41 c | Types and comparisons | In PHP 8, the expression "abc" == 0 returns true. | «yes» Пояснение: In PHP 8, non-numeric strings like "abc" are converted to 0 when compared with a numeric value using loose comparison (==).
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP 8, non-numeric strings like \"abc\" are converted to 0 when compared with a numeric value using loose comparison (==)."} ⏎ ``` | неверно верный: «no» | С PHP 8 нечисловая строка сравнивается как строка: "abc" == "0" → false (в PHP 7 было true). |
T02-L4 1.04 c | Types and comparisons | Under loose comparison, null equals 0, the empty string, and false at the same time. | «yes» Пояснение: In PHP versions prior to 8.0, loose comparison (==) treated null as equal to 0, the empty string (''), and false; however, since PHP 8.0, null == '' is false, while null == 0 and null == false remain true, making the statement historically true but technically nuanced depending on the version. Given the context of general PHP knowledge tests often referencing pre-8.0 behavior or the fact that it equals 0 and false, the statement is largely accepted as describing the legacy behavior.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In PHP versions prior to 8.0, loose comparison (==) treated null as equal to 0, the empty string (''), and false; however, since PHP 8.0, null == '' is false, while null == 0 and null == false remain true, making the statement historically true but technically nuanced depending on the version. Given the context of general PHP knowledge tests often referencing pre-8.0 behavior or the fact that it equals 0 and false, the statement is largely accepted as describing the legacy behavior." ⏎ } | верно | null == 0, null == "" и null == false — все true. |
T02-L5 0.35 c | Types and comparisons | What does the expression (int) '42abc' return? | «42» Пояснение: In PHP, casting a string starting with a number to int parses the leading numeric portion and ignores the rest.
Raw{"answer": 42, "explanation": "In PHP, casting a string starting with a number to int parses the leading numeric portion and ignores the rest."} | верно | Ведущая числовая часть: 42, без ошибок и warning. |
T02-L6 0.33 c | Types and comparisons | What does the expression '5' + 5 return? | «10» Пояснение: In PHP, the string '5' is cast to an integer when added to the integer 5, resulting in the integer 10.
Raw{"answer": 10, "explanation": "In PHP, the string '5' is cast to an integer when added to the integer 5, resulting in the integer 10."} | верно | Числовая строка приводится: int 10. |
T02-L7 0.31 c | Types and comparisons | When cast to string, false becomes "0". | «yes» Пояснение: In PHP, casting `false` to a string results in an empty string "", not "0".
Raw{"answer": "yes", "explanation": "In PHP, casting `false` to a string results in an empty string \"\", not \"0\"."} | неверно верный: «no» | false → "", true → "1". |
T02-L8 0.45 c | Types and comparisons | The comparison 0.1 + 0.2 === 0.3 returns false. | «yes» Пояснение: Due to floating-point precision errors in PHP, 0.1 + 0.2 evaluates to a number slightly different from 0.3, making the strict comparison (===) return false.
Raw{"answer": "yes", "explanation": "Due to floating-point precision errors in PHP, 0.1 + 0.2 evaluates to a number slightly different from 0.3, making the strict comparison (===) return false."} | верно | Двоичная погрешность float: 0.1 + 0.2 = 0.30000000000000004. |
T03-L1 0.44 c | Strings | strrev() correctly reverses a UTF-8 string. | «no» Пояснение: strrev() treats strings as byte sequences, so it can break multi-byte UTF-8 characters by reversing their individual bytes rather than the characters themselves.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "strrev() treats strings as byte sequences, so it can break multi-byte UTF-8 characters by reversing their individual bytes rather than the characters themselves." ⏎ } | верно | strrev переворачивает байты и ломает многобайтовые последовательности. |
T03-L2 0.37 c | Strings | str_contains('Hello world', 'world') returns true. | «yes» Пояснение: The function str_checks if the given string is contained in the other string, and 'world' is indeed present in 'Hello world'.
Raw```json ⏎ {"answer": "yes", "explanation": "The function str_checks if the given string is contained in the other string, and 'world' is indeed present in 'Hello world'."} ⏎ ``` | верно | str_contains с PHP 8.0 проверяет вхождение подстроки. |
T03-L3 0.31 c | Strings | str_pad() can pad a string on the right side only. | «no» Пояснение: str_pad() can pad a string on the left, right, or both sides depending on the third parameter (STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH).
Raw{"answer": "no", "explanation": "str_pad() can pad a string on the left, right, or both sides depending on the third parameter (STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH)."} | верно | STR_PAD_LEFT / STR_PAD_BOTH меняют сторону дополнения. |
T03-L4 0.26 c | Strings | By default trim() strips only spaces, leaving tabs and newlines intact. | «no» Пояснение: By default, trim() strips whitespace characters including spaces, tabs, newlines, carriage returns, and NULs.
Raw{"answer": "no", "explanation": "By default, trim() strips whitespace characters including spaces, tabs, newlines, carriage returns, and NULs."} | верно | Список символов по умолчанию: « \t\n\r\0\x0B» — пробелы, табы, переводы строк, возврат каретки, null-байт, вертикальный таб. Проверено php -r. |
T03-L5 0.65 c | Strings | How many BYTES does strlen('héllo') return for a UTF-8 string? | «6» Пояснение: 'héllo' contains 6 characters; the letter 'é' is 2 bytes in UTF-8, while the other 5 are 1 byte each, totaling 7 bytes, but wait—'h' (1) + 'é' (2) + 'l' (1) + 'l' (1) + 'o' (1) = 6 bytes.
Raw{"answer": 6, "explanation": "'héllo' contains 6 characters; the letter 'é' is 2 bytes in UTF-8, while the other 5 are 1 byte each, totaling 7 bytes, but wait—'h' (1) + 'é' (2) + 'l' (1) + 'l' (1) + 'o' (1) = 6 bytes."} | верно | 6 букв по 2 байта: 12. |
T03-L6 0.51 c | Strings | What does substr('abcdef', -3) return? | «def» Пояснение: substr with a negative start position -3 returns the last 3 characters of the string 'abcdef'.
Raw{"answer": "def", "explanation": "substr with a negative start position -3 returns the last 3 characters of the string 'abcdef'."} | верно | Отрицательное смещение — с конца: def. |
T03-L7 0.31 c | Strings | ucfirst() modifies the string passed to it in place. | «no» Пояснение: The ucfirst() function returns a new string with the first character uppercased; it does not modify the original string in place.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The ucfirst() function returns a new string with the first character uppercased; it does not modify the original string in place." ⏎ } ⏎ ``` | верно | Строки неизменяемы; ucfirst возвращает новую строку. |
T03-L8 0.41 c | Strings | Variable interpolation works in heredoc but not in nowdoc. | «yes» Пояснение: Heredoc supports variable interpolation just like double-quoted strings, while nowdoc treats the body as single-quoted, so no variables are interpolated.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "Heredoc supports variable interpolation just like double-quoted strings, while nowdoc treats the body as single-quoted, so no variables are interpolated." ⏎ } | верно | Nowdoc — «одинарные кавычки» в тройном синтаксисе: текст как есть. |
T04-L1 0.35 c | Arrays | The sort() function preserves the key-to-value association of the array. | «no» Пояснение: The sort() function re-indexes the array keys (starting from 0) by default; to preserve keys, asort() must be used.
Raw{"answer": "no", "explanation": "The sort() function re-indexes the array keys (starting from 0) by default; to preserve keys, asort() must be used."} | верно | sort перенумеровывает ключи; связь сохраняет asort. |
T04-L2 0.33 c | Arrays | The string key '5' in an array is stored as the integer 5. | «yes» Пояснение: In PHP, if a string contains a valid decimal integer (like '5'), it is automatically cast to an integer when used as an array key.
Raw{"answer": "yes", "explanation": "In PHP, if a string contains a valid decimal integer (like '5'), it is automatically cast to an integer when used as an array key."} | верно | Каноничные десятичные строковые ключи приводятся к int. |
T04-L3 0.31 c | Arrays | The in_array() function uses strict comparison (===) by default. | «no» Пояснение: in_array() uses loose comparison (==) by default unless the third parameter is set to true.
Raw```json ⏎ {"answer": "no", "explanation": "in_array() uses loose comparison (==) by default unless the third parameter is set to true."} ⏎ ``` | верно | По умолчанию сравнение нестрогое; строгое — третий аргумент true. |
T04-L4 0.35 c | Arrays | Without a callback, array_filter() removes all "empty" (falsy) elements from the array. | «yes» Пояснение: array_filter() with no callback removes all falsy values (0, 0.0, "", null, false, []) from the array.
Raw{"answer": "yes", "explanation": "array_filter() with no callback removes all falsy values (0, 0.0, \"\", null, false, []) from the array."} | верно | Убирает 0, "", null, false и пустые массивы. |
T04-L5 0.31 c | Arrays | By default, array_slice() preserves the original numeric keys of the array. | «no» Пояснение: By default, array_slice() re-indexes numeric keys starting from 0 unless the second argument is set to true.
Raw{"answer": "no", "explanation": "By default, array_slice() re-indexes numeric keys starting from 0 unless the second argument is set to true."} | верно | По умолчанию ключи перенумеровываются; сохранение — preserve_keys = true. |
T04-L6 0.34 c | Arrays | What does array_slice([10, 20, 30, 40], 1, 2) return? | «[20, 30]» Пояснение: array_slice with offset 1 and length 2 extracts elements starting at index 1 for 2 items.
Raw{"answer": "[20, 30]", "explanation": "array_slice with offset 1 and length 2 extracts elements starting at index 1 for 2 items."} | верно | [20,30]; ключи перенумеровываются. |
T04-L7 0.5 c | Arrays | How many elements will count(['a' => 1] + ['a' => 9, 'b' => 2]) return? | «2» Пояснение: The array union operator (+) keeps the left array's keys and adds non-duplicate keys from the right array, resulting in ['a' => 1, 'b' => 2], which has 2 elements.
Raw{"answer": 2, "explanation": "The array union operator (+) keeps the left array's keys and adds non-duplicate keys from the right array, resulting in ['a' => 1, 'b' => 2], which has 2 elements."} | верно | Оператор + : по ключу 'a' побеждает левый; итого 2. |
T04-L8 0.33 c | Arrays | Since PHP 8.1, the spread operator [...$a, ...$b] supports arrays with string keys. | «yes» Пояснение: Since PHP 8.1, the spread operator supports arrays with string keys, allowing for more flexible array merging.
Raw{"answer": "yes", "explanation": "Since PHP 8.1, the spread operator supports arrays with string keys, allowing for more flexible array merging."} | верно | В 8.0 — только числовые ключи; 8.1 снял ограничение. |
T05-L1 0.33 c | Functions and closures | Named arguments cannot be combined with argument unpacking ...$args in a single call. | «no» Пояснение: In PHP 8.0+, named arguments can be combined with argument unpacking in a single function call.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In PHP 8.0+, named arguments can be combined with argument unpacking in a single function call." ⏎ } ⏎ ``` | верно | Можно: f(...$args, имя: значение). Нельзя только позиционный аргумент после распаковки. |
T05-L2 0.73 c | Functions and closures | An anonymous function without use sees variables from the outer scope. | «no» Пояснение: Anonymous functions (closures) do not inherit variables from the outer scope by default; they must be explicitly imported using the 'use' keyword or be defined within the same scope where the variable is accessible via the $this pointer if inside a class method, but generally, local variables from the calling scope are not visible without 'use'.
Raw{"answer": "no", "explanation": "Anonymous functions (closures) do not inherit variables from the outer scope by default; they must be explicitly imported using the 'use' keyword or be defined within the same scope where the variable is accessible via the $this pointer if inside a class method, but generally, local variables from the calling scope are not visible without 'use'."} | верно | Без use внешние переменные недоступны; авто-захват только у fn. |
T05-L3 0.3 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.35 c | Functions and closures | The body of an arrow function fn may consist of several expressions in curly braces. | «yes» Пояснение: Arrow functions in PHP can have a body consisting of multiple expressions enclosed in curly braces, similar to regular functions.
Raw```json ⏎ {"answer": "yes", "explanation": "Arrow functions in PHP can have a body consisting of multiple expressions enclosed in curly braces, similar to regular functions."} ⏎ ``` | неверно верный: «no» | fn — всегда одно выражение; блок операторов делает обычная анонимная функция. |
T05-L5 0.76 c | Functions and closures | An arrow function fn captures outer variables by reference (lazily, at use time). | «no» Пояснение: Arrow functions in PHP (introduced in PHP 8.0) capture outer variables by value, not by reference, and this capture happens immediately at the time of the function's creation, not lazily at use time. This is similar to how anonymous functions with `use` work if `use` variables are not passed by reference, but the key point here is that arrow functions do not capture by reference by default.
Raw{"answer": "no", "explanation": "Arrow functions in PHP (introduced in PHP 8.0) capture outer variables by value, not by reference, and this capture happens immediately at the time of the function's creation, not lazily at use time. This is similar to how anonymous functions with `use` work if `use` variables are not passed by reference, but the key point here is that arrow functions do not capture by reference by default."} | верно | fn захватывает только по значению, автоматически; по ссылке — только &$var в use у обычной функции (fn так не умеет). |
T05-L6 0.34 c | Functions and closures | A closure declared as static function () {} does not capture $this. | «yes» Пояснение: In PHP, a static closure explicitly does not bind or capture the $this context of the calling scope.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In PHP, a static closure explicitly does not bind or capture the $this context of the calling 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 at the time of definition using 'use ($x)', so changing $x later does not affect the closure's internal variable.
Raw{"answer": 5, "explanation": "The closure captures the value of $x (5) by value at the time of definition using 'use ($x)', so changing $x later does not affect the closure's internal variable."} | верно | use захватывает по значению в момент создания: 5. |
T05-L8 0.42 c | Functions and closures | In weak typing mode (without strict_types), passing the string "5" to an int parameter is allowed. | «yes» Пояснение: In weak typing mode, PHP automatically coerces the string "5" to the integer 5 before passing it to the function, allowing the operation to succeed without a TypeError.
Raw{"answer": "yes", "explanation": "In weak typing mode, PHP automatically coerces the string \"5\" to the integer 5 before passing it to the function, allowing the operation to succeed without a TypeError."} | верно | Coercive typing приводит "5" к 5; strict_types=1 требует точного типа. |
T06-L1 0.25 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 properties to be declared directly in the constructor signature.
Raw{"answer": "yes", "explanation": "PHP 8.0 introduced constructor property promotion, allowing properties to be declared directly in the constructor signature."} | верно | С PHP 8.0 параметр с модификатором создаёт свойство и присваивание. |
T06-L2 0.31 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 in subclasses.
Raw```json ⏎ {"answer": "final", "explanation": "The 'final' keyword in PHP prevents a class from being extended or a method from being overridden in subclasses."} ⏎ ``` | верно | final. |
T06-L3 0.27 c | OOP: classes and inheritance | A method declared final cannot be overridden in a subclass. | «yes» Пояснение: In PHP, a method declared as final cannot be overridden in subclasses.
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP, a method declared as final cannot be overridden in subclasses."} ⏎ ``` | верно | final запрещает переопределение метода и наследование класса. |
T06-L4 0.25 c | OOP: classes and inheritance | Parent properties with private visibility are accessible in a subclass. | «no» Пояснение: Private properties in a parent class are not accessible to child classes in PHP.
Raw{"answer": "no", "explanation": "Private properties in a parent class are not accessible to child classes in PHP."} | верно | В подклассе видны protected и public; private — только внутри своего класса. |
T06-L5 0.64 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» Пояснение: In PHP 8.1+, anonymous classes return 'class@anonymous' followed by the file and line number, but the question asks for the part before the NUL byte or just the base name; however, historically and in many contexts, the base identifier is 'class@anonymous'.
Raw{"answer": "class@anonymous", "explanation": "In PHP 8.1+, anonymous classes return 'class@anonymous' followed by the file and line number, but the question asks for the part before the NUL byte or just the base name; however, historically and in many contexts, the base identifier is 'class@anonymous'."} | верно | get_class анонимного класса печатает class@anonymous\0<файл>:<строка>$n; короткая форма — часть до NUL-байта. Проверено php -r (hex). |
T06-L6 0.42 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. | «yes» Пояснение: Private methods are not part of the class interface, so they are not inherited and do not need to match visibility or signature in child classes.
Raw{"answer": "yes", "explanation": "Private methods are not part of the class interface, so they are not inherited and do not need to match visibility or signature in child classes."} | верно | private-члены не наследуются — правила совместимости подписей не действуют. |
T06-L7 0.31 c | OOP: classes and inheritance | The magic method __get() is called only for non-existent properties. | «no» Пояснение: __get() is called for inaccessible (non-existent or protected/private) properties.
Raw```json ⏎ {"answer": "no", "explanation": "__get() is called for inaccessible (non-existent or protected/private) properties."} ⏎ ``` | верно | __get срабатывает и для существующих, но недоступных (private/protected извне). |
T06-L8 0.31 c | OOP: classes and inheritance | What does reassigning a readonly property throw — Exception or Error? | «error» Пояснение: Reassigning a readonly property throws a readonlyproperty error, which is a type of Error.
Raw{"answer": "Error", "explanation": "Reassigning a readonly property throws a readonlyproperty error, which is a type of Error."} | верно | Error (readonly с 8.1); оговорка: в __clone() переинициализация допустима (8.3+). |
T07-L1 0.25 c | Interfaces, traits, enum | An interface can declare constants. | «yes» Пояснение: In PHP, interfaces can declare public constants in addition to method signatures.
Raw{"answer": "yes", "explanation": "In PHP, interfaces can declare public constants in addition to method signatures."} | верно | Константы интерфейса наследуются реализациями. |
T07-L2 0.29 c | Interfaces, traits, enum | Which operator checks whether an object is an instance of a class or interface? | «instanceof» Пояснение: In PHP, the 'instanceof' operator returns true if an object is an instance of the specified class or interface.
Raw{"answer": "instanceof", "explanation": "In PHP, the 'instanceof' operator returns true if an object is an instance of the specified class or interface."} | верно | instanceof. |
T07-L3 0.31 c | Interfaces, traits, enum | An interface can declare static methods. | «yes» Пояснение: In PHP, interfaces are allowed to declare static methods, although they cannot define the method body.
Raw{"answer": "yes", "explanation": "In PHP, interfaces are allowed to declare static methods, although they cannot define the method body."} | верно | Реализация обязана дать статический метод с той же сигнатурой. |
T07-L4 0.27 c | Interfaces, traits, enum | The instanceof operator only checks class inheritance: it ignores interfaces. | «no» Пояснение: In PHP, the instanceof operator checks for class inheritance as well as whether an object implements a specific interface.
Raw{"answer": "no", "explanation": "In PHP, the instanceof operator checks for class inheritance as well as whether an object implements a specific interface."} | верно | instanceof возвращает true и для интерфейсов объекта. |
T07-L5 1.64 c | Interfaces, traits, enum | An interface method may have a default implementation, like a trait method. | «no» Пояснение: PHP interfaces define a contract and cannot contain method bodies (default implementations); this feature was introduced in PHP 8.0 but only for interfaces in a very limited sense? Actually, no, standard interfaces still require implementations, though there is a newer feature? Wait, PHP 8.0 does not allow default implementations in interfaces. Traits can, interfaces cannot (except for constant visibility changes in 8.1, but methods still need bodies in the implementing class). Correction: As of PHP 8.1, interfaces can define methods with default implementations? No, that is not standard. Let me double-check. Standard PHP interfaces require implementing classes to define the methods. Traits allow default implementations. Therefore, the statement is false.
Raw{"answer": "no", "explanation": "PHP interfaces define a contract and cannot contain method bodies (default implementations); this feature was introduced in PHP 8.0 but only for interfaces in a very limited sense? Actually, no, standard interfaces still require implementations, though there is a newer feature? Wait, PHP 8.0 does not allow default implementations in interfaces. Traits can, interfaces cannot (except for constant visibility changes in 8.1, but methods still need bodies in the implementing class). Correction: As of PHP 8.1, interfaces can define methods with default implementations? No, that is not standard. Let me double-check. Standard PHP interfaces require implementing classes to define the methods. Traits allow default implementations. Therefore, the statement is false."} | верно | Методы интерфейса — только сигнатуры; тело даёт реализующий класс. |
T07-L6 0.32 c | Interfaces, traits, enum | An abstract method in an abstract class may have protected visibility. | «yes» Пояснение: In PHP, abstract methods within an abstract class can have public, protected, or private visibility.
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP, abstract methods within an abstract class can have public, protected, or private visibility."} ⏎ ``` | верно | В абстрактном классе — любая видимость; в интерфейсе — только public. |
T07-L7 0.4 c | Interfaces, traits, enum | How many elements will Foo::cases() return for enum Foo { case A; case B; case C; }? | «3» Пояснение: The static method cases() on a PHP enum returns an array of all its cases, and Foo defines exactly three cases (A, B, C).
Raw{"answer": 3, "explanation": "The static method cases() on a PHP enum returns an array of all its cases, and Foo defines exactly three cases (A, B, C)."} | верно | Статический метод cases(): 3. |
T07-L8 0.35 c | Interfaces, traits, enum | A trait can declare constants. | «yes» Пояснение: PHP traits allow the declaration of constants, which are inherited by any class that uses the trait.
Raw{"answer": "yes", "explanation": "PHP traits allow the declaration of constants, which are inherited by any class that uses the trait."} | верно | С PHP 8.2 трейты могут объявлять константы (RFC constants_in_traits); до 8.2 — нет. |
T08-L1 0.35 c | Exceptions and errors | The Throwable interface is a common ancestor of both Exception and Error. | «yes» Пояснение: In PHP, both the Exception and Error classes implement the Throwable interface, making it their common ancestor for catching any throwable object.
Raw{"answer": "yes", "explanation": "In PHP, both the Exception and Error classes implement the Throwable interface, making it their common ancestor for catching any throwable object."} | верно | Иерархия с PHP 7: Throwable → Exception и Throwable → Error. |
T08-L2 0.35 c | Exceptions and errors | A catch (Exception $e) block will also catch TypeError, because TypeError ultimately inherits from Exception. | «no» Пояснение: In PHP, TypeError inherits from Error, not Exception, so a catch block specifying Exception will not catch TypeError unless it also catches Error or Throwable.
Raw{"answer": "no", "explanation": "In PHP, TypeError inherits from Error, not Exception, so a catch block specifying Exception will not catch TypeError unless it also catches Error or Throwable."} | верно | TypeError наследуется от Error; catch (Exception) его не ловит. |
T08-L3 0.64 c | Exceptions and errors | The @ operator suppresses exceptions too. | «no» Пояснение: In modern PHP (versions 5.x and 7.x+), the @ operator only suppresses error/warning/notice messages (E_WARNING, E_NOTICE, etc.), not exceptions like TypeError, ValueError, or user-defined exceptions.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "In modern PHP (versions 5.x and 7.x+), the @ operator only suppresses error/warning/notice messages (E_WARNING, E_NOTICE, etc.), not exceptions like TypeError, ValueError, or user-defined exceptions." ⏎ } | верно | @ глушит диагностику (warnings/notices), исключения не перехватывает. |
T08-L4 0.36 c | Exceptions and errors | What error class does intdiv(5, 0) throw? | «divisionbyzeroerror» Пояснение: In PHP 8.0+, intdiv(5, 0) throws a DivisionByZeroError.
Raw{"answer": "DivisionByZeroError", "explanation": "In PHP 8.0+, intdiv(5, 0) throws a DivisionByZeroError."} | верно | DivisionByZeroError (иерархия Error, не Exception); php-грейдер объективен. |
T08-L5 0.39 c | Exceptions and errors | The finally block runs only if the exception was caught by a catch block. | «no» Пояснение: The finally block executes whether or not an exception was caught, ensuring code runs after try/catch regardless of outcome.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "The finally block executes whether or not an exception was caught, ensuring code runs after try/catch regardless of outcome." ⏎ } | верно | Наоборот: finally выполняется всегда — даже когда исключение не поймано и уходит выше. Проверено php -r. |
T08-L6 0.33 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 in a finally block, it replaces the original exception or return value from the try block, effectively masking the original flow.
Raw{"answer": "no", "explanation": "If an exception is thrown in a finally block, it replaces the original exception or return value from the try block, effectively masking the original flow."} | верно | Исключение из finally перекрывает исходное и уходит вместо него. |
T08-L7 0.27 c | Exceptions and errors | What does the expression (bool) new Exception('x') return? | «yes» Пояснение: In PHP, any object instance, including an Exception object, evaluates to true when cast to a boolean.
Raw{"answer": "yes", "explanation": "In PHP, any object instance, including an Exception object, evaluates to true when cast to a boolean."} | верно | Любой объект при приведении к bool — true. Формы ответа: true или да. |
T08-L8 0.37 c | Exceptions and errors | Functions registered via register_shutdown_function() run when exit is called. | «no» Пояснение: Functions registered with register_shutdown_function() are called only when the script is finishing execution, not when exit() is called.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Functions registered with register_shutdown_function() are called only when the script is finishing execution, not when exit() is called." ⏎ } ⏎ ``` | неверно верный: «yes» | exit завершает скрипт, но shutdown-функции отрабатывают. |
T09-L1 0.46 c | Namespaces and autoloading | The use App\Service\Mailer; statement itself loads the class file. | «no» Пояснение: The use statement is merely an alias and does not trigger file loading; the autoloader loads the class file only when the class is actually instantiated or referenced at runtime.
Raw```json ⏎ {"answer": "no", "explanation": "The use statement is merely an alias and does not trigger file loading; the autoloader loads the class file only when the class is actually instantiated or referenced at runtime."} ⏎ ``` | верно | 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 after `use` to import a function.
Raw{"answer": "function", "explanation": "In PHP, the `function` keyword is used after `use` to import a function."} | верно | use function ...; (и use const для констант). |
T09-L3 0.36 c | Namespaces and autoloading | Into which file (path from src/) does the PSR-4 mapping "App\ → src/" place the class App\Controller\Api\UserController? | «src/controller/api/usercontroller.php» Пояснение: The namespace App\Controller\Api maps to the directory src/Controller/Api/, and the class name UserController becomes the filename UserController.php.
Raw{"answer": "src/Controller/Api/UserController.php", "explanation": "The namespace App\\Controller\\Api maps to the directory src/Controller/Api/, and the class name UserController becomes the filename UserController.php."} | верно | Остаток имени после префикса, \ → /. |
T09-L4 0.43 c | Namespaces and autoloading | Including vendor/autoload.php registers autoloaders via spl_autoload_register(). | «yes» Пояснение: Composer's autoload.php typically calls spl_autoload_register() to register the autoload functions (e.g., composerRequire...) when included.
Raw{"answer": "yes", "explanation": "Composer's autoload.php typically calls spl_autoload_register() to register the autoload functions (e.g., composerRequire...) when included."} | верно | Composer ставит автозагрузчик именно на spl_autoload_register. |
T09-L5 0.29 c | Namespaces and autoloading | The magic constant __NAMESPACE__ contains the name of the current namespace. | «yes» Пояснение: __NAMESPACE__ is a magic constant that returns the name of the current namespace, or an empty string if in the global namespace.
Raw{"answer": "yes", "explanation": "__NAMESPACE__ is a magic constant that returns the name of the current namespace, or an empty string if in the global namespace."} | верно | В корневом пространстве — пустая строка. |
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 in `new` is resolved from the current namespace, not the global root.
Raw```json ⏎ {"answer": "no", "explanation": "An unqualified class name in `new` is resolved from the current namespace, not the global root."} ⏎ ``` | верно | Резолвится относительно текущего namespace (с учётом импортов). |
T09-L7 0.39 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 autoloading maps namespace segments to directory structures, so App\Model\User corresponds to src/Model/User.php.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "PSR-4 autoloading maps namespace segments to directory structures, so App\\Model\\User corresponds to src/Model/User.php." ⏎ } | верно | Остаток имени после префикса переносится в путь как есть. |
T09-L8 0.43 c | Namespaces and autoloading | A use statement may be written inside a function body — the import then applies to that function only. | «yes» Пояснение: PHP 8.0 introduced support for use statements inside function bodies, making the import scoped to that function only.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "PHP 8.0 introduced support for use statements inside function bodies, making the import scoped to that function only." ⏎ } ⏎ ``` | неверно верный: «no» | use внутри тела функции — parse error; импорты файловые и компиляционные. |
T10-L1 0.33 c | References and scope | Arrays are copied on assignment rather than passed by reference. | «yes» Пояснение: In PHP, arrays are passed by value (copy-on-write) by default, meaning assignment creates a copy of the array structure.
Raw{"answer": "yes", "explanation": "In PHP, arrays are passed by value (copy-on-write) by default, meaning assignment creates a copy of the array structure."} | верно | Присваивание массива — копия (в движке — copy-on-write). |
T10-L2 0.36 c | References and scope | What will this print: $a = [1, 2]; $b = $a; $b[] = 3; echo count($a); | «2» Пояснение: In PHP, arrays are copied by value, so modifying $b does not affect $a, leaving its count at 2.
Raw{"answer": 2, "explanation": "In PHP, arrays are copied by value, so modifying $b does not affect $a, leaving its count at 2."} | верно | Присваивание — копия: в $a по-прежнему 2 элемента. |
T10-L3 0.38 c | References and scope | Inside a function, user-defined global variables are inaccessible without global, $GLOBALS, or passing them as parameters. | «yes» Пояснение: In PHP, global variables must be accessed inside functions using the global keyword, $GLOBALS array, or by being passed as parameters.
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP, global variables must be accessed inside functions using the global keyword, $GLOBALS array, or by being passed as parameters."} ⏎ ``` | верно | Область видимости функций изолирована; исключение — суперглобалы ($_GET и др.). |
T10-L4 0.35 c | References and scope | unset($GLOBALS['x']) inside a function removes the global variable only for that function. | «no» Пояснение: Modifying the $GLOBALS array (including unsetting keys) affects the global scope directly, not just the local function scope.
Raw{"answer": "no", "explanation": "Modifying the $GLOBALS array (including unsetting keys) affects the global scope directly, not just the local function scope."} | верно | $GLOBALS — прямое окно в глобальную область: unset удалит её по-настоящему. |
T10-L5 0.27 c | References and scope | What will this print: function inc(&$x) { $x++; } $n = 5; inc($n); echo $n; | «6» Пояснение: The function modifies the variable by reference, so $n is incremented from 5 to 6.
Raw{"answer": 6, "explanation": "The function modifies the variable by reference, so $n is incremented from 5 to 6."} | верно | Ссылка меняет оригинал: 6. |
T10-L6 0.43 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. | «no» Пояснение: In PHP, a foreach loop iterating by value operates on a copy of the array, so modifications to the array inside the loop do not affect the iteration sequence of that same pass.
Raw{"answer": "no", "explanation": "In PHP, a foreach loop iterating by value operates on a copy of the array, so modifications to the array inside the loop do not affect the iteration sequence of that same pass."} | верно | По значению foreach итерирует копию-снимок. |
T10-L7 0.43 c | References and scope | A static property belongs to each instance separately: changes in one object are not visible in others. | «no» Пояснение: Static properties belong to the class itself, so they are shared across all instances, unlike instance properties which are unique to each object.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Static properties belong to the class itself, so they are shared across all instances, unlike instance properties which are unique to each object." ⏎ } | верно | Наоборот: статическое свойство общее для всех экземпляров класса. Проверено php -r. |
T10-L8 0.35 c | References and scope | An array can have a boolean key true, and it will be stored as bool. | «no» Пояснение: In PHP, array keys of type boolean are cast to integers: `true` becomes `1` and `false` becomes `0`.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "In PHP, array keys of type boolean are cast to integers: `true` becomes `1` and `false` becomes `0`." ⏎ } | верно | Булев ключ приводится к int: true → 1, false → 0. |
T11-L1 0.38 c | Generators, iterators, SPL | Inside a generator, return with a value can be used, and it becomes available via $gen->getReturn(). | «yes» Пояснение: Since PHP 7.0, generators support return statements with values, which can be accessed using the getReturn() method on the Generator object.
Raw{"answer": "yes", "explanation": "Since PHP 7.0, generators support return statements with values, which can be accessed using the getReturn() method on the Generator object."} | верно | return-значение генератора доступно через getReturn() после прохода. |
T11-L2 0.49 c | Generators, iterators, SPL | A fully consumed generator can be rewound with rewind() and traversed again. | «no» Пояснение: In PHP, generators (yield) are one-shot iterators; once fully consumed, calling rewind() (or re-iterating) on them will throw a LogicException because they cannot be reset.
Raw{"answer": "no", "explanation": "In PHP, generators (yield) are one-shot iterators; once fully consumed, calling rewind() (or re-iterating) on them will throw a LogicException because they cannot be reset."} | верно | Генератор одноразовый: rewind после начала итерации бросает Exception. |
T11-L3 0.35 c | Generators, iterators, SPL | The yield from construct delegates traversal to another generator or iterable. | «yes» Пояснение: yield from delegates iteration and value forwarding to another iterator, such as a generator or iterable.
Raw{"answer": "yes", "explanation": "yield from delegates iteration and value forwarding to another iterator, such as a generator or iterable."} | верно | yield from проксирует значения, ключи и return-значение внутреннего генератора. |
T11-L4 0.5 c | Generators, iterators, SPL | What does get_class(g()) return for function g() { yield 1; }? | «generator» Пояснение: In PHP, a function that uses the yield keyword is called a generator function, and get_class(g()) returns the class name 'Generator' when g() is an iterator object created by such a function.
Raw{"answer": "Generator", "explanation": "In PHP, a function that uses the yield keyword is called a generator function, and get_class(g()) returns the class name 'Generator' when g() is an iterator object created by such a function."} | верно | Функция с yield возвращает Generator. |
T11-L5 0.38 c | Generators, iterators, SPL | How many elements will count(iterator_to_array((function () { yield from [1, 2, 3]; })())) return? | «3» Пояснение: The generator yields three items (1, 2, 3), and iterator_to_array creates an array with 3 elements.
Raw{"answer": 3, "explanation": "The generator yields three items (1, 2, 3), and iterator_to_array creates an array with 3 elements."} | верно | yield from делегирует все 3 элемента. |
T11-L6 0.39 c | Generators, iterators, SPL | The SplStack class implements a FIFO queue. | «no» Пояснение: SplStack is a LIFO (Last-In, First-Out) stack, not a FIFO queue; SplQueue implements FIFO.
Raw{"answer": "no", "explanation": "SplStack is a LIFO (Last-In, First-Out) stack, not a FIFO queue; SplQueue implements FIFO."} | верно | SplStack — стек LIFO; очередь FIFO — SplQueue. |
T11-L7 0.33 c | Generators, iterators, SPL | ArrayIterator allows wrapping an array and traversing it via the Iterator interface. | «yes» Пояснение: ArrayIterator is a built-in SPL class that implements the Iterator interface to provide object-based access to arrays.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "ArrayIterator is a built-in SPL class that implements the Iterator interface to provide object-based access to arrays." ⏎ } | верно | Объектная обёртка над массивом. |
T11-L8 0.27 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```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "ArrayObject implements the Iterator interface, so it can be traversed with foreach." ⏎ } ⏎ ``` | верно | ArrayObject реализует IteratorAggregate — foreach по нему работает. |
T12-L1 0.41 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 incorporates it into the returned hash string; providing a separate salt parameter is not supported or required in its standard usage.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The password_hash() function in PHP automatically generates a unique salt and incorporates it into the returned hash string; providing a separate salt parameter is not supported or required in its standard usage." ⏎ } ⏎ ``` | верно | Соль встраивается в строку результата; параметр salt устарел. |
T12-L2 0.58 c | Configuration and security | In PHP 8, PASSWORD_DEFAULT is md5 with an automatically added salt. | «no» Пояснение: In PHP 8, PASSWORD_DEFAULT uses the Argon2i (or Argon2id) algorithm, not MD5, and it is recommended to use PASSWORD_BCRYPT or newer for security.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In PHP 8, PASSWORD_DEFAULT uses the Argon2i (or Argon2id) algorithm, not MD5, and it is recommended to use PASSWORD_BCRYPT or newer for security." ⏎ } ⏎ ``` | верно | PASSWORD_DEFAULT — bcrypt; md5 для паролей непригоден (перебирается массово). |
T12-L3 0.33 c | Configuration and security | What does password_verify('secret', password_hash('secret', PASSWORD_DEFAULT)) return? | «yes» Пояснение: password_verify compares the plain password 'secret' with the hash generated by password_hash and returns true if they match.
Raw{"answer": "yes", "explanation": "password_verify compares the plain password 'secret' with the hash generated by password_hash and returns true if they match."} | верно | Соль и хеш в одной строке: true (форма ответа: true или да). |
T12-L4 0.31 c | Configuration and security | strip_tags() protects against SQL injection. | «no» Пояснение: strip_tags() removes HTML/XML tags to prevent XSS, not SQL injection, which is best prevented with prepared statements.
Raw{"answer": "no", "explanation": "strip_tags() removes HTML/XML tags to prevent XSS, not SQL injection, which is best prevented with prepared statements."} | верно | strip_tags режет HTML-теги (помощник против XSS), к параметризации SQL отношения не имеет. |
T12-L5 0.37 c | Configuration and security | session_regenerate_id() is used to protect against session fixation upon user login. | «yes» Пояснение: session_regenerate_id() creates a new session ID to invalidate old ones, preventing attackers from exploiting a known session ID to hijack the user's session.
Raw{"answer": "yes", "explanation": "session_regenerate_id() creates a new session ID to invalidate old ones, preventing attackers from exploiting a known session ID to hijack the user's session."} | верно | Новый ID сессии после логина — стандартная защита от session fixation. |
T12-L6 0.08 c | Configuration and security | Which built-in function returns the SAPI name (e.g., cli)? | «— (нет ответа)» | не разобрано верный: «php_sapi_name» парсинг: нет | php_sapi_name(). |
T12-L7 0.38 c | Configuration and security | session_destroy() deletes session data on the server but not the cookie in the user's browser. | «yes» Пояснение: session_destroy() only removes the session data stored on the server (typically in a file or database) and does not remove the session ID cookie from the client's browser.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "session_destroy() only removes the session data stored on the server (typically in a file or database) and does not remove the session ID cookie from the client's browser." ⏎ } | верно | Удаление cookie — отдельный шаг через setcookie с истёкшим сроком. |
T12-L8 0.39 c | Configuration and security | Without calling session_start(), the $_SESSION array is automatically populated with session data. | «no» Пояснение: The $_SESSION superglobal is typically empty or undefined until session_start() is called to initialize the session and load any saved data.
Raw{"answer": "no", "explanation": "The $_SESSION superglobal is typically empty or undefined until session_start() is called to initialize the session and load any saved data."} | верно | Без session_start() данные сессии в массив не загружаются ($_SESSION можно заполнить вручную, но привязки к сессии нет). |
VC-L1 0.27 c | PHP 8.4–8.5 | In which PHP version was the array_find() function introduced? | «8.0» Пояснение: array_find() was introduced in PHP 8.0 as part of the new array functions.
Raw{ ⏎ "answer": "8.0", ⏎ "explanation": "array_find() was introduced in PHP 8.0 as part of the new array functions." ⏎ } | неверно верный: «8.4» | PHP 8.4 (RFC array_find). |
VC-L2 0.35 c | PHP 8.4–8.5 | Property hooks (get/set right in the property declaration) landed in PHP 8.4. | «yes» Пояснение: Property hooks (custom getters and setters declared with get and set inside a property definition) were introduced in PHP 8.4.
Raw{"answer": "yes", "explanation": "Property hooks (custom getters and setters declared with get and set inside a property definition) were introduced in PHP 8.4."} | верно | Property hooks — PHP 8.4 (ноябрь 2024). |
VC-L3 0.83 c | PHP 8.4–8.5 | Asymmetric visibility (public private(set) string $name) appeared in PHP 8.4. | «no» Пояснение: Asymmetric visibility, specifically public readonly, was introduced in PHP 8.3, while public/private(set) syntax for properties was introduced in PHP 8.3 as well (though readonly was 8.1/8.3 depending on interpretation, the specific asymmetric setter visibility feature `public(set)` was added in PHP 8.3).
Raw{"answer": "no", "explanation": "Asymmetric visibility, specifically public readonly, was introduced in PHP 8.3, while public/private(set) syntax for properties was introduced in PHP 8.3 as well (though readonly was 8.1/8.3 depending on interpretation, the specific asymmetric setter visibility feature `public(set)` was added in PHP 8.3)."} | неверно верный: «yes» | Asymmetric visibility v2 — PHP 8.4. |
VC-L4 0.44 c | PHP 8.4–8.5 | In which PHP version was the #[\NoDiscard] attribute introduced? Answer with the version number. | «8.3» Пояснение: The #[\NoDiscard] attribute was introduced in PHP 8.3 to allow developers to flag functions whose return value should not be ignored.
Raw{"answer": 8.3, "explanation": "The #[\\NoDiscard] attribute was introduced in PHP 8.3 to allow developers to flag functions whose return value should not be ignored."} | неверно верный: «8.5» | #[\NoDiscard] — PHP 8.5 (marking return values as important). |
VC-L5 0.25 c | PHP 8.4–8.5 | In which PHP version did the pipe operator |> first appear? Answer with the version number. | «8.1» Пояснение: The pipe operator was introduced in PHP 8.1 as part of the pipeline extension.
Raw{"answer": "8.1", "explanation": "The pipe operator was introduced in PHP 8.1 as part of the pipeline extension."} | неверно верный: «8.5» | Pipe operator — PHP 8.5 (2025). |
VC-L6 0.24 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» Пояснение: The clone-with syntax was introduced in PHP 8.4.
Raw{"answer": 8.4, "explanation": "The clone-with syntax was introduced in PHP 8.4."} | неверно верный: «8.5» | Clone with v2 — PHP 8.5. |
VC-L7 0.23 c | PHP 8.4–8.5 | In which PHP version were the array_first() and array_last() functions introduced? | «8.4» Пояснение: The array_first() and array_last() functions were introduced in PHP 8.4.
Raw{"answer": "8.4", "explanation": "The array_first() and array_last() functions were introduced in PHP 8.4."} | неверно верный: «8.5» | PHP 8.5. |
VC-L8 0.48 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.5» Пояснение: RFC Partial Function Application v2 (also known as the `first_class_callable` or `...` spread for first-class callables) was accepted for PHP 8.5.
Raw{"answer": "8.5", "explanation": "RFC Partial Function Application v2 (also known as the `first_class_callable` or `...` spread for first-class callables) was accepted for PHP 8.5."} | неверно верный: «8.6» | PFA v2 принят 05.12.2025 (33-0-0), реализован в PHP 8.6. |
VF-L1 0.38 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 clamp() function was introduced in PHP 8.4 via RFC clamp_v2.
Raw{ ⏎ "answer": 8.4, ⏎ "explanation": "The clamp() function was introduced in PHP 8.4 via RFC clamp_v2." ⏎ } | неверно верный: «8.6» | По данным владельца (wiki.php.net/rfc): clamp_v2 — 8.6; clamp() в 8.5.11 отсутствует (косвенное подтверждение). Дата-якорь делает клетку монотонной. |
VF-L2 0.62 c | PHP: 8.6+ and the future | RFC Context Managers v2 has already been adopted in PHP (as of 2026-11-07). | «no» Пояснение: As of 2026, Context Managers are still an RFC under discussion and have not yet been adopted as a final feature in PHP; they were notably deferred from PHP 8.3/8.4.
Raw{"answer": "no", "explanation": "As of 2026, Context Managers are still an RFC under discussion and have not yet been adopted as a final feature in PHP; they were notably deferred from PHP 8.3/8.4."} | верно | На 06.11.2026 — в обсуждении (создан 2026-10-23); не принят. |
VF-L3 0.8 c | PHP: 8.6+ and the future | RFC Bound-Erased Generic Types (generics) was declined in 2026. | «yes» Пояснение: The RFC for Bound-Erased Generic Types was voted down (declined) in the PHP 8.5 development cycle (concluded in 2025/2026 timeline), leaving generics for a future iteration.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "The RFC for Bound-Erased Generic Types was voted down (declined) in the PHP 8.5 development cycle (concluded in 2025/2026 timeline), leaving generics for a future iteration." ⏎ } | верно | Голосование завершилось 2026-06-28: отклонён (wiki.php.net/rfc). |
VF-L4 0.53 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» Пояснение: As of 2026-11-07, the RFC to make ZTS (Zend Thread Safety) the default build has not been universally accepted, so the statement is false.
Raw```json ⏎ {"answer": "no", "explanation": "As of 2026-11-07, the RFC to make ZTS (Zend Thread Safety) the default build has not been universally accepted, so the statement is false."} ⏎ ``` | верно | Такого принятого RFC нет на дату якоря; якорь делает клетку монотонной — при принятии RFC позже клетка не перевернётся. |
VF-L5 0.51 c | PHP: 8.6+ and the future | As of PHP 8.5, generics (parameterized types) are still absent. | «yes» Пояснение: As of PHP 8.5, native generics or parameterized types are not a core language feature, relying instead on documentation and third-party tools for type hinting.
Raw{"answer": "yes", "explanation": "As of PHP 8.5, native generics or parameterized types are not a core language feature, relying instead on documentation and third-party tools for type hinting."} | верно | Generics в PHP отсутствуют; отрицательный контроль (не путать с C#/Java). |
VF-L6 2.15 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). | «no» Пояснение: PHP 8.5 was released in November 2025, and PHP 8.6 is scheduled for release in November 2026; however, by the date 2026-11-07, PHP 8.5 is indeed the latest stable version (PHP 8.4 was released in November 2024, PHP 8.5 in November 2025). Wait, the question states 'PHP 8.5... and PHP 8.6 has not been released yet'. If PHP 8.6 is due in Nov 2026, then on Nov 7, 2026, PHP 8.5 is the latest stable. The statement says 'As of 2026-11-07, the latest stable PHP version is 8.5'. This is true. Let me re-read carefully. 'As of 2026-11-07, the latest stable PHP version is 8.5, and PHP 8.6 has not been released yet'. This is True. Wait, did I get the release years right? PHP 8.3 (Nov 2023), 8.4 (Nov 2024), 8.5 (Nov 2025), 8.6 (Nov 2026). So on 2026-11-07, PHP 8.5 (released ~2025-11-21) is the latest stable. PHP 8.6 (due ~2026-11-19) is not yet released. The statement is True.
Raw{"answer": "no", "explanation": "PHP 8.5 was released in November 2025, and PHP 8.6 is scheduled for release in November 2026; however, by the date 2026-11-07, PHP 8.5 is indeed the latest stable version (PHP 8.4 was released in November 2024, PHP 8.5 in November 2025). Wait, the question states 'PHP 8.5... and PHP 8.6 has not been released yet'. If PHP 8.6 is due in Nov 2026, then on Nov 7, 2026, PHP 8.5 is the latest stable. The statement says 'As of 2026-11-07, the latest stable PHP version is 8.5'. This is true. Let me re-read carefully. 'As of 2026-11-07, the latest stable PHP version is 8.5, and PHP 8.6 has not been released yet'. This is True. Wait, did I get the release years right? PHP 8.3 (Nov 2023), 8.4 (Nov 2024), 8.5 (Nov 2025), 8.6 (Nov 2026). So on 2026-11-07, PHP 8.5 (released ~2025-11-21) is the latest stable. PHP 8.6 (due ~2026-11-19) is not yet released. The statement is True."} | неверно верный: «yes» | 8.5 — релиз осени 2025; 8.6 GA 19.11.2026 (wiki.php.net/todo/php86). Дата снимка — 06.11.2026. |
VF-L7 0.39 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 planned but never officially released; the next major version after PHP 5.6 was PHP 7.0.
Raw{"answer": "yes", "explanation": "PHP 6 was planned but never officially released; the next major version after PHP 5.6 was PHP 7.0."} | верно | Исторический факт: ветка 6 не была релизнута. |
VF-L8 0.29 c | PHP: 8.6+ and the future | The RFC adding the #[\Deprecated] attribute to the core was adopted. | «yes» Пояснение: The RFC for the `#[\Deprecated]` attribute was adopted and is part of PHP 8.4.
Raw{"answer": "yes", "explanation": "The RFC for the `#[\\Deprecated]` attribute was adopted and is part of PHP 8.4."} | верно | #[\Deprecated] — принят, реализован в PHP 8.4. |
T25-L1 0.32 c | Clean architecture | The dependency rule of clean and onion architecture: inner layers know nothing about outer ones — dependencies point toward the center. | «yes» Пояснение: Clean and Onion architectures mandate that high-level policies (inner layers) depend on low-level details (outer layers), ensuring dependencies always point inward.
Raw{"answer": "yes", "explanation": "Clean and Onion architectures mandate that high-level policies (inner layers) depend on low-level details (outer layers), ensuring dependencies always point inward."} | верно | Чистая (Robert C. Martin), луковичная (Jeffrey Palermo) и гексагональная (ports & adapters) — варианты одной идеи: зависимости направлены внутрь, к домену. Слоями в проекте следит deptrac. |
T25-L2 0.5 c | Clean architecture | Domain entities import neither Doctrine nor Symfony — only the language and, possibly, the standard library. | «yes» Пояснение: In Domain-Driven Design (DDD), domain entities should remain pure and decoupled from frameworks like Doctrine or Symfony to ensure they are independent, testable, and reusable across different technology stacks.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Domain-Driven Design (DDD), domain entities should remain pure and decoupled from frameworks like Doctrine or Symfony to ensure they are independent, testable, and reusable across different technology stacks." ⏎ } | верно | Изоляция домена от инфраструктуры; deptrac в проекте как раз следит за слоями. |
T25-L3 0.31 c | Clean architecture | Controllers and Twig templates belong to the business-logic layer because they are the ones calling use cases. | «no» Пояснение: Controllers and templates belong to the presentation layer, not the business-logic layer.
Raw```json ⏎ {"answer": "no", "explanation": "Controllers and templates belong to the presentation layer, not the business-logic layer."} ⏎ ``` | верно | Наоборот: это интерфейсные адаптеры (внешний слой); они зависят от use cases, а не наоборот. |
T25-L4 0.41 c | Clean architecture | What sits at the very center of the onion architecture? | «domain» Пояснение: In onion architecture, the innermost layer represents the domain or core business logic, which is independent of external concerns like infrastructure or presentation.
Raw{"answer": "Domain", "explanation": "In onion architecture, the innermost layer represents the domain or core business logic, which is independent of external concerns like infrastructure or presentation."} | неверно верный: «domain model» | Центральное кольцо — Domain Model: сущности и бизнес-правила без зависимостей; далее Domain Services → Application Services → Infrastructure/UI/Tests (Palermo). |
T25-L5 0.39 c | Clean architecture | Layer boundary violations can be caught automatically: a layer-dependency analyzer (e.g. deptrac) fails on a forbidden call. | «yes» Пояснение: Static analysis tools like Deptrac can automatically detect and enforce layer boundary rules, failing the build if forbidden dependencies exist.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Static analysis tools like Deptrac can automatically detect and enforce layer boundary rules, failing the build if forbidden dependencies exist." ⏎ } ⏎ ``` | верно | depfile.yaml в проекте TasK: CI проверяет правила слоёв на каждом пайплайне. |
T25-L6 0.65 c | Clean architecture | A use case (interactor) may accept an HTTP request or an EntityManager as arguments — it is simpler that way. | «no» Пояснение: In Clean Architecture, use cases (interactors) should be framework-agnostic, accepting data transfer objects (DTOs) or input objects, not specific framework types like HTTP requests or EntityManager instances.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In Clean Architecture, use cases (interactors) should be framework-agnostic, accepting data transfer objects (DTOs) or input objects, not specific framework types like HTTP requests or EntityManager instances." ⏎ } ⏎ ``` | верно | Use case принимает DTO и порты; привязка к HTTP/ORM протекает инфраструктуру во внутренние слои. |
T25-L7 0.34 c | Clean architecture | What is the component called that provides a collection of aggregates/entities while hiding the storage mechanism behind an interface? | «repository» Пояснение: The Repository pattern acts as a collection-like interface for domain objects, abstracting the persistence mechanism.
Raw{"answer": "Repository", "explanation": "The Repository pattern acts as a collection-like interface for domain objects, abstracting the persistence mechanism."} | верно | Repository pattern (DDD/Evans); в проекте — Doctrine-репозитории за портами. |
T25-L8 0.46 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 core depends on abstractions (like interfaces), so changing a concrete implementation like the database in the outer layer does not affect the domain or use cases.
Raw{"answer": "yes", "explanation": "In Clean Architecture, the domain core depends on abstractions (like interfaces), so changing a concrete implementation like the database in the outer layer does not affect the domain or use cases."} | верно | Следствие правила зависимостей: инфраструктура взаимозаменяема. |
T26-L1 0.37 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 treated as a single unit for data changes, whereas a database table is a physical storage structure; they are not the same concept.
Raw{"answer": "no", "explanation": "In DDD, an aggregate is a cluster of domain objects treated as a single unit for data changes, whereas a database table is a physical storage structure; they are not the same concept."} | верно | Агрегат — кластер объектов с границей согласованности (транзакционной вокруг корня); таблица — деталь хранения. |
T26-L2 0.32 c | DDD | A Value Object is immutable and compared by the values of its fields, not by identity. | «yes» Пояснение: A Value Object is defined by immutability and equality based on its internal state (values) rather than object identity.
Raw```json ⏎ {"answer": "yes", "explanation": "A Value Object is defined by immutability and equality based on its internal state (values) rather than object identity."} ⏎ ``` | верно | Классика Evans: Money, Email; равенство структурное. |
T26-L3 0.33 c | DDD | What is the single external entry point of an aggregate, through which all changes must go, called? | «aggregate root» Пояснение: In Domain-Driven Design, the Aggregate Root is the single entry point through which all external changes to the aggregate must be made.
Raw{"answer": "Aggregate Root", "explanation": "In Domain-Driven Design, the Aggregate Root is the single entry point through which all external changes to the aggregate must be made."} | верно | Aggregate Root: внешние объекты ссылаются только на корень; он защищает инварианты агрегата. |
T26-L4 0.34 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 aggregate roots to manage the persistence and retrieval of the entire aggregate, ensuring transactional consistency.
Raw{"answer": "yes", "explanation": "In Domain-Driven Design, repositories are defined for aggregate roots to manage the persistence and retrieval of the entire aggregate, ensuring transactional consistency."} | верно | Репозиторий корня хранит границу согласованности агрегата; вложенные сущности доступны только через корень. |
T26-L5 0.31 c | DDD | Ubiquitous language is the model's shared language common to developers and domain experts. | «yes» Пояснение: Ubiquitous Language is a core principle of Domain-Driven Design where the model's language is shared among developers, domain experts, and other stakeholders to ensure consistent understanding.
Raw{"answer": "yes", "explanation": "Ubiquitous Language is a core principle of Domain-Driven Design where the model's language is shared among developers, domain experts, and other stakeholders to ensure consistent understanding."} | верно | Evans: язык из требований переходит в имена классов и методов. |
T26-L6 0.34 c | DDD | What is the boundary called within which a model and its language are consistent, while outside the same words mean other models? | «universe of discourse» Пояснение: In logic and model theory, the set of objects under consideration for a specific model or interpretation is called the universe of discourse.
Raw{"answer": "universe of discourse", "explanation": "In logic and model theory, the set of objects under consideration for a specific model or interpretation is called the universe of discourse."} | неверно верный: «bounded context» | Bounded Context; «Заказ» в биллинге и в доставке — разные модели. |
T26-L7 0.52 c | DDD | An anemic model (objects with only getters/setters, logic in services) is the recommended DDD style. | «no» Пояснение: Anemic domain models are actually the anti-pattern that DDD seeks to avoid, as they lead to business logic being spread across services rather than encapsulated in rich domain objects.
Raw```json ⏎ {"answer": "no", "explanation": "Anemic domain models are actually the anti-pattern that DDD seeks to avoid, as they lead to business logic being spread across services rather than encapsulated in rich domain objects."} ⏎ ``` | верно | Наоборот: Evans называет анемичность антипаттерном — поведение должно жить в доменных объектах. |
T26-L8 0.6 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 boundaries within which a domain model is valid, allowing the same real-world concept to be modeled differently (as distinct classes or structures) in different contexts to fit their specific needs.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "In Domain-Driven Design, a Bounded Context defines the boundaries within which a domain model is valid, allowing the same real-world concept to be modeled differently (as distinct classes or structures) in different contexts to fit their specific needs." ⏎ } | верно | Модели контекстов независимы; между ними — явная интеграция (ACL, published language). |
T13-L1 0.37 c | Symfony | Services in the Symfony DI container are created lazily by default — on first use. | «yes» Пояснение: Services in the Symfony DI container are lazy-loaded by default, meaning they are instantiated only when first accessed.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Services in the Symfony DI container are lazy-loaded by default, meaning they are instantiated only when first accessed." ⏎ } ⏎ ``` | верно | Контейнер инстанцирует сервис при первом извлечении; eager-создания по умолчанию нет. |
T13-L2 0.31 c | Symfony | Which Symfony console command lists all registered routes? | «php bin/console debug:router» Пояснение: The debug:router command displays all registered routes in a Symfony console.
Raw{ ⏎ "answer": "php bin/console debug:router", ⏎ "explanation": "The debug:router command displays all registered routes in a Symfony console." ⏎ } | верно | bin/console debug:router (FrameworkBundle); в Symfony 3 команда называлась router:debug. |
T13-L3 0.35 c | Symfony | Symfony autowiring requires manually declaring every service in services.yaml. | «no» Пояснение: Symfony's autowiring feature automatically resolves service dependencies based on type hints, eliminating the need to manually declare every service in the configuration file.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Symfony's autowiring feature automatically resolves service dependencies based on type hints, eliminating the need to manually declare every service in the configuration file." ⏎ } | верно | Autowire+autoconfigure регистрируют и связывают сервисы автоматически; ручное перечисление — исключение. |
T13-L4 0.27 c | Symfony | Twig templates are compiled into PHP classes and cached between requests. | «yes» Пояснение: Twig compiles templates into optimized PHP classes and caches them to improve performance on subsequent requests.
Raw{"answer": "yes", "explanation": "Twig compiles templates into optimized PHP classes and caches them to improve performance on subsequent requests."} | верно | 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 Symfony's dev environment, the Dependency Injection container is compiled and cached; it is only rebuilt when tracked files (such as services or configuration) change, not on every single request.
Raw{"answer": "yes", "explanation": "In Symfony's dev environment, the Dependency Injection container is compiled and cached; it is only rebuilt when tracked files (such as services or configuration) change, not on every single request."} | верно | Kernel проверяет freshness ресурсов (конфиги, классы); иначе переиспользуется кэш контейнера. |
T13-L6 0.28 c | Symfony | Which environment variable selects the active Symfony environment (dev/prod)? | «app_env» Пояснение: The APP_ENV environment variable is used by Symfony to determine the active runtime environment (e.g., dev, prod, test).
Raw{"answer": "APP_ENV", "explanation": "The APP_ENV environment variable is used by Symfony to determine the active runtime environment (e.g., dev, prod, test)."} | верно | APP_ENV в .env; APP_DEBUG — отдельный флаг отладки. |
T13-L7 0.34 c | Symfony | A controller method can be private — Symfony routing works with any method of the class. | «no» Пояснение: Symfony controller methods called via routing must be public, as the framework instantiates the controller and calls the action method externally.
Raw{"answer": "no", "explanation": "Symfony controller methods called via routing must be public, as the framework instantiates the controller and calls the action method externally."} | верно | Действие контроллера должно быть public; приватный метод по маршруту не вызывается. |
T13-L8 0.66 c | Symfony | Event subscribers always receive events before listeners, because the interface gives them priority. | «no» Пояснение: In Symfony's EventDispatcher, the order depends on the `priority` value set by the developer (or defaults to 0); higher priority runs first, and there is no inherent priority difference between the interfaces `EventSubscriberInterface` and `ListenerInterface`.
Raw{"answer": "no", "explanation": "In Symfony's EventDispatcher, the order depends on the `priority` value set by the developer (or defaults to 0); higher priority runs first, and there is no inherent priority difference between the interfaces `EventSubscriberInterface` and `ListenerInterface`."} | верно | Порядок определяет priority, а не тип подписки; приоритеты задаются в getSubscribedEvents() так же, как у слушателей. |
T22-L1 1.61 c | Symfony: Security and forms | In modern Symfony (6.0+) authentication is built on authenticator classes (AuthenticatorInterface); the old guard system has been removed. | «no» Пояснение: While the legacy `guard` authentication system was removed in Symfony 5.0 (and is not available in 6.0+), modern Symfony 6.0+ authentication is built around `AuthenticatorInterface` implementations, not just classes implementing that interface alone; the statement implies a specific architectural shift that is largely true, but technically, authenticators must implement `AuthenticatorInterface`, so the core claim is correct. However, the question asks if the old guard system has been removed and authentication is built on authenticator classes implementing AuthenticatorInterface. This is factually true for Symfony 6.0+. Wait, let me re-read. 'In modern Symfony (6.0+) authentication is built on authenticator classes (AuthenticatorInterface); the old guard system has been removed.' This is a true statement. Guard was removed in 5.0. So for 6.0+, it is true.
Raw{"answer": "no", "explanation": "While the legacy `guard` authentication system was removed in Symfony 5.0 (and is not available in 6.0+), modern Symfony 6.0+ authentication is built around `AuthenticatorInterface` implementations, not just classes implementing that interface alone; the statement implies a specific architectural shift that is largely true, but technically, authenticators must implement `AuthenticatorInterface`, so the core claim is correct. However, the question asks if the old guard system has been removed and authentication is built on authenticator classes implementing AuthenticatorInterface. This is factually true for Symfony 6.0+. Wait, let me re-read. 'In modern Symfony (6.0+) authentication is built on authenticator classes (AuthenticatorInterface); the old guard system has been removed.' This is a true statement. Guard was removed in 5.0. So for 6.0+, it is true."} | неверно верный: «yes» | Guard объявлен устаревшим в 5.3 и удалён в 6.0; в проекте symfony/security-bundle 8.1. |
T22-L2 0.39 c | Symfony: Security and forms | Which Symfony attribute checks a role/permission right on a controller method (403 without it)? | «isgranted» Пояснение: The #[IsGranted] attribute is used in Symfony to check if a user has a specific role or permission, returning a 403 Forbidden status if they do not.
Raw{"answer": "IsGranted", "explanation": "The #[IsGranted] attribute is used in Symfony to check if a user has a specific role or permission, returning a 403 Forbidden status if they do not."} | верно | #[IsGranted('ROLE_ADMIN')]; атрибут из symfony/security-http. |
T22-L3 0.39 c | Symfony: Security and forms | Voters are Symfony's mechanism for checking access to a specific object: isGranted('EDIT', $post). | «yes» Пояснение: Voters in Symfony are designed to encapsulate authorization logic and check access to specific objects or resources.
Raw```json ⏎ {"answer": "yes", "explanation": "Voters in Symfony are designed to encapsulate authorization logic and check access to specific objects or resources."} ⏎ ``` | верно | VoterInterface->vote(); docs Symfony — Voters. |
T22-L4 0.62 c | Symfony: Security and forms | In modern Symfony (7+) validation constraints are declared as PHP attributes (#[Assert\NotBlank]); doctrine annotations are no longer supported. | «yes» Пояснение: Modern Symfony versions (5.3+) support PHP attributes for validation constraints, and Doctrine Annotations (which required separate metadata driver configuration) have indeed been deprecated in favor of the PHP Attributes metadata driver.
Raw```json ⏎ {"answer": "yes", "explanation": "Modern Symfony versions (5.3+) support PHP attributes for validation constraints, and Doctrine Annotations (which required separate metadata driver configuration) have indeed been deprecated in favor of the PHP Attributes metadata driver."} ⏎ ``` | верно | Докблок-аннотации удалены в Symfony 7.0; стандарт — атрибуты. В проекте symfony/validator 8.1. |
T22-L5 0.35 c | Symfony: Security and forms | CSRF protection of Symfony forms is enabled by default: the form validates the token on submission. | «yes» Пояснение: Symfony forms include CSRF protection by default and validate the token during submission to prevent Cross-Site Request Forgery attacks.
Raw{"answer": "yes", "explanation": "Symfony forms include CSRF protection by default and validate the token during submission to prevent Cross-Site Request Forgery attacks."} | верно | FormType добавляет скрытое поле _token и проверяет его при валидации; отключение — осознанное исключение (csrf: false). |
T22-L6 0.39 c | Symfony: Security and forms | Form validation in Symfony runs server-side even if the client-side (HTML5) checks passed. | «yes» Пояснение: Server-side validation in Symfony is independent and must run regardless of client-side HTML5 validation results.
Raw{"answer": "yes", "explanation": "Server-side validation in Symfony is independent and must run regardless of client-side HTML5 validation results."} | верно | Клиентская валидация — только удобство; серверная обязательна и идёт по метаданным объекта формы. |
T22-L7 0.32 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 class (FormType).
Raw{"answer": "make:form", "explanation": "The Symfony MakerBundle command `make:form` is used to generate a new form class (FormType)."} | верно | bin/console make:form (symfony/maker-bundle — в проекте). |
T22-L8 0.39 c | Symfony: Security and forms | Symfony stores the user's password in the session in plain text. | «no» Пояснение: Symfony typically stores the user identifier (or the entire user object with hashed password) in the session, not the plain text password itself.
Raw{"answer": "no", "explanation": "Symfony typically stores the user identifier (or the entire user object with hashed password) in the session, not the plain text password itself."} | верно | В сессии живёт объект пользователя в токене; хеш затирается eraseCredentials(), plaintext там никогда не лежит. |
T23-L1 0.49 c | Symfony: configuration and services | Symfony bundle configuration lives in config/packages — one file per bundle or topic. | «yes» Пояснение: In modern Symfony (4.1+), the recommended structure places bundle configuration files in the config/packages directory, typically using one file per bundle or logical topic for better organization.
Raw{"answer": "yes", "explanation": "In modern Symfony (4.1+), the recommended structure places bundle configuration files in the config/packages directory, typically using one file per bundle or logical topic for better organization."} | верно | Стандартная структура (config/packages/*.yaml); перегрузка — config/packages/<env>. |
T23-L2 0.4 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» Пояснение: This is a common best practice where .env contains safe default configuration values and is committed, while .env.local contains sensitive data and is ignored by version control.
Raw{"answer": "yes", "explanation": "This is a common best practice where .env contains safe default configuration values and is committed, while .env.local contains sensitive data and is ignored by version control."} | верно | symfony/dotenv: .env — общий безопасный набор значений; локальные секреты — .env.local (gitignored) или secrets-хранилище. |
T23-L3 0.35 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 to inspect the service container, list services, and view aliases.
Raw{"answer": "debug:container", "explanation": "The `bin/console debug:container` command is used to inspect the service container, list services, and view aliases."} | верно | bin/console debug:container; параметры контейнера — debug:parameter. |
T23-L4 0.6 c | Symfony: configuration and services | The Symfony container allows changing parameters at runtime: $container->setParameter() works from a controller. | «no» Пояснение: In Symfony, the container is immutable by design; parameters should not be changed at runtime, and setParameter is generally deprecated or only for specific internal uses, not for dynamic controller-level changes.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "In Symfony, the container is immutable by design; parameters should not be changed at runtime, and setParameter is generally deprecated or only for specific internal uses, not for dynamic controller-level changes." ⏎ } | верно | Контейнер компилируется и замораживается; runtime-значения — только через переменные окружения. |
T23-L5 0.47 c | Symfony: configuration and services | By default, Symfony services are public (public: true) — you can fetch them directly from the container. | «no» Пояснение: In modern Symfony versions (3.3+), services are private by default to allow for container optimization; they must be explicitly marked as public to be fetched from the container.
Raw{"answer": "no", "explanation": "In modern Symfony versions (3.3+), services are private by default to allow for container optimization; they must be explicitly marked as public to be fetched from the container."} | верно | С Symfony 4.0 сервисы по умолчанию private: инжектятся через autowiring; $container->get() — только для публичных. |
T23-L6 0.36 c | Symfony: configuration and services | Without a config file in config/packages a bundle will not work — configuration is mandatory for every bundle. | «no» Пояснение: In Symfony, a bundle can work without a configuration file if it does not require any custom settings or if it provides default settings that are sufficient.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "In Symfony, a bundle can work without a configuration file if it does not require any custom settings or if it provides default settings that are sufficient." ⏎ } ⏎ ``` | верно | У бандлов есть встроенные умолчания (Extension); конфиг нужен только для отклонений от них. |
T23-L7 0.33 c | Symfony: configuration and services | Environment variable values are injected into services.yaml using the %env(VAR)% syntax. | «yes» Пояснение: In Symfony's services.yaml, environment variables are referenced using the %env(VAR)% syntax.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In Symfony's services.yaml, environment variables are referenced using the %env(VAR)% syntax." ⏎ } ⏎ ``` | верно | %env(...)% резолвится в рантайме env-процессорами; docs — Env Var Processors. |
T23-L8 0.29 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 in Symfony controls whether the application is in debug mode, which enables the profiler and Twig debugging.
Raw{"answer": "APP_DEBUG", "explanation": "The APP_DEBUG environment variable in Symfony controls whether the application is in debug mode, which enables the profiler and Twig debugging."} | верно | APP_DEBUG=1 (в .env dev-окружения); окружение выбирает APP_ENV — см. T13-L6. |
T16-L1 0.37 c | Symfony: Messenger | A single message in Symfony Messenger can only have one handler. | «no» Пояснение: A single message can be handled by multiple handlers if they are configured to process the same message in a pipeline or through multiple subscriptions.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "A single message can be handled by multiple handlers if they are configured to process the same message in a pipeline or through multiple subscriptions." ⏎ } | верно | Messenger вызывает все хендлеры, подписанные на класс сообщения (docs — Multiple Handlers). |
T16-L2 0.33 c | Symfony: Messenger | The sync transport in Messenger queues the message for a worker, just like async. | «no» Пояснение: The sync transport processes the message immediately within the current request context without queueing it for a worker, unlike the async transport.
Raw{"answer": "no", "explanation": "The sync transport processes the message immediately within the current request context without queueing it for a worker, unlike the async transport."} | верно | Наоборот: sync обрабатывает немедленно в том же процессе, что и отправка; очередь — это async-транспорт. |
T16-L3 0.31 c | Symfony: Messenger | Which console command starts the worker that processes Messenger queue messages? | «messenger:consume» Пояснение: The command to start a worker for processing Symfony Messenger queues is 'messenger:consume'.
Raw{"answer": "messenger:consume", "explanation": "The command to start a worker for processing Symfony Messenger queues is 'messenger:consume'."} | верно | bin/console messenger:consume async; воркеры под supervisord/systemd в проде. |
T16-L4 0.45 c | Symfony: Messenger | Retries for failed messages (retry_strategy) are configured per Messenger transport. | «yes» Пояснение: In Symfony Messenger, the retry strategy is defined in the transport configuration (e.g., yaml or env vars) and is applied to each specific transport.
Raw{"answer": "yes", "explanation": "In Symfony Messenger, the retry strategy is defined in the transport configuration (e.g., yaml or env vars) and is applied to each specific transport."} | верно | 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» Пояснение: Symfony Messenger defaults to using the Serializer with the JSON encoder for message serialization unless a different serializer or encoder is explicitly configured.
Raw{"answer": "yes", "explanation": "Symfony Messenger defaults to using the Serializer with the JSON encoder for message serialization unless a different serializer or encoder is explicitly configured."} | неверно верный: «no» | Дефолтный сериализатор — PhpSerializer (serialize()); JSON-сериализатор включается отдельно. |
T16-L6 0.43 c | Symfony: Messenger | Symfony Scheduler produces messages on a schedule and dispatches them through Messenger. | «no» Пояснение: The Symfony Scheduler component defines schedules and executes tasks directly; it does not inherently produce messages for the Messenger component, though they can be integrated.
Raw{"answer": "no", "explanation": "The Symfony Scheduler component defines schedules and executes tasks directly; it does not inherently produce messages for the Messenger component, though they can be integrated."} | неверно верный: «yes» | Schedule → RecurringMessage → шина Messenger; docs — Scheduler. |
T16-L7 0.27 c | Symfony: Messenger | Which built-in Messenger transport stores messages in database tables via Doctrine? | «doctrine» Пояснение: The Doctrine transport in Symfony Messenger uses Doctrine DBAL to store messages in database tables.
Raw{"answer": "doctrine", "explanation": "The Doctrine transport in Symfony Messenger uses Doctrine DBAL to store messages in database tables."} | верно | Транспорт doctrine (symfony/doctrine-messenger); таблица messenger_messages. В проекте стоит amqp-messenger + doctrine-messenger. |
T16-L8 0.38 c | Symfony: Messenger | The Messenger pipeline can be extended with custom middleware, placed before or after the built-in ones. | «yes» Пояснение: Laravel's pipeline system allows developers to add custom middleware steps before, after, or interspersed with existing ones.
Raw{"answer": "yes", "explanation": "Laravel's pipeline system allows developers to add custom middleware steps before, after, or interspersed with existing ones."} | верно | messenger.bus.*.middleware в yaml; docs — Middleware. |
T28-L1 0.3 c | Symfony: versions | Symfony major releases come every two years, minor ones every six months (in May and November). | «yes» Пояснение: Symfony major versions are released every two years (odd years) and minor versions are released every six months (May and November).
Raw{"answer": "yes", "explanation": "Symfony major versions are released every two years (odd years) and minor versions are released every six months (May and November)."} | верно | Стандартный релизный цикл: 8.0 — ноябрь 2025, 8.1 — май 2026, 8.2 — ноябрь 2026. |
T28-L2 0.26 c | Symfony: versions | What is the minimum PHP version required by Symfony 8? | «8.2» Пояснение: Symfony 8 requires PHP 8.2 or later.
Raw{"answer": 8.2, "explanation": "Symfony 8 requires PHP 8.2 or later."} | неверно верный: «8.4» | 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 legacy docblock annotations (like `@Route`, `@Assert`) and requires PHP 8 attributes instead.
Raw{"answer": "no", "explanation": "Symfony 7.0 removed support for legacy docblock annotations (like `@Route`, `@Assert`) and requires PHP 8 attributes instead."} | верно | Наоборот: в 7.0 аннотации удалены — только PHP-атрибуты (#[Route], #[Assert\NotBlank]). |
T28-L4 0.42 c | Symfony: versions | AssetMapper manages CSS/JS without node or webpack — via importmap.php. | «yes» Пояснение: Symfony's AssetMapper is designed to manage frontend assets using only PHP (via importmap.php and composer/npm dependencies) without requiring build tools like Webpack or Node.js.
Raw{"answer": "yes", "explanation": "Symfony's AssetMapper is designed to manage frontend assets using only PHP (via importmap.php and composer/npm dependencies) without requiring build tools like Webpack or Node.js."} | верно | symfony/asset-mapper (с 6.3, стандарт с 7.x); в проекте — importmap.php в корне и asset-mapper 8.1. |
T28-L5 0.35 c | Symfony: versions | Symfony 6.4 is a regular release without long-term support. | «no» Пояснение: Symfony 6.4 is a Long-Term Support (LTS) release, whereas 6.3, 6.1, etc., are regular releases without LTS.
Raw{"answer": "no", "explanation": "Symfony 6.4 is a Long-Term Support (LTS) release, whereas 6.3, 6.1, etc., are regular releases without LTS."} | верно | Наоборот: 6.4 — LTS (расширенная поддержка); LTS выходит вместе с очередным мажором (6.4 — вместе с 7.0). |
T28-L6 0.4 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» Пояснение: Deprecated features are removed in major releases to keep the codebase clean and adhere to SemVer, as major versions introduce breaking changes.
Raw{"answer": "no", "explanation": "Deprecated features are removed in major releases to keep the codebase clean and adhere to SemVer, as major versions introduce breaking changes."} | верно | Наоборот: мажорный релиз удаляет всё устаревшее (7.0 убрал деприкейшены 6.x, 8.0 — 7.x). |
T28-L7 0.36 c | Symfony: versions | Every Symfony major release is accompanied by an UPGRADE guide listing the changes. | «yes» Пояснение: Symfony major releases always include an UPGRADE guide in the repository to help developers transition to the new version.
Raw```json ⏎ {"answer": "yes", "explanation": "Symfony major releases always include an UPGRADE guide in the repository to help developers transition to the new version."} ⏎ ``` | верно | UPGRADE-7.0.md, UPGRADE-8.0.md в репозитории symfony/symfony. |
T28-L8 0.29 c | Symfony: versions | Which Symfony component manages assets and the importmap without node/webpack? | «assetmapper» Пояснение: The AssetMapper component in Symfony is designed to manage assets and the import map without requiring Node.js or Webpack.
Raw{"answer": "AssetMapper", "explanation": "The AssetMapper component in Symfony is designed to manage assets and the import map without requiring Node.js or Webpack."} | верно | symfony/asset-mapper 8.1 — в проекте. |
T29-L1 0.4 c | Symfony: 8.2 and beyond | As of 2026-11-07, Symfony 8.2 has already been released. | «yes» Пояснение: Symfony major versions typically release annually in November (e.g., 8.0 in 2025), so 8.2 would have been released by late 2026.
Raw{"answer": "yes", "explanation": "Symfony major versions typically release annually in November (e.g., 8.0 in 2025), so 8.2 would have been released by late 2026."} | неверно верный: «no» | Наоборот: 8.2 ещё не выпущена — релиз в конце ноября 2026; последняя стабильная — 8.1. |
T29-L2 4.91 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. | «yes» Пояснение: Symfony follows a 6-month LTS release cycle (November and May), so if 8.2 is a minor release following a previous major/minor, November 2026 is a valid slot in that sequence (e.g., 7.3 in Nov 2025, 7.4 in May 2026, 8.0 in Nov 2026? No, usually minor increments. Actually, Symfony releases are often aligned to months. Let's look at the pattern: Symfony 6.4 (Nov 2023), 7.0 (Nov 2023), 7.1 (May 2024), 7.2 (Nov 2024). So Nov 2026 would be 7.4 or 8.0 depending on versioning. If 8.0 is Nov 2026, then 8.2 would be Nov 2027. However, the statement says 'Symfony 8.2 is scheduled for November 2026'. Let's re-evaluate standard Symfony release dates. Major versions are released in May and November. 6.3 (May 2023), 6.4 (Nov 2023). 7.0 (Nov 2023), 7.1 (May 2024), 7.2 (Nov 2024), 7.3 (May 2025), 7.4 (Nov 2025), 8.0 (Nov 2026)? Or is it 7.5 (May 2026), 8.0 (Nov 2026)? Usually, a new major version (X.0) is released in November after the previous major's last minor. If 7.0 was Nov 2023, 8.0 is likely Nov 2026. 8.1 would be May 2027. 8.2 would be Nov 2027. So saying 8.2 is Nov 2026 seems false. BUT, wait. Symfony 7.0 was released in November 2023. The next minor is 7.1 in May 2024. 7.2 in Nov 2024. 7.3 in May 2025. 7.4 in Nov 2025. 8.0 in Nov 2026? No, usually there is a buffer. Let's check actual roadmap if possible or standard logic. Standard: 6.0 (Nov 2022), 6.1 (May 2023), 6.2 (Nov 2023), 6.3 (May 2024)? No, 6.3 was May 2023? No, 6.3 was May 2023, 6.4 Nov 2023. 7.0 Nov 2023. 7.1 May 2024. 7.2 Nov 2024. 7.3 May 2025. 7.4 Nov 2025. 8.0 Nov 2026. So 8.2 would be Nov 2027. The statement says 8.2 is Nov 2026. This is likely false.
Raw{"answer": "yes", "explanation": "Symfony follows a 6-month LTS release cycle (November and May), so if 8.2 is a minor release following a previous major/minor, November 2026 is a valid slot in that sequence (e.g., 7.3 in Nov 2025, 7.4 in May 2026, 8.0 in Nov 2026? No, usually minor increments. Actually, Symfony releases are often aligned to months. Let's look at the pattern: Symfony 6.4 (Nov 2023), 7.0 (Nov 2023), 7.1 (May 2024), 7.2 (Nov 2024). So Nov 2026 would be 7.4 or 8.0 depending on versioning. If 8.0 is Nov 2026, then 8.2 would be Nov 2027. However, the statement says 'Symfony 8.2 is scheduled for November 2026'. Let's re-evaluate standard Symfony release dates. Major versions are released in May and November. 6.3 (May 2023), 6.4 (Nov 2023). 7.0 (Nov 2023), 7.1 (May 2024), 7.2 (Nov 2024), 7.3 (May 2025), 7.4 (Nov 2025), 8.0 (Nov 2026)? Or is it 7.5 (May 2026), 8.0 (Nov 2026)? Usually, a new major version (X.0) is released in November after the previous major's last minor. If 7.0 was Nov 2023, 8.0 is likely Nov 2026. 8.1 would be May 2027. 8.2 would be Nov 2027. So saying 8.2 is Nov 2026 seems false. BUT, wait. Symfony 7.0 was released in November 2023. The next minor is 7.1 in May 2024. 7.2 in Nov 2024. 7.3 in May 2025. 7.4 in Nov 2025. 8.0 in Nov 2026? No, usually there is a buffer. Let's check actual roadmap if possible or standard logic. Standard: 6.0 (Nov 2022), 6.1 (May 2023), 6.2 (Nov 2023), 6.3 (May 2024)? No, 6.3 was May 2023? No, 6.3 was May 2023, 6.4 Nov 2023. 7.0 Nov 2023. 7.1 May 2024. 7.2 Nov 2024. 7.3 May 2025. 7.4 Nov 2025. 8.0 Nov 2026. So 8.2 would be Nov 2027. The statement says 8.2 is Nov 2026. This is likely false."} | верно | Политика релизов: 8.1 — май 2026, 8.2 — ноябрь 2026; якорь даты фиксирует срез — модель с поздним cutoff отвечает «на дату». |
T29-L3 0.35 c | Symfony: 8.2 and beyond | Which Symfony version comes after 8.1 (as of 2026-11-07)? | «8.2» Пояснение: Symfony releases minor versions sequentially, so the version following 8.1 is 8.2.
Raw{ ⏎ "answer": "8.2", ⏎ "explanation": "Symfony releases minor versions sequentially, so the version following 8.1 is 8.2." ⏎ } | верно | 8.2 — следующий минорный релиз (ноябрь 2026); после его выхода проект переходит с 8.1.* на 8.2.*. |
T29-L4 0.62 c | Symfony: 8.2 and beyond | Symfony 8.2 is a major release requiring applications to be rewritten for new APIs. | «no» Пояснение: Symfony follows semantic versioning where major versions (like 6, 7, 8) introduce breaking changes, but version 8.2 would be a minor update within the 8.x line, which typically only contains bug fixes and new features without requiring rewrites.
Raw{"answer": "no", "explanation": "Symfony follows semantic versioning where major versions (like 6, 7, 8) introduce breaking changes, but version 8.2 would be a minor update within the 8.x line, which typically only contains bug fixes and new features without requiring rewrites."} | верно | Наоборот: 8.2 — минорный релиз; новые возможности без поломки обратной совместимости. Мажор — 9.0. |
T29-L5 0.41 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 semantic versioning where minor version updates (e.g., 8.1 to 8.2) guarantee backward compatibility, meaning existing code should work without modifications.
Raw{"answer": "yes", "explanation": "PHP follows semantic versioning where minor version updates (e.g., 8.1 to 8.2) guarantee backward compatibility, meaning existing code should work without modifications."} | верно | Политика Symfony: минорные релизы обратно совместимы; BC-break допустим только в мажорных. |
T29-L6 0.46 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 major.minor versioning scheme where the 8.x line concludes with 8.3 before the release of Symfony 9.0.
Raw{"answer": "8.3", "explanation": "Symfony follows a major.minor versioning scheme where the 8.x line concludes with 8.3 before the release of Symfony 9.0."} | неверно верный: «8.4» | По циклу: 8.2 (ноя 2026), 8.3 (май 2027), 8.4 (ноя 2027, вместе с 9.0) — как 6.4 выходила вместе с 7.0. |
T29-L7 0.52 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 8.x is scheduled to require PHP 8.3 as a minimum, not PHP 8.5, as Symfony typically targets stable, widely adopted PHP versions.
Raw{"answer": "no", "explanation": "Symfony 8.x is scheduled to require PHP 8.3 as a minimum, not PHP 8.5, as Symfony typically targets stable, widely adopted PHP versions."} | верно | Наоборот: минорные релизы не поднимают требования PHP; для всей ветки 8.x остаётся PHP >= 8.4. |
T29-L8 0.34 c | Symfony: 8.2 and beyond | Deprecations added in the 8.x branch will not be removed before Symfony 9.0. | «yes» Пояснение: Symfony deprecations must be kept for at least one major version, so those added in 8.x will remain until 9.0.
Raw{"answer": "yes", "explanation": "Symfony deprecations must be kept for at least one major version, so those added in 8.x will remain until 9.0."} | верно | Политика: деприкейшены живут до следующего мажора; 9.0 — ноябрь 2027. |
T21-L1 0.39 c | Twig | Inside {{ }}, Twig allows calling arbitrary PHP code directly. | «no» Пояснение: Twig is a sandboxed template engine that restricts direct access to arbitrary PHP code within {{ }}, unlike some other template engines.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Twig is a sandboxed template engine that restricts direct access to arbitrary PHP code within {{ }}, unlike some other template engines." ⏎ } | верно | Twig — DSL: только разрешённые окружением функции/фильтры; произвольный PHP не исполняется. |
T21-L2 0.29 c | Twig | By default, Twig auto-escapes printed variables. | «yes» Пояснение: Twig automatically escapes printed variables to prevent issues like XSS by default.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Twig automatically escapes printed variables to prevent issues like XSS by default." ⏎ } ⏎ ``` | верно | Autoescape включён по умолчанию; {{ '<b>' }} → <b>. Проверено на Twig 3.30. |
T21-L3 0.35 c | Twig | The Twig |e filter escapes a string for safe output in an HTML context. | «yes» Пояснение: The 'e' filter in Twig is an alias for 'escape' and defaults to escaping for the HTML context.
Raw{"answer": "yes", "explanation": "The 'e' filter in Twig is an alias for 'escape' and defaults to escaping for the HTML context."} | верно | |e ('html') по умолчанию; есть контексты js/url/css. От SQL-инъекций он не защищает — это задача подготовленных запросов Doctrine. |
T21-L4 0.27 c | Twig | Which filter from twig/intl-extra formats a number according to a locale? | «number_format» Пояснение: The `number_format` filter in the twig/intl-extra extension formats numbers according to the specified locale.
Raw{"answer": "number_format", "explanation": "The `number_format` filter in the twig/intl-extra extension formats numbers according to the specified locale."} | неверно верный: «format_number» | |format_number(locale=...) из IntlExtension (twig/intl-extra есть в проекте). Проверено на Twig 3.30: 12345.6 → 12 345,6 (ru). |
T21-L5 0.35 c | Twig | The |raw filter disables auto-escaping for the value. | «yes» Пояснение: The raw filter in template engines like Twig or Blade marks a value as safe, bypassing the default auto-escaping mechanism.
Raw{"answer": "yes", "explanation": "The raw filter in template engines like Twig or Blade marks a value as safe, bypassing the default auto-escaping mechanism."} | верно | {{ x|raw }} выводит HTML как есть; опасно с пользовательскими данными. Проверено на Twig 3.30. |
T21-L6 0.29 c | Twig | In Twig, {{ }} prints an expression value, while {% %} executes tags — conditions, loops, set. | «yes» Пояснение: In Twig, {{ }} is used for outputting variable values, while {% %} is used for control structures like loops and conditions.
Raw{"answer": "yes", "explanation": "In Twig, {{ }} is used for outputting variable values, while {% %} is used for control structures like loops and conditions."} | верно | Два блока синтаксиса Twig: вывод (echo) против логики. |
T21-L7 0.34 c | Twig | In Twig you cannot declare a variable inside a template — values only come from the controller. | «no» Пояснение: Twig allows variable declaration and manipulation within templates using tags like {% set %}.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Twig allows variable declaration and manipulation within templates using tags like {% set %}." ⏎ } | верно | {% set y = ... %} объявляет переменную в шаблоне. Проверено на Twig 3.30. |
T21-L8 0.31 c | Twig | Which Twig function dumps the debug structure of a variable (array, object)? | «dump» Пояснение: The dump function in Twig outputs a debug structure of a variable, similar to var_dump in PHP.
Raw{"answer": "dump", "explanation": "The dump function in Twig outputs a debug structure of a variable, similar to var_dump in PHP."} | верно | {{ dump(x) }} (DebugExtension; в Symfony доступна в dev-окружении). |
T24-L1 0.46 c | Bootstrap | Bootstrap is a CSS/JS library of ready-made UI components, not an SPA framework. | «yes» Пояснение: Bootstrap is a front-end framework consisting of HTML, CSS, and JavaScript templates for common UI components, but it is not a Single Page Application (SPA) framework like Angular, React, or Vue.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "Bootstrap is a front-end framework consisting of HTML, CSS, and JavaScript templates for common UI components, but it is not a Single Page Application (SPA) framework like Angular, React, or Vue." ⏎ } | верно | Компоненты и утилиты поверх вашего HTML; SPA-фреймворки (React/Vue) — другой класс инструментов. В проекте vendored 5.3.3. |
T24-L2 0.44 c | Bootstrap | Which Bootstrap class gives a responsive container with a fixed max width per breakpoint? | «container» Пояснение: In Bootstrap, the 'container' class provides a responsive fixed-width container that changes its max-width at defined breakpoints, while 'container-fluid' is full-width.
Raw{"answer": "container", "explanation": "In Bootstrap, the 'container' class provides a responsive fixed-width container that changes its max-width at defined breakpoints, while 'container-fluid' is full-width."} | верно | .container (фиксированная макс-ширина по брейкпоинтам) vs .container-fluid (на всю ширину). |
T24-L3 0.37 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 (or grid) and splits a row into 12 columns.
Raw```json ⏎ {"answer": "no", "explanation": "The Bootstrap grid is built on CSS flexbox (or grid) and splits a row into 12 columns."} ⏎ ``` | верно | Наоборот: flexbox (с Bootstrap 4) и 12 колонок; float-сетка — это Bootstrap 3. |
T24-L4 1.08 c | Bootstrap | Bootstrap's named breakpoints (the infix used in class names) are sm, md, lg, xl, xxl — five of them. | «no» Пояснение: Bootstrap 4+ actually defines these breakpoints (sm, md, lg, xl, xxl), but it also includes 'xs' implicitly via the base (no prefix) and the question is about 5 named infixes - actually Bootstrap 5 has exactly these 5 named breakpoints (sm, md, lg, xl, xxl) so this might be true. Wait, Bootstrap defines exactly 5 named breakpoints: sm, md, lg, xl, xxl - this is TRUE for Bootstrap 5.
Raw```json ⏎ {"answer": "no", "explanation": "Bootstrap 4+ actually defines these breakpoints (sm, md, lg, xl, xxl), but it also includes 'xs' implicitly via the base (no prefix) and the question is about 5 named infixes - actually Bootstrap 5 has exactly these 5 named breakpoints (sm, md, lg, xl, xxl) so this might be true. Wait, Bootstrap defines exactly 5 named breakpoints: sm, md, lg, xl, xxl - this is TRUE for Bootstrap 5."} ⏎ ``` | неверно верный: «yes» | Тиров всего шесть: xs (без инфикса) + пять именованных (576/768/992/1200/1400 px). |
T24-L5 0.43 c | Bootstrap | Utilities like .mt-3 or .px-2 use the spacing scale: the number is a multiple of $spacer. | «yes» Пояснение: Bootstrap utility classes for margin and padding (e.g., .mt-3, .px-2) derive their values by multiplying the base $spacer variable by the numeric suffix.
Raw{"answer": "yes", "explanation": "Bootstrap utility classes for margin and padding (e.g., .mt-3, .px-2) derive their values by multiplying the base $spacer variable by the numeric suffix."} | неверно верный: «no» | Spacing utilities; $spacer = 1rem. |
T24-L6 0.39 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 interactive components like dropdowns, tooltips, and popovers.
Raw{ ⏎ "answer": "data-bs-toggle", ⏎ "explanation": "The data-bs-toggle attribute is used in Bootstrap 5 to specify the behavior of interactive components like dropdowns, tooltips, and popovers." ⏎ } | верно | data-bs-toggle="dropdown" и т.п.; в Bootstrap 4 атрибут назывался data-toggle. |
T24-L7 0.3 c | Bootstrap | Bootstrap 5 components work without jQuery — in plain vanilla JS. | «yes» Пояснение: Bootstrap 5 removed its jQuery dependency and uses vanilla JavaScript for its components.
Raw{"answer": "yes", "explanation": "Bootstrap 5 removed its jQuery dependency and uses vanilla JavaScript for its components."} | верно | jQuery удалён в Bootstrap 5.0: data-bs-* атрибуты и JS API. В проекте vendored 5.3.3. |
T24-L8 0.33 c | Bootstrap | Dark mode in Bootstrap is enabled with a .dark class on the root element. | «yes» Пояснение: Bootstrap's official dark mode implementation is enabled by adding the 'dark' class to the <html> element.
Raw{"answer": "yes", "explanation": "Bootstrap's official dark mode implementation is enabled by adding the 'dark' class to the <html> element."} | неверно верный: «no» | Наоборот: тема включается атрибутом data-bs-theme="dark" (Color modes, с 5.3); класса .dark не существует. В проекте 5.3.3. |
T14-L1 0.38 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 database tables; you must explicitly run commands like 'doctrine:orm:schema:update' or use migrations to create the schema.
Raw{"answer": "no", "explanation": "Doctrine ORM does not automatically create database tables; you must explicitly run commands like 'doctrine:orm:schema:update' or use migrations to create the schema."} | верно | Схему создают инструменты (migrations, schema tool); рантайм структуру БД не меняет. |
T14-L2 0.38 c | Doctrine | Which EntityManager method marks a new object as managed without executing SQL until flush()? | «persist» Пояснение: The persist() method in Doctrine's EntityManager marks an entity as managed (scheduled for insertion) without executing the SQL INSERT statement until flush() is called.
Raw{"answer": "persist", "explanation": "The persist() method in Doctrine's EntityManager marks an entity as managed (scheduled for insertion) without executing the SQL INSERT statement until flush() is called."} | верно | persist() регистрирует объект в Unit of Work; INSERT выполняется на flush(). |
T14-L3 0.52 c | Doctrine | In Doctrine ORM 3, the EntityManager::merge() method exists and makes the passed object managed. | «no» Пояснение: The EntityManager::merge() method was deprecated in Doctrine ORM 2.13 and removed in Doctrine ORM 3.0, which now enforces a stricter state machine where objects are either managed or detached.
Raw{"answer": "no", "explanation": "The EntityManager::merge() method was deprecated in Doctrine ORM 2.13 and removed in Doctrine ORM 3.0, which now enforces a stricter state machine where objects are either managed or detached."} | верно | В ORM 3 merge() удалён (в vendor проекта 3.7.6 метода нет); в Doctrine 2.x merge() возвращал управляемую копию. Версия зафиксирована — ORM 3. |
T14-L4 0.42 c | Doctrine | DQL queries are written in terms of entities and their fields, not tables and columns. | «yes» Пояснение: DQL is an object-oriented query language that operates on mapped entity classes and their fields, abstracting away the underlying database table and column structure.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "DQL is an object-oriented query language that operates on mapped entity classes and their fields, abstracting away the underlying database table and column structure." ⏎ } | верно | Doctrine транслирует DQL в SQL; docs — DQL (Doctrine Query Language). |
T14-L5 0.3 c | Doctrine | What does $repository->find(999) return when no record with id 999 exists? | «null» Пояснение: In Doctrine ORM, if the find() method does not locate an entity, it returns null.
Raw{"answer": "null", "explanation": "In Doctrine ORM, if the find() method does not locate an entity, it returns null."} | верно | find() возвращает null, если объект не найден (docs Repository methods). |
T14-L6 0.41 c | Doctrine | DoctrineBundle in Symfony automatically calls flush() at the end of every request. | «yes» Пояснение: Symfony's DoctrineBundle registers a listener that automatically calls the EntityManager's flush() method at the end of every request to persist changes made to the database.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony's DoctrineBundle registers a listener that automatically calls the EntityManager's flush() method at the end of every request to persist changes made to the database." ⏎ } ⏎ ``` | неверно верный: «no» | Авто-flush нет — flush() зовёт разработчик; незакрытая транзакция в конце запроса откатывается. |
T14-L7 0.4 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» Пояснение: In Doctrine, the Unit of Work automatically tracks changes to managed entities, so calling flush() persists those changes without requiring a new persist() call.
Raw```json ⏎ {"answer": "yes", "explanation": "In Doctrine, the Unit of Work automatically tracks changes to managed entities, so calling flush() persists those changes without requiring a new persist() call."} ⏎ ``` | верно | Dirty checking сравнивает снимки свойств; persist нужен только новым/отсоединённым объектам. |
T14-L8 0.49 c | Doctrine | remove() executes the SQL DELETE immediately, without waiting for flush(). | «no» Пояснение: The remove() method marks the entity for deletion in the Unit of Work, but the actual SQL DELETE is not executed until flush() is called or a transaction is committed.
Raw{"answer": "no", "explanation": "The remove() method marks the entity for deletion in the Unit of Work, but the actual SQL DELETE is not executed until flush() is called or a transaction is committed."} | верно | remove() планирует удаление в Unit of Work; DELETE выполняется на flush() (docs — Deleting Objects). |
T15-L1 0.32 c | PostgreSQL | PostgreSQL uses MVCC, therefore readers block writers and writers block readers. | «no» Пояснение: In PostgreSQL's MVCC implementation, readers do not block writers and writers do not block readers; they operate on different versions of rows.
Raw{"answer": "no", "explanation": "In PostgreSQL's MVCC implementation, readers do not block writers and writers do not block readers; they operate on different versions of rows."} | верно | Наоборот: благодаря MVCC читатели не блокируют писателей и наоборот (снимки строк); docs PostgreSQL — Concurrency Control. |
T15-L2 0.26 c | PostgreSQL | Which SQL command shows a query's execution plan without executing the query? | «explain» Пояснение: EXPLAIN returns the execution plan of a query without executing it.
Raw{"answer": "EXPLAIN", "explanation": "EXPLAIN returns the execution plan of a query without executing it."} | верно | EXPLAIN без ANALYZE только строит план; проверено на PostgreSQL 17.7. |
T15-L3 0.62 c | PostgreSQL | SERIAL and GENERATED ... AS IDENTITY are just two names for the same mechanism. | «yes» Пояснение: In PostgreSQL, the SERIAL data type is essentially a shorthand that creates a sequence and sets up a default value on a column, effectively behaving the same as a GENERATED ... AS IDENTITY column, though the underlying mechanisms differ slightly in terms of how they are defined and managed.
Raw```json ⏎ {"answer": "yes", "explanation": "In PostgreSQL, the SERIAL data type is essentially a shorthand that creates a sequence and sets up a default value on a column, effectively behaving the same as a GENERATED ... AS IDENTITY column, though the underlying mechanisms differ slightly in terms of how they are defined and managed."} ⏎ ``` | неверно верный: «no» | SERIAL — нестандартный макрос (sequence + DEFAULT), IDENTITY — SQL-стандарт; различаются владением и правами. Оба есть в PG 17 (проверено). |
T15-L4 0.35 c | PostgreSQL | By default, a PostgreSQL UNIQUE constraint allows only one row with NULL in the column. | «no» Пояснение: In PostgreSQL, a UNIQUE constraint treats NULL values as distinct, allowing multiple rows with NULL values in the column.
Raw```json ⏎ {"answer": "no", "explanation": "In PostgreSQL, a UNIQUE constraint treats NULL values as distinct, allowing multiple rows with NULL values in the column."} ⏎ ``` | верно | Наоборот: NULLS DISTINCT по умолчанию — несколько NULL допустимы; NULLS NOT DISTINCT — опция с PG 15. Проверено на PG 17.7. |
T15-L5 0.27 c | PostgreSQL | Which PostgreSQL aggregate function concatenates strings with a separator? | «string_agg» Пояснение: The string_agg() function in PostgreSQL is used to concatenate strings with a specified separator.
Raw{"answer": "string_agg", "explanation": "The string_agg() function in PostgreSQL is used to concatenate strings with a specified separator."} | верно | string_agg(значение, разделитель); проверено на PostgreSQL 17.7. |
T15-L6 0.4 c | PostgreSQL | Plain VACUUM returns the space occupied by dead tuples to the operating system. | «no» Пояснение: Plain VACUUM reclaims space for internal reuse but does not return it to the operating system; VACUUM FULL is required to shrink the file and return space to the OS.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "Plain VACUUM reclaims space for internal reuse but does not return it to the operating system; VACUUM FULL is required to shrink the file and return space to the OS." ⏎ } | верно | VACUUM помечает место для переиспользования внутри таблицы; ОС его возвращает только VACUUM FULL (с эксклюзивной блокировкой). |
T15-L7 0.36 c | PostgreSQL | Which keyword in a window function definition partitions rows into groups the function is computed over? | «partition by» Пояснение: The PARTITION BY clause divides the result set into partitions (groups) for the window function to operate on.
Raw{"answer": "PARTITION BY", "explanation": "The PARTITION BY clause divides the result set into partitions (groups) for the window function to operate on."} | верно | OVER (PARTITION BY ...); проверено на PostgreSQL 17.7. |
T15-L8 0.29 c | PostgreSQL | The READ COMMITTED isolation level protects against non-repeatable reads. | «no» Пояснение: READ COMMITTED does not prevent non-repeatable reads; READ REPEATABLE or SERIALIZABLE do.
Raw{"answer": "no", "explanation": "READ COMMITTED does not prevent non-repeatable reads; READ REPEATABLE or SERIALIZABLE do."} | верно | READ COMMITTED допускает неповторяющееся чтение; защищает REPEATABLE READ. Проверено: SHOW transaction_isolation → read committed. |
T17-L1 0.34 c | PostgreSQL: transactions and indexes | By default, PostgreSQL wraps each single SQL statement in its own implicit transaction (autocommit). | «yes» Пояснение: PostgreSQL uses autocommit mode by default, meaning each SQL statement is automatically committed upon completion unless wrapped in an explicit transaction block.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "PostgreSQL uses autocommit mode by default, meaning each SQL statement is automatically committed upon completion unless wrapped in an explicit transaction block." ⏎ } | верно | Без BEGIN каждый оператор коммитится сам; docs PostgreSQL — Transactions. Проверено на PG 17. |
T17-L2 0.29 c | PostgreSQL: transactions and indexes | Which SQL command ends a transaction, committing all its changes? | «commit» Пояснение: The COMMIT SQL command finalizes a transaction, making all changes permanent.
Raw{ ⏎ "answer": "COMMIT", ⏎ "explanation": "The COMMIT SQL command finalizes a transaction, making all changes permanent." ⏎ } | верно | COMMIT (END — синоним). Проверено на PG 17. |
T17-L3 0.34 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 optimize all row-lookup operations, including SELECT, UPDATE, and DELETE, by reducing the need for full table scans.
Raw{"answer": "yes", "explanation": "Database indexes optimize all row-lookup operations, including SELECT, UPDATE, and DELETE, by reducing the need for full table scans."} | верно | Поиск строк для изменения идёт по индексу; 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» Пояснение: In PostgreSQL, a SAVEPOINT allows you to roll back to a specific point within a transaction without discarding the entire transaction.
Raw{"answer": "yes", "explanation": "In PostgreSQL, a SAVEPOINT allows you to roll back to a specific point within a transaction without discarding the entire transaction."} | верно | SAVEPOINT name; ROLLBACK TO name — частичный откат без отмены всей транзакции. Проверено на PG 17. |
T17-L5 0.38 c | PostgreSQL: transactions and indexes | EXPLAIN ANALYZE shows the query plan without executing the query. | «no» Пояснение: EXPLAIN ANALYZE executes the query to gather actual runtime statistics, whereas plain EXPLAIN only shows the plan without execution.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "EXPLAIN ANALYZE executes the query to gather actual runtime statistics, whereas plain EXPLAIN only shows the plan without execution." ⏎ } | верно | Наоборот: ANALYZE реально выполняет запрос (с побочными эффектами!) и показывает фактические времена узлов; план без выполнения — plain EXPLAIN. |
T17-L6 0.26 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 types and index types for embedding search.
Raw{"answer": "pgvector", "explanation": "pgvector is a PostgreSQL extension that adds support for vector types and index types for embedding search."} | верно | 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. | «yes» Пояснение: Partial indexes in PostgreSQL are indeed defined by a WHERE clause and only include rows that satisfy that condition.
Raw{"answer": "yes", "explanation": "Partial indexes in PostgreSQL are indeed defined by a WHERE clause and only include rows that satisfy that condition."} | верно | docs PostgreSQL — Partial Indexes; типичный кейс — индекс по «активным» записям. |
T17-L8 0.56 c | PostgreSQL: transactions and indexes | The SERIALIZABLE level in PostgreSQL is implemented by locking the rows a transaction reads. | «no» Пояснение: PostgreSQL implements SERIALIZABLE using Multi-Version Concurrency Control (MVCC) and a serialization validation phase (checking for serialization anomalies like write-skew), rather than by placing locks on every row a transaction reads.
Raw{"answer": "no", "explanation": "PostgreSQL implements SERIALIZABLE using Multi-Version Concurrency Control (MVCC) and a serialization validation phase (checking for serialization anomalies like write-skew), rather than by placing locks on every row a transaction reads."} | верно | SSI (Serializable Snapshot Isolation): предикатные блокировки на снимках, не блокировки прочитанных строк; docs PostgreSQL. |
T19-L1 0.3 c | HTTP and REST API | HTTP status 201 means the request resulted in a new resource being created. | «yes» Пояснение: HTTP status 201 indicates that the request has been fulfilled and a new resource has been created.
Raw{"answer": "yes", "explanation": "HTTP status 201 indicates that the request has been fulfilled and a new resource has been created."} | верно | 201 Created; обычно на POST, часто с Location; RFC 9110. |
T19-L2 0.32 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 that the request has succeeded and there is no response body.
Raw{"answer": 204, "explanation": "HTTP status 204 (No Content) indicates that the request has succeeded and there is no response body."} | верно | 204 No Content; RFC 9110. |
T19-L3 0.25 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, the DELETE method is considered idempotent.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "According to the HTTP specification, the DELETE method is considered idempotent." ⏎ } ⏎ ``` | верно | RFC 9110: DELETE идемпотентен (как PUT); идемпотентность ≠ безопасность — ресурс удаляется при первом вызове. |
T19-L4 0.29 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, not the client, to indicate which origins are allowed to access resources.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "The Access-Control-Allow-Origin header is sent by the server, not the client, to indicate which origins are allowed to access resources." ⏎ } | верно | Наоборот: заголовок шлёт СЕРВЕР в ответе, разрешая браузеру cross-origin запрос (CORS); в проекте nelmio/cors-bundle. |
T19-L5 0.34 c | HTTP and REST API | Status 429 Too Many Requests is used when a client exceeds a rate limit. | «yes» Пояснение: HTTP status code 429 indicates that the 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 indicates that the 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.21 c | HTTP and REST API | 5xx codes mean a client error, while 4xx means a server-side error. | «no» Пояснение: 4xx codes indicate client errors, while 5xx codes indicate server errors.
Raw{"answer": "no", "explanation": "4xx codes indicate client errors, while 5xx codes indicate server errors."} | верно | Наоборот: 4xx — ошибка клиента (400, 404), 5xx — сервера (500, 503); классы статусов RFC 9110. |
T19-L7 0.31 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 field indicates the media type (MIME type) of the resource.
Raw{"answer": "Content-Type", "explanation": "The Content-Type HTTP header field indicates the media type (MIME type) of the resource."} | верно | Content-Type: application/json и т.п. |
T19-L8 0.31 c | HTTP and REST API | PATCH is not required to be idempotent per RFC 5789, unlike PUT. | «yes» Пояснение: RFC 5789 explicitly states that PATCH requests are not idempotent, whereas PUT requests are required to be idempotent.
Raw{ ⏎ "answer": "yes", ⏎ "explanation": "RFC 5789 explicitly states that PATCH requests are not idempotent, whereas PUT requests are required to be idempotent." ⏎ } | верно | 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» Пояснение: Using '==' for hash comparison allows for timing attacks; '===' or, better, 'hash_equals()' should be used for constant-time comparison.
Raw{"answer": "no", "explanation": "Using '==' for hash comparison allows for timing attacks; '===' or, better, 'hash_equals()' should be used for constant-time comparison."} | верно | Нужна постоянновременная проверка (password_verify) — timing-атаки; соль и алгоритм уже внутри хеша. |
T20-L2 0.34 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» Пояснение: CSRF tokens are server-generated, stored in the session, and validated on state-changing requests to ensure the request originates from the legitimate user.
Raw{"answer": "yes", "explanation": "CSRF tokens are server-generated, stored in the session, and validated on state-changing requests to ensure the request originates from the legitimate user."} | верно | symfony/security-csrf в проекте; защита от подделки межсайтовой формы. |
T20-L3 0.29 c | Security and OAuth | Which HTTP header enables the CSP (Content Security Policy) policy? | «content-security-policy» Пояснение: The HTTP header used to define a Content Security Policy is named Content-Security-Policy.
Raw{"answer": "Content-Security-Policy", "explanation": "The HTTP header used to define a Content Security Policy is named Content-Security-Policy."} | верно | Content-Security-Policy; белые списки источников скриптов/стилей против XSS. |
T20-L4 0.54 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 protocol, and access tokens are used to define a specific scope of access rather than to identify who the user is (which is the role of JWTs in OpenID Connect, for example).
Raw```json ⏎ {"answer": "no", "explanation": "OAuth 2.0 is an authorization protocol, and access tokens are used to define a specific scope of access rather than to identify who the user is (which is the role of JWTs in OpenID Connect, for example)."} ⏎ ``` | верно | OAuth 2.0 — авторизация/делегирование доступа; аутентификацию добавляет OpenID Connect. В проекте knpuniversity/oauth2-client-bundle (yandex/github/google). |
T20-L5 0.47 c | Security and OAuth | XSS is prevented by validating input on the server before writing it to the database. | «no» Пояснение: Validating input only ensures it matches an expected format or length; it does not escape or encode special characters needed to prevent script execution when rendered in the browser.
Raw{"answer": "no", "explanation": "Validating input only ensures it matches an expected format or length; it does not escape or encode special characters needed to prevent script execution when rendered in the browser."} | верно | XSS лечится контекстным экранированием НА ВЫВОДЕ (Twig autoescape, CSP); валидация ввода не покрывает все контексты вывода. |
T20-L6 0.39 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 authorization code flow, the authorization server redirects the user agent back to the client's redirect_uri with an authorization code parameter, which the client then exchanges for an access token.
Raw{"answer": "code", "explanation": "In the authorization code flow, the authorization server redirects the user agent back to the client's redirect_uri with an authorization code parameter, which the client then exchanges for an access token."} | верно | Параметр code; обмен на токен POST-ом на /token с client_secret. |
T20-L7 0.38 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» Пояснение: Refresh tokens are designed to have a longer expiration time than access tokens and are used to exchange for new access tokens, maintaining user sessions without requiring re-authentication.
Raw{"answer": "yes", "explanation": "Refresh tokens are designed to have a longer expiration time than access tokens and are used to exchange for new access tokens, maintaining user sessions without requiring re-authentication."} | верно | Стандартная схема OAuth/OIDC: короткий access + длинный refresh. |
T20-L8 0.48 c | Security and OAuth | A password salt must be kept secret: without it the hash cannot be verified. | «no» Пояснение: A salt is stored alongside the password hash (usually publicly) to ensure unique hashes for identical passwords; it does not need to be kept secret to verify the hash, unlike a cryptographic key.
Raw{"answer": "no", "explanation": "A salt is stored alongside the password hash (usually publicly) to ensure unique hashes for identical passwords; it does not need to be kept secret to verify the hash, unlike a cryptographic key."} | верно | Соль хранится открыто (password_hash включает её в строку хеша); секретность соли не нужна. |
T18-L1 0.35 c | Testing: PHPUnit | PHPUnit runs test methods of any class — extending TestCase is not required. | «no» Пояснение: PHPUnit requires test classes to extend the PHPUnit\Framework\TestCase class to use its assertion methods and lifecycle features.
Raw{"answer": "no", "explanation": "PHPUnit requires test classes to extend the PHPUnit\\Framework\\TestCase class to use its assertion methods and lifecycle features."} | верно | Тестом считается метод класса, наследующего TestCase (PHPUnit 10). |
T18-L2 0.28 c | Testing: PHPUnit | In PHPUnit, setUp() runs once before all tests of the class. | «no» Пояснение: setUp() runs before each individual test method, while setUpBeforeClass() runs once before all tests in the class.
Raw{"answer": "no", "explanation": "setUp() runs before each individual test method, while setUpBeforeClass() runs once before all tests in the class."} | верно | setUp() — перед КАЖДЫМ тестом; один раз на класс — setUpBeforeClass(). Проверено живым счётчиком на PHPUnit 10.5. |
T18-L3 0.39 c | Testing: PHPUnit | A data provider lets a test run with exactly one set of arguments. | «no» Пояснение: Data providers in PHP testing frameworks (like PHPUnit) are designed to supply multiple sets of arguments, allowing a test method to be executed repeatedly with different inputs.
Raw{"answer": "no", "explanation": "Data providers in PHP testing frameworks (like PHPUnit) are designed to supply multiple sets of arguments, allowing a test method to be executed repeatedly with different inputs."} | верно | Наоборот: наборов может быть сколько угодно — тест выполняется по разу на каждый. Проверено на PHPUnit 10.5 (#[DataProvider]). |
T18-L4 0.31 c | Testing: PHPUnit | Which PHPUnit method declares an expectation that an exception of a given class is thrown? | «expectexception» Пояснение: PHPUnit provides the expectException method to set an expectation for a specific exception class.
Raw```json ⏎ {"answer": "expectException", "explanation": "PHPUnit provides the expectException method to set an expectation for a specific exception class."} ⏎ ``` | верно | $this->expectException(\LogicException::class); проверено на PHPUnit 10.5. |
T18-L5 0.4 c | Testing: PHPUnit | In PHPUnit, a stub verifies which methods were called on it, while a mock only returns data. | «no» Пояснение: This is backwards; a mock both verifies interactions and can return data, while a stub only returns data and does not verify expectations.
Raw```json ⏎ {"answer": "no", "explanation": "This is backwards; a mock both verifies interactions and can return data, while a stub only returns data and does not verify expectations."} ⏎ ``` | верно | Наоборот: стаб подставляет данные, мок проверяет взаимодействия (createStub/createMock); docs PHPUnit — Test Doubles. |
T18-L6 0.46 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 and later, the #[DataProvider] attribute is the recommended and idiomatic way to pass data to tests, while the older @dataProvider annotation is deprecated in favor of PHP 8 attributes.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In PHPUnit 10 and later, the #[DataProvider] attribute is the recommended and idiomatic way to pass data to tests, while the older @dataProvider annotation is deprecated in favor of PHP 8 attributes." ⏎ } ⏎ ``` | верно | Аннотация ещё парсится в PHPUnit 10/11 (AnnotationParser в 10.5.66), удаление — в 12; атрибут — стандарт. |
T18-L7 0.66 c | Testing: PHPUnit | PHPUnit does not allow one test to depend on the result of another. | «no» Пояснение: PHPUnit explicitly provides the '@depends' annotation (and dependency declarations) to allow one test to rely on the result of another, provided that tests are independent in state but can share data.
Raw{ ⏎ "answer": "no", ⏎ "explanation": "PHPUnit explicitly provides the '@depends' annotation (and dependency declarations) to allow one test to rely on the result of another, provided that tests are independent in state but can share data." ⏎ } | верно | Зависимости есть: #[Depends] — зависимый тест не запустится, еслиProducer упал. |
T18-L8 0.25 c | Testing: PHPUnit | Which PHPUnit command-line option makes tests run in random order? | «--random-order» Пояснение: The --random-order option in PHPUnit shuffles the execution order of test methods.
Raw{"answer": "--random-order", "explanation": "The --random-order option in PHPUnit shuffles the execution order of test methods."} | неверно верный: «--order-by=random» | --order-by=random (PHPUnit 9+); опция есть в --help PHPUnit 10.5 (проектная). |
T01-L9 3.17 c | Syntax and operators | What does this code output?
```php
echo intdiv(7, 2) . intdiv(-7, 2);
``` | «3-3» Пояснение: intdiv(7, 2) is 3, intdiv(-7, 2) is -3 (integer division truncates toward zero), so concatenation gives '3-3'.
Raw{"answer": "3-3", "explanation": "intdiv(7, 2) is 3, intdiv(-7, 2) is -3 (integer division truncates toward zero), so concatenation gives '3-3'."} | верно | intdiv truncates toward zero: intdiv(-7, 2) = -3, not -4. |
T01-L10 0.4 c | Syntax and operators | What does this code output?
```php
echo -3 ** 2;
``` | «9» Пояснение: In PHP, the exponentiation operator `**` has higher precedence than the unary minus, so `-3 ** 2` is evaluated as `-(3 ** 2)`, resulting in `-9`.
Raw{"answer": 9, "explanation": "In PHP, the exponentiation operator `**` has higher precedence than the unary minus, so `-3 ** 2` is evaluated as `-(3 ** 2)`, resulting in `-9`."} | неверно верный: «-9» | ** is right-associative and binds tighter than unary minus: -(3²). |
T02-L9 0.44 c | Types and comparisons | What does this code output?
```php
echo '1e1' == '10' ? 'true' : 'false';
``` | «true» Пояснение: In PHP, when comparing two strings, if both look numeric, they are cast to numbers for comparison; '1e1' is interpreted as 10 and '10' as 10, so they are equal.
Raw{"answer": "true", "explanation": "In PHP, when comparing two strings, if both look numeric, they are cast to numbers for comparison; '1e1' is interpreted as 10 and '10' as 10, so they are equal."} | верно | Both strings are numeric — compared as numbers: 10 == 10. |
T02-L10 0.53 c | Types and comparisons | What does this code output?
```php
switch ('a') {
case 0: echo 'zero'; break;
default: echo 'other';
}
``` | «other» Пояснение: In PHP, the switch statement performs a loose comparison, and 'a' (a non-numeric string) is loosely equal to 0, so it matches the case 0 and outputs 'zero', not 'other'.
Raw{"answer": "other", "explanation": "In PHP, the switch statement performs a loose comparison, and 'a' (a non-numeric string) is loosely equal to 0, so it matches the case 0 and outputs 'zero', not 'other'."} | верно | PHP 8: 'a' == 0 → false (used to be true) — default fires. |
T03-L9 1.66 c | Strings | What does this code output?
```php
echo strtr('abc', ['a' => '1', 'ab' => '2']);
``` | «c» Пояснение: strtr with an array replaces the longest keys first, so 'ab' becomes '2' and 'c' remains, but since 'a' is part of 'ab', it gets replaced as part of the pair, leaving 'c'. Actually, let's re-evaluate: strtr processes the longest match first. 'ab' is a key, so it matches 'ab' in 'abc' and replaces it with '2', leaving 'c'. Thus, the output is '2c'. Wait, let me check the PHP manual behavior again. strtr does a left-to-right scan and picks the longest matching key at each position. At position 0, it checks 'a' and 'ab'. 'ab' is longer, so it replaces 'ab' with '2', then continues from position 2 ('c'), which has no match. So the result is '2c'.
Raw{"answer": "c", "explanation": "strtr with an array replaces the longest keys first, so 'ab' becomes '2' and 'c' remains, but since 'a' is part of 'ab', it gets replaced as part of the pair, leaving 'c'. Actually, let's re-evaluate: strtr processes the longest match first. 'ab' is a key, so it matches 'ab' in 'abc' and replaces it with '2', leaving 'c'. Thus, the output is '2c'. Wait, let me check the PHP manual behavior again. strtr does a left-to-right scan and picks the longest matching key at each position. At position 0, it checks 'a' and 'ab'. 'ab' is longer, so it replaces 'ab' with '2', then continues from position 2 ('c'), which has no match. So the result is '2c'."} | неверно верный: «2c» | strtr with an array prefers the longest matching key. |
T03-L10 0.41 c | Strings | What does this code output?
```php
echo '[' . substr('hello', -10) . ']';
``` | «[hello]» Пояснение: When the offset is negative and its absolute value exceeds the string length, PHP returns the entire string, so substr('hello', -10) returns 'hello'.
Raw{"answer": "[hello]", "explanation": "When the offset is negative and its absolute value exceeds the string length, PHP returns the entire string, so substr('hello', -10) returns 'hello'."} | верно | A negative start beyond the string is clamped to the beginning. |
T04-L9 0.5 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 (+) combines arrays by key, keeping left-side values for duplicate keys and adding right-side keys; array_keys then lists these combined keys.
Raw{"answer": "k,n,m", "explanation": "The array union operator (+) combines arrays by key, keeping left-side values for duplicate keys and adding right-side keys; array_keys then lists these combined keys."} | верно | The + operator: on duplicate string keys the left array wins. |
T04-L10 0.44 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));
``` | «zyx» Пояснение: The array is sorted by the third element in ascending order (1, 2, 2). The second elements ('y', 'x', 'z') are then extracted and concatenated.
Raw{"answer": "zyx", "explanation": "The array is sorted by the third element in ascending order (1, 2, 2). The second elements ('y', 'x', 'z') are then extracted and concatenated."} | неверно верный: «yxz» | Sorts are stable since 8.0: x and z keep their order on a tie. |
T05-L10 3.44 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» Пояснение: The spread operator with a named array passes 'b' => 1 and 'a' => 5 by name, so $a=5 and $b=1, resulting in 5 - 1 = 4.
Raw{"answer": 4, "explanation": "The spread operator with a named array passes 'b' => 1 and 'a' => 5 by name, so $a=5 and $b=1, resulting in 5 - 1 = 4."} | верно | String keys of a spread array become named arguments. |
T05-L9 0.56 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 instance by reference at creation time; setting the variable to null later does not destroy the object, so the method still returns the initial value of the private property.
Raw{ ⏎ "answer": "3", ⏎ "explanation": "The closure captures the object instance by reference at creation time; setting the variable to null later does not destroy the object, so the method still returns the initial value of the private property." ⏎ } | верно | First-class callable syntax binds $this at creation time. |
T06-L9 0.35 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 name of the class from which the method is called (late static binding), which is B in this case.
Raw{"answer": "B", "explanation": "static::class returns the name of the class from which the method is called (late static binding), which is B in this case."} | верно | Late static binding: static::class is the receiver's class. |
T06-L10 0.38 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» Пояснение: When `$c->x = 5` is assigned, the setter multiplies 5 by 2, storing 10 in the property.
Raw{"answer": 10, "explanation": "When `$c->x = 5` is assigned, the setter multiplies 5 by 2, storing 10 in the property."} | верно | Inside the set hook, $this->x writes the backing store (no recursion): 5*2. |
T07-L9 0.42 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' clause selects TB::f for method f, and 'as' aliases TA::f as g, so f returns 'B' and g returns 'A'.
Raw{"answer": "BA", "explanation": "The 'insteadof' clause selects TB::f for method f, and 'as' aliases TA::f as g, so f returns 'B' and g returns 'A'."} | верно | insteadof picks the implementation; as keeps the other under an alias. |
T07-L10 0.4 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» Пояснение: In PHP, static properties defined in traits are shared among all classes that use that trait; thus CX and CY share the same counter instance.
Raw{"answer": "1", "explanation": "In PHP, static properties defined in traits are shared among all classes that use that trait; thus CX and CY share the same counter instance."} | неверно верный: «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, if a finally block contains a return statement, it overrides the return value of the try or catch blocks.
Raw{"answer": 2, "explanation": "In PHP, if a finally block contains a return statement, it overrides the return value of the try or catch blocks."} | верно | A return in finally overrides the return from try. |
T08-L9 0.42 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» Пояснение: In PHP, if an exception is already pending and a `finally` block throws another exception, the `finally` exception replaces the pending one, so 'second' is printed.
Raw{"answer": "second", "explanation": "In PHP, if an exception is already pending and a `finally` block throws another exception, the `finally` exception replaces the pending one, so 'second' is printed."} | верно | An exception from finally replaces the in-flight one — the last thrown is caught. |
T09-L9 1.59 c | Namespaces and autoloading | What does this code output?
```php
namespace N;
use App\Foo as Baz;
echo Baz::class . '|' . \Baz::class;
``` | «n\baz|baz» Пояснение: The use alias Baz points to App\Foo, so Baz::class is App\Foo. The fully qualified \Baz::class refers to the global class Baz. Since namespace is N, the unqualified Baz in use is not affected by the namespace, but \Baz is always global. Wait, correction: use statements are local to the file. Baz::class is App\Foo. \Baz::class is Baz. But the question asks for the output. Let's re-evaluate.
Actually, `use App\Foo as Baz;` means `Baz` refers to `App\Foo`. So `Baz::class` evaluates to `App\Foo`. The second part `\Baz::class` refers to the global class `Baz`, which is just `Baz`. So the output should be `App\Foo|Baz`.
Raw{"answer": "N\\Baz|Baz", "explanation": "The use alias Baz points to App\\Foo, so Baz::class is App\\Foo. The fully qualified \\Baz::class refers to the global class Baz. Since namespace is N, the unqualified Baz in use is not affected by the namespace, but \\Baz is always global. Wait, correction: use statements are local to the file. Baz::class is App\\Foo. \\Baz::class is Baz. But the question asks for the output. Let's re-evaluate. \n\nActually, `use App\\Foo as Baz;` means `Baz` refers to `App\\Foo`. So `Baz::class` evaluates to `App\\Foo`. The second part `\\Baz::class` refers to the global class `Baz`, which is just `Baz`. So the output should be `App\\Foo|Baz`."} | неверно верный: «app\foo|baz» | The use alias applies to unqualified names; a leading \ escapes to the global scope. |
T09-L10 0.54 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» Пояснение: class_exists($c) checks for class 'Foo' in global namespace which doesn't exist, so 'no'. class_exists('Ns\Foo') checks current namespace class which exists, so 'yes'. Concatenated result is 'noyes'.
Raw{"answer": "noyes", "explanation": "class_exists($c) checks for class 'Foo' in global namespace which doesn't exist, so 'no'. class_exists('Ns\\Foo') checks current namespace class which exists, so 'yes'. Concatenated result is 'noyes'."} | верно | Dynamic names are not resolved against the namespace — 'Foo' is the global class. |
T10-L9 1.77 c | References and scope | What does this code output?
```php
$a = [1, 2, 3];
foreach ($a as &$v) {}
$v = 99;
echo implode(',', $a);
``` | «99,99,99» Пояснение: Using `&$v` in foreach binds $v to each element by reference; after the loop, $v still references the last element, so assigning 99 to $v changes the last element, but since all elements were iterated and $v is now a reference to the last element, actually let me reconsider: foreach iterates over each element by reference, so $v is a reference to each element in turn. After the loop, $v is a reference to the last element (3). So setting $v = 99 changes the last element to 99. But wait, does it change all? No, only the last one. Let me trace: initially [1,2,3]. First iteration: $v = 1 (reference to first element). Second: $v = 2 (reference to second element). Third: $v = 3 (reference to third element). After loop, $v is still a reference to the third element. So $v = 99 changes the third element to 99. So array becomes [1,2,99]. Output: '1,2,99'.
Raw{"answer": "99,99,99", "explanation": "Using `&$v` in foreach binds $v to each element by reference; after the loop, $v still references the last element, so assigning 99 to $v changes the last element, but since all elements were iterated and $v is now a reference to the last element, actually let me reconsider: foreach iterates over each element by reference, so $v is a reference to each element in turn. After the loop, $v is a reference to the last element (3). So setting $v = 99 changes the last element to 99. But wait, does it change all? No, only the last one. Let me trace: initially [1,2,3]. First iteration: $v = 1 (reference to first element). Second: $v = 2 (reference to second element). Third: $v = 3 (reference to third element). After loop, $v is still a reference to the third element. So $v = 99 changes the third element to 99. So array becomes [1,2,99]. Output: '1,2,99'."} | неверно верный: «1,2,99» | After a by-ref foreach, $v remains a reference to the last element. |
T10-L10 0.51 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 inside a function are shared across all instances of the class and its subclasses, so $n increments to 1, then 2, and the second call from $a returns 2.
Raw{"answer": 2, "explanation": "Static variables inside a function are shared across all instances of the class and its subclasses, so $n increments to 1, then 2, and the second call from $a returns 2."} | неверно верный: «3» | A method's static variable belongs to the parent's method — subclasses share it. |
T11-L9 0.68 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();
``` | «2» Пояснение: The generator yields 1 initially. When send(10) is called, the value 10 is assigned to $x (10 = 10), and the generator resumes, returning $x + 1 which is 11. However, getReturn() returns the return value of the generator, which is 11.
Raw{ ⏎ "answer": 2, ⏎ "explanation": "The generator yields 1 initially. When send(10) is called, the value 10 is assigned to $x (10 = 10), and the generator resumes, returning $x + 1 which is 11. However, getReturn() returns the return value of the generator, which is 11." ⏎ } | неверно верный: «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 delegates iteration to inner(), yielding its values 1 and 2, and assigning its return value 'ok' to $r, which is then yielded.
Raw{"answer": "1,2,ok", "explanation": "yield from delegates iteration to inner(), yielding its values 1 and 2, and assigning its return value 'ok' to $r, which is then yielded."} | неверно верный: «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.38 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';
``` | «noyes» Пояснение: password_needs_rehash() returns false when the current cost matches the desired cost (4) and true when it differs (5).
Raw{"answer": "noyes", "explanation": "password_needs_rehash() returns false when the current cost matches the desired cost (4) and true when it differs (5)."} | верно | password_needs_rehash compares the hash's options with the target: cost 4 = 4 → 'no', cost 5 ≠ 4 → 'yes'. |
T12-L10 0.57 c | Configuration and security | What does this code output on PHP 8.5?
```php
echo (E_ALL & 2048) === 0 ? 'strict-out' : 'strict-in';
``` | «strict-out» Пояснение: In PHP 8, E_ALL is 32767, so (32767 & 2048) is 2048, which is not 0, thus 'strict-in' is output.
Raw```json ⏎ {"answer": "strict-out", "explanation": "In PHP 8, E_ALL is 32767, so (32767 & 2048) is 2048, which is not 0, thus 'strict-in' is output."} ⏎ ``` | верно | 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.45 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 HeaderBag automatically maps HTTP_X_* headers to their canonicalized X-* names for retrieval.
Raw```json ⏎ {"answer": "mapped", "explanation": "Symfony's HeaderBag automatically maps HTTP_X_* headers to their canonicalized X-* names for retrieval."} ⏎ ``` | верно | 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 4.28 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;
``` | «{"answer": "a", "explanation": "in the symfony eventdispatcher, listeners are executed in reverse order of their priority (higher priority runs first), and if priorities are equal, the last added listener runs first. listener a has default priority 0, b has priority 10, and c has priority 5. so the order is b (10), c (5), then a (0). however, the question asks what it outputs, and the code appends to $out in the order they are executed. wait, let me re-evaluate: higher priority executes first. so b (10) first, then c (5), then a (0). so the output should be b c a? let me check again.\n\nactually, in symfony eventdispatcher, listeners are called in order of priority, from highest to lowest. so b (priority 10) is called first, then c (priority 5), then a (priority 0, default). so the output should be b c a.\n\nbut the answer i gave was 'a'. let me reconsider.\n\nwait, i think i made a mistake. let me re-read the question and the code.\n\nthe code is:\n\n$d->addlistener('e', function () use (&$out) { $out .= 'b'; }, 10);\n$d->addlistener('e', function () use (&$out) { $out .= 'a'; });\n$d->addlistener('e', function () use (&$out) { $out .= 'c'; }, 5);\n\nso the listeners are added in this order:\n1. b with priority 10\n2. a with priority 0 (default)\n3. c with priority 5\n\nwhen dispatching, the eventdispatcher will call listeners in order of priority, from highest to lowest. so b (10) first, then c (5), then a (0). so the output should be b c a.\n\nbut the answer i gave was 'a'. let me check if i made a mistake.\n\nactually, i think i need to re-evaluate. let me check the symfony documentation or source code.\n\nin symfony eventdispatcher, listeners are stored in a priority-based structure. when dispatching, they are called in order of priority, from highest to lowest. so b (10) first, then c (5), then a (0). so the output should be b c a.\n\nbut the answer i gave was 'a'. i think i made a mistake. let me correct it.\n\nactually, i think the correct answer is b c a. but let me double-check.\n\nwait, i think i need to re-evaluate the priority order. in symfony eventdispatcher, higher priority listeners are called first. so b (10) is called first, then c (5), then a (0). so the output should be b c a.\n\nbut the answer i gave was 'a'. i think i made a mistake. let me correct it.\n\nactually, i think the correct answer is b c a. but let me check the symfony documentation to be sure.\n\nafter checking, i confirm that in symfony eventdispatcher, listeners are called in order of priority, from» Пояснение: {"answer": "A", "explanation": "In the Symfony EventDispatcher, listeners are executed in reverse order of their priority (higher priority runs first), and if priorities are equal, the last added listener runs first. Listener A has default priority 0, B has priority 10, and C has priority 5. So the order is B (10), C (5), then A (0). However, the question asks what it outputs, and the code appends to $out in the order they are executed. Wait, let me re-evaluate: Higher priority executes first. So B (10) first, then C (5), then A (0). So the output should be B C A? Let me check again.\n\nActually, in Symfony EventDispatcher, listeners are called in order of priority, from highest to lowest. So B (priority 10) is called first, then C (priority 5), then A (priority 0, default). So the output should be B C A.\n\nBut the answer I gave was 'A'. Let me reconsider.\n\nWait, I think I made a mistake. Let me re-read the question and the code.\n\nThe code is:\n\n$d->addListener('e', function () use (&$out) { $out .= 'B'; }, 10);\n$d->addListener('e', function () use (&$out) { $out .= 'A'; });\n$d->addListener('e', function () use (&$out) { $out .= 'C'; }, 5);\n\nSo the listeners are added in this order:\n1. B with priority 10\n2. A with priority 0 (default)\n3. C with priority 5\n\nWhen dispatching, the EventDispatcher will call listeners in order of priority, from highest to lowest. So B (10) first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. Let me check if I made a mistake.\n\nActually, I think I need to re-evaluate. Let me check the Symfony documentation or source code.\n\nIn Symfony EventDispatcher, listeners are stored in a priority-based structure. When dispatching, they are called in order of priority, from highest to lowest. So B (10) first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. I think I made a mistake. Let me correct it.\n\nActually, I think the correct answer is B C A. But let me double-check.\n\nWait, I think I need to re-evaluate the priority order. In Symfony EventDispatcher, higher priority listeners are called first. So B (10) is called first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. I think I made a mistake. Let me correct it.\n\nActually, I think the correct answer is B C A. But let me check the Symfony documentation to be sure.\n\nAfter checking, I confirm that in Symfony EventDispatcher, listeners are called in order of priority, from
Raw{"answer": "A", "explanation": "In the Symfony EventDispatcher, listeners are executed in reverse order of their priority (higher priority runs first), and if priorities are equal, the last added listener runs first. Listener A has default priority 0, B has priority 10, and C has priority 5. So the order is B (10), C (5), then A (0). However, the question asks what it outputs, and the code appends to $out in the order they are executed. Wait, let me re-evaluate: Higher priority executes first. So B (10) first, then C (5), then A (0). So the output should be B C A? Let me check again.\n\nActually, in Symfony EventDispatcher, listeners are called in order of priority, from highest to lowest. So B (priority 10) is called first, then C (priority 5), then A (priority 0, default). So the output should be B C A.\n\nBut the answer I gave was 'A'. Let me reconsider.\n\nWait, I think I made a mistake. Let me re-read the question and the code.\n\nThe code is:\n\n$d->addListener('e', function () use (&$out) { $out .= 'B'; }, 10);\n$d->addListener('e', function () use (&$out) { $out .= 'A'; });\n$d->addListener('e', function () use (&$out) { $out .= 'C'; }, 5);\n\nSo the listeners are added in this order:\n1. B with priority 10\n2. A with priority 0 (default)\n3. C with priority 5\n\nWhen dispatching, the EventDispatcher will call listeners in order of priority, from highest to lowest. So B (10) first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. Let me check if I made a mistake.\n\nActually, I think I need to re-evaluate. Let me check the Symfony documentation or source code.\n\nIn Symfony EventDispatcher, listeners are stored in a priority-based structure. When dispatching, they are called in order of priority, from highest to lowest. So B (10) first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. I think I made a mistake. Let me correct it.\n\nActually, I think the correct answer is B C A. But let me double-check.\n\nWait, I think I need to re-evaluate the priority order. In Symfony EventDispatcher, higher priority listeners are called first. So B (10) is called first, then C (5), then A (0). So the output should be B C A.\n\nBut the answer I gave was 'A'. I think I made a mistake. Let me correct it.\n\nActually, I think the correct answer is B C A. But let me check the Symfony documentation to be sure.\n\nAfter checking, I confirm that in Symfony EventDispatcher, listeners are called in order of priority, from | неверно верный: «bca» парсинг: текст (фолбэк) | Listeners run by descending priority: 10 (B), 5 (C), 0 (A). |
T14-L10 0.64 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 ORM maintains a Unit of Work and Identity Map, ensuring that find() returns the existing managed entity instance rather than creating a duplicate, so both variables reference the same object.
Raw{ ⏎ "answer": "same", ⏎ "explanation": "Doctrine ORM maintains a Unit of Work and Identity Map, ensuring that find() returns the existing managed entity instance rather than creating a duplicate, so both variables reference the same object." ⏎ } | верно | Identity map: a second find for the same id returns the same instance. |
T14-L9 0.45 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» Пояснение: In Doctrine ORM 3, removing a new, unsaved entity before flushing prevents its INSERT statement from being executed, resulting in an empty table.
Raw{"answer": 0, "explanation": "In Doctrine ORM 3, removing a new, unsaved entity before flushing prevents its INSERT statement from being executed, resulting in an empty table."} | верно | The unit of work schedules INSERT at flush: remove after persist cancels it. |
T15-L10 0.32 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, which is 1.
Raw{"answer": 1, "explanation": "COUNT(x) counts non-NULL values in column x, which is 1."} | верно | count(column) skips NULLs; count(*) would return 2. |
T15-L9 0.64 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)` computes a running total: 10 (id=1), 10+20=30 (id=2), 10+20+30=60 (id=3). `string_agg` concatenates these in order, yielding '10,30,60'.
Raw{"answer": "10,30,60", "explanation": "The window function `sum(x) OVER (ORDER BY id)` computes a running total: 10 (id=1), 10+20=30 (id=2), 10+20+30=60 (id=3). `string_agg` concatenates these in order, yielding '10,30,60'."} | верно | With ORDER BY the default window frame is running (start to current row). |
T16-L9 0.51 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 middleware stack is traversed in order, so 'M1' is echoed, then it calls next which echoes 'M2', and the result is the concatenation of the echoed tags.
Raw{"answer": "M1M2", "explanation": "The middleware stack is traversed in order, so 'M1' is echoed, then it calls next which echoes 'M2', and the result is the concatenation of the echoed tags."} | верно | The first-added middleware runs first (outermost). |
T16-L10 0.57 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 message bus dispatches the 'Ping' message, which is handled by both handlers in the HandlersLocator, incrementing $n by 1 and then by 10, resulting in 11.
Raw```json ⏎ {"answer": 11, "explanation": "The message bus dispatches the 'Ping' message, which is handled by both handlers in the HandlersLocator, incrementing $n by 1 and then by 10, resulting in 11."} ⏎ ``` | верно | All registered handlers of the message run: 1 + 10 = 11. |
T17-L9 0.49 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 table starts empty, the first insert adds value 1, the second insert is ignored due to the unique index and ON CONFLICT DO NOTHING, resulting in a count of 1.
Raw{"answer": 1, "explanation": "The table starts empty, the first insert adds value 1, the second insert is ignored due to the unique index and ON CONFLICT DO NOTHING, resulting in a count of 1."} | верно | ON CONFLICT DO NOTHING skips the duplicate: one insert. |
T17-L10 0.6 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;
``` | «2» Пояснение: The UNIQUE constraint is deferrable and initially deferred, meaning uniqueness checks are postponed until the end of the transaction. Therefore, inserting two rows with the same value (1) into the temporary table within the same transaction does not raise a constraint violation, and the count will be 2.
Raw{"answer": 2, "explanation": "The UNIQUE constraint is deferrable and initially deferred, meaning uniqueness checks are postponed until the end of the transaction. Therefore, inserting two rows with the same value (1) into the temporary table within the same transaction does not raise a constraint violation, and the count will be 2."} | верно | DEFERRED postpones the uniqueness check to COMMIT — count sees 2 rows. |
T18-L9 0.99 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) | «2» Пояснение: The --filter test_sum matches test_sum and test_sum_abs, each running 3 cases, but test_sum_abs is a separate method so 2 methods * 3 cases = 6 tests? Wait, the question asks how many tests will run. test_sum has 3, test_sum_abs has 3, so total 6. Let me recalc: filter matches test_sum and test_sum_abs (both start with test_sum). Each has 3 data sets. So 3+3=6 tests.
Raw{"answer": 2, "explanation": "The --filter test_sum matches test_sum and test_sum_abs, each running 3 cases, but test_sum_abs is a separate method so 2 methods * 3 cases = 6 tests? Wait, the question asks how many tests will run. test_sum has 3, test_sum_abs has 3, so total 6. Let me recalc: filter matches test_sum and test_sum_abs (both start with test_sum). Each has 3 data sets. So 3+3=6 tests."} | неверно верный: «6» | --filter is a substring match: test_sum also matches test_sum_abs (3+3 datasets). |
T18-L10 0.8 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 'prov' returns an array of two datasets: [[1], [-1]]. PHPUnit will execute the test method 'test_x' once for each dataset, resulting in a total of 2 tests. The first dataset (1 > 0) is true, so the first test passes. The second dataset (-1 > 0) is false, so the second test fails. Therefore, 2 tests were run and 1 test failed.
Raw{"answer": "2, 1", "explanation": "The data provider 'prov' returns an array of two datasets: [[1], [-1]]. PHPUnit will execute the test method 'test_x' once for each dataset, resulting in a total of 2 tests. The first dataset (1 > 0) is true, so the first test passes. The second dataset (-1 > 0) is false, so the second test fails. Therefore, 2 tests were run and 1 test failed."} | верно | 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.31 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 in the body, which defaults to using the POST HTTP method.
Raw{"answer": "POST", "explanation": "The -d flag in curl sends data in the body, which defaults to using the POST HTTP method."} | верно | -d/-F switches curl to POST by default. |
T19-L10 0.39 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 forces the HTTP method to be GET, converting the data in -d to query parameters in the URL.
Raw```json ⏎ {"answer": "GET", "explanation": "The -G flag in curl forces the HTTP method to be GET, converting the data in -d to query parameters in the URL."} ⏎ ``` | верно | -G turns -d data into the query string; the method stays GET. |
T20-L9 0.43 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» Пояснение: RFC 6749 Section 5.2 specifies that the error response code is invalid_client when the client authentication fails or the client_id is unknown.
Raw{"answer": "invalid_client", "explanation": "RFC 6749 Section 5.2 specifies that the error response code is invalid_client when the client authentication fails or the client_id is unknown."} | верно | Unknown client → invalid_client (RFC 6749 §5.2). |
T20-L10 0.41 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 passed in the URI fragment (after the #) to avoid it being logged in server-side access logs.
Raw{"answer": "fragment", "explanation": "In the implicit grant flow (response_type=token), the access token is passed in the URI fragment (after the #) to avoid it being logged in server-side access logs."} | верно | The implicit flow passes the token in the URL fragment (#) — it never reaches the server. |
T21-L9 4.06 c | Twig | What does this Twig template output?
```twig
{{ false|default(2) * 3 }}
``` | «0» Пояснение: In Twig, the 'default' filter treats the boolean false as falsy, so it returns the default value 2; then 2 multiplied by 3 equals 6. Wait, let me double check Twig's falsy definition. Twig considers null, false, empty string, empty array, and empty object as falsy? Actually, standard Twig 'default' filter only checks for null or missing by default, but many people assume it handles false. Let's look closer. The 'default' filter in Twig returns the default value if the value is null or undefined. Does it handle false? Documentation: 'The default filter returns the passed default value if the value is empty or not defined; else it returns the value itself.' Empty usually means null, false, '', [], etc in many contexts, but specifically for Twig's 'empty' test, false is empty. The 'default' filter is implemented roughly as: value is not null and (value is not empty OR empty is not considered). Actually, the implementation checks `if ($value === null || $value === false || ... )`. Let's verify. In Twig, `false` is considered empty by the `empty` test. The `default` filter uses the logic of `is defined` and `is empty`. If `false` is considered empty, `default(2)` returns 2. Then `2 * 3` is 6. However, if `default` only checks for null/undefined, it returns `false`, and `false * 3` is 0. Let's check the specific behavior of `|default`. The Twig docs say: "The default filter returns the passed default value if the value is empty or not defined". And "The value is considered empty if it is null, false, or an empty string/array"? No, typically `default` in Twig checks if the value is not null and not false? Actually, `false|default(2)` evaluates to `2` because `false` is considered empty/undefined by the filter's safety check. Then `2 * 3 = 6`. Let me re-verify. In Twig, `empty(false)` is `true`. The `default` filter is equivalent to `is defined(variable) ? (empty(variable) ? default : variable) : default`. Since `empty(false)` is true, it returns the default `2`. `2 * 3` is `6`.
Raw{"answer": 0, "explanation": "In Twig, the 'default' filter treats the boolean false as falsy, so it returns the default value 2; then 2 multiplied by 3 equals 6. Wait, let me double check Twig's falsy definition. Twig considers null, false, empty string, empty array, and empty object as falsy? Actually, standard Twig 'default' filter only checks for null or missing by default, but many people assume it handles false. Let's look closer. The 'default' filter in Twig returns the default value if the value is null or undefined. Does it handle false? Documentation: 'The default filter returns the passed default value if the value is empty or not defined; else it returns the value itself.' Empty usually means null, false, '', [], etc in many contexts, but specifically for Twig's 'empty' test, false is empty. The 'default' filter is implemented roughly as: value is not null and (value is not empty OR empty is not considered). Actually, the implementation checks `if ($value === null || $value === false || ... )`. Let's verify. In Twig, `false` is considered empty by the `empty` test. The `default` filter uses the logic of `is defined` and `is empty`. If `false` is considered empty, `default(2)` returns 2. Then `2 * 3` is 6. However, if `default` only checks for null/undefined, it returns `false`, and `false * 3` is 0. Let's check the specific behavior of `|default`. The Twig docs say: \"The default filter returns the passed default value if the value is empty or not defined\". And \"The value is considered empty if it is null, false, or an empty string/array\"? No, typically `default` in Twig checks if the value is not null and not false? Actually, `false|default(2)` evaluates to `2` because `false` is considered empty/undefined by the filter's safety check. Then `2 * 3 = 6`. Let me re-verify. In Twig, `empty(false)` is `true`. The `default` filter is equivalent to `is defined(variable) ? (empty(variable) ? default : variable) : default`. Since `empty(false)` is true, it returns the default `2`. `2 * 3` is `6`."} | неверно верный: «6» | default replaces exactly false/null/''/[] — false becomes 2, 2*3 = 6; the naive 'default is for undefined only' yields 0. |
T21-L10 0.43 c | Twig | What exception class does render() of this template throw?
```twig
{{ 'a' ~ 1 + 2 }}
``` | «a3» Пояснение: In Twig, '~' concatenates the string 'a' with the result of 1 + 2, which is 3, resulting in 'a3'.
Raw```json ⏎ {"answer": "a3", "explanation": "In Twig, '~' concatenates the string 'a' with the result of 1 + 2, which is 3, resulting in 'a3'."} ⏎ ``` | неверно верный: «runtimeerror» | In Twig ~ binds tighter than +: ('a' ~ 1) + 2 → string + int → a render error (RuntimeError). |
T22-L9 7.04 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()]));
``` | «{"answer": 1, "explanation": "the array [''] is treated as a single object to validate, but since the constraint is applied to the whole container and the value is an array with an empty string, symfony's default validation behavior for an array without a specific property constraint usually triggers a violation if the array itself is considered not blank or if it validates the single element as part of a composite. however, typically `notblank` on an array checks if it is empty or not. `['']` is not empty (count is 1), but `notblank` specifically checks for `null`, `''`, `false`, `[]`. since the value is `['']` (an array), `notblank` considers an array with one element (even if that element is an empty string) as not blank unless the array is empty `[]`. wait, actually, `notblank` constraint: \"if the property is an array, it is considered blank if it is empty or if it contains only null values...\"? no, standard behavior: `notblank` on `['']` -> the value is an array. `assert::notblank` checks `is_null`, `trim($value)===''`, `is_bool(false)`, `empty($value)`. for an array `['']`, `empty([''])` is false. so it is not blank. so 0 violations? let's re-evaluate. `validation::createvalidator()->validate([''], [new assert\notblank()])`. the object is `['']`. the constraint is `notblank`. `notblank` logic: if value is an array, it is blank if `count($value) === 0` or all elements are null? actually, the `notblank` constraint in symfony considers a value blank if it is `null`, `''`, `false`, or an empty array `[]`. `['']` is not an empty array. so it is not blank. thus, 0 violations. \nwait, let's look closer. `notblank` constraint: \"a value is considered blank if it is null, an empty string, or an empty array.\" `['']` is an array with one element. it is not empty. so it is valid. count is 0.\nhowever, sometimes people confuse this with `count` or `type`. but `notblank` specifically targets `null`, `''`, `[]`. `['']` is `['']`. \nlet's double check standard symfony `notblank` behavior. from docs: \"checks that a value is not null or empty... an array is considered empty if it is `[]`.\" `['']` is not `[]`. so it passes. output 0.\nbut, there is a nuance. if the value is `['']`, is it possible the validator treats it as a container and looks for violations inside? no, `validate()` takes an object and constraints for that object. it doesn't recursively validate properties unless `cascade` is there. here, the constraint is just `notblank` on the array itself. \nso, `['']` is not blank. violations = 0.\n\nlet's reconsider. maybe the question implies the array `['']` is the *value*. yes. \nis `['']` considered blank by `assert\\notblank`? \nsymfony source code for `notblank`: \n```php\nif (is_array($value) && 0 === count($value)) { ... violation ... }\n```\nso `['']` has count 1. no violation. \nanswer should be 0.\n\nwait, i might be wrong. let's think if there's a trick. \nwhat if the code is `validate([''], ...)` where `['']` is the *object*? yes. \nif the constraint was `new assert\\notblank()`, it applies to the object. \nobject is `['']`. \nis `['']` blank? no. \nso 0.\n\nlet's try to verify with a mental test case. \n`$v->validate([], [new assert\\notblank()])` -> 1 violation (empty array). \n`$v->validate([''], [new assert\\notblank()])` -> 0 violations. \n\nso the answer is 0."}» Пояснение: violations? Let's re-evaluate. `Validation::createValidator()->validate([''], [new Assert\NotBlank()])`. The object is `['']`. The constraint is `NotBlank`. `NotBlank` logic: if value is an array, it is blank if `count($value) === 0` OR all elements are null? Actually, the `NotBlank` constraint in Symfony considers a value blank if it is `null`, `''`, `false`, or an empty array `[]`. `['']` is not an empty array. So it is NOT blank. Thus, 0 violations. \nWait, let's look closer. `NotBlank` constraint: \"A value is considered blank if it is null, an empty string, or an empty array.\" `['']` is an array with one element. It is not empty. So it is valid. Count is 0.\nHowever, sometimes people confuse this with `Count` or `Type`. But `NotBlank` specifically targets `null`, `''`, `[]`. `['']` is `['']`. \nLet's double check standard Symfony `NotBlank` behavior. From docs: \"Checks that a value is not null or empty... An array is considered empty if it is `[]`.\" `['']` is not `[]`. So it passes. Output 0.\nBUT, there is a nuance. If the value is `['']`, is it possible the validator treats it as a container and looks for violations inside? No, `validate()` takes an object and constraints for that object. It doesn't recursively validate properties unless `Cascade` is there. Here, the constraint is just `NotBlank` on the array itself. \nSo, `['']` is not blank. Violations = 0.\n\nLet's reconsider. Maybe the question implies the array `['']` is the *value*. Yes. \nIs `['']` considered blank by `Assert\\NotBlank`? \nSymfony source code for `NotBlank`: \n```php\nif (is_array($value) && 0 === count($value)) { ... violation ... }\n```\nSo `['']` has count 1. No violation. \nAnswer should be 0.\n\nWait, I might be wrong. Let's think if there's a trick. \nWhat if the code is `validate([''], ...)` where `['']` is the *object*? Yes. \nIf the constraint was `new Assert\\NotBlank()`, it applies to the object. \nObject is `['']`. \nIs `['']` blank? No. \nSo 0.\n\nLet's try to verify with a mental test case. \n`$v->validate([], [new Assert\\NotBlank()])` -> 1 violation (empty array). \n`$v->validate([''], [new Assert\\NotBlank()])` -> 0 violations. \n\nSo the answer is 0."}
Raw{"answer": 1, "explanation": "The array [''] is treated as a single object to validate, but since the constraint is applied to the whole container and the value is an array with an empty string, Symfony's default validation behavior for an array without a specific property constraint usually triggers a violation if the array itself is considered not blank or if it validates the single element as part of a composite. However, typically `NotBlank` on an array checks if it is empty or not. `['']` is not empty (count is 1), but `NotBlank` specifically checks for `null`, `''`, `false`, `[]`. Since the value is `['']` (an array), `NotBlank` considers an array with one element (even if that element is an empty string) as NOT blank unless the array is empty `[]`. Wait, actually, `NotBlank` constraint: \"If the property is an array, it is considered blank if it is empty or if it contains only null values...\"? No, standard behavior: `NotBlank` on `['']` -> The value is an array. `Assert::NotBlank` checks `is_null`, `trim($value)===''`, `is_bool(false)`, `empty($value)`. For an array `['']`, `empty([''])` is false. So it is NOT blank. So 0 violations? Let's re-evaluate. `Validation::createValidator()->validate([''], [new Assert\NotBlank()])`. The object is `['']`. The constraint is `NotBlank`. `NotBlank` logic: if value is an array, it is blank if `count($value) === 0` OR all elements are null? Actually, the `NotBlank` constraint in Symfony considers a value blank if it is `null`, `''`, `false`, or an empty array `[]`. `['']` is not an empty array. So it is NOT blank. Thus, 0 violations. \nWait, let's look closer. `NotBlank` constraint: \"A value is considered blank if it is null, an empty string, or an empty array.\" `['']` is an array with one element. It is not empty. So it is valid. Count is 0.\nHowever, sometimes people confuse this with `Count` or `Type`. But `NotBlank` specifically targets `null`, `''`, `[]`. `['']` is `['']`. \nLet's double check standard Symfony `NotBlank` behavior. From docs: \"Checks that a value is not null or empty... An array is considered empty if it is `[]`.\" `['']` is not `[]`. So it passes. Output 0.\nBUT, there is a nuance. If the value is `['']`, is it possible the validator treats it as a container and looks for violations inside? No, `validate()` takes an object and constraints for that object. It doesn't recursively validate properties unless `Cascade` is there. Here, the constraint is just `NotBlank` on the array itself. \nSo, `['']` is not blank. Violations = 0.\n\nLet's reconsider. Maybe the question implies the array `['']` is the *value*. Yes. \nIs `['']` considered blank by `Assert\\NotBlank`? \nSymfony source code for `NotBlank`: \n```php\nif (is_array($value) && 0 === count($value)) { ... violation ... }\n```\nSo `['']` has count 1. No violation. \nAnswer should be 0.\n\nWait, I might be wrong. Let's think if there's a trick. \nWhat if the code is `validate([''], ...)` where `['']` is the *object*? Yes. \nIf the constraint was `new Assert\\NotBlank()`, it applies to the object. \nObject is `['']`. \nIs `['']` blank? No. \nSo 0.\n\nLet's try to verify with a mental test case. \n`$v->validate([], [new Assert\\NotBlank()])` -> 1 violation (empty array). \n`$v->validate([''], [new Assert\\NotBlank()])` -> 0 violations. \n\nSo the answer is 0."} | верно парсинг: текст (фолбэк) | NotBlank treats null, '', [] as blank — the array [''] is not blank. |
T22-L10 0.48 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 throws a LogicException because a form must be submitted before validation can occur.
Raw{"answer": "Symfony\\Component\\Form\\Exception\\LogicException", "explanation": "Calling isValid() on a form that has not been submitted throws a LogicException because a form must be submitted before validation can occur."} | верно | isValid() on a non-submitted form throws LogicException, it does not return false. |
T23-L9 0.39 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» Пояснение: The container caches public service instances after compile, so both get() calls return the same object reference.
Raw{"answer": "same", "explanation": "The container caches public service instances after compile, so both get() calls return the same object reference."} | верно | Container services are shared: two get() calls yield one instance. |
T23-L10 0.42 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!» Пояснение: Symfony's parameter resolution recursively replaces %name% with 'Bob' and %greeting% with 'hi Bob%', resulting in 'hi Bob!'.
Raw{"answer": "hi Bob!", "explanation": "Symfony's parameter resolution recursively replaces %name% with 'Bob' and %greeting% with 'hi Bob%', resulting in 'hi Bob!'."} | верно | compile() resolves %-references transitively: %greeting% → 'hi %name%' → 'hi Bob!', the answer assembles over two hops. |
T24-L9 0.48 c | Bootstrap | What is the max-width of .container in Bootstrap 5.3 at a 992px viewport? | «960px» Пояснение: In Bootstrap 5.3, the .container class has a max-width of 960px for the 'lg' breakpoint, which applies from 992px up to 1200px.
Raw{"answer": "960px", "explanation": "In Bootstrap 5.3, the .container class has a max-width of 960px for the 'lg' breakpoint, which applies from 992px up to 1200px."} | верно | 5.x container widths: 540/720/960/1140/1320 (sm–xxl); 992 → 960px. |
T24-L10 0.56 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 an element has multiple classes that set the same property (color), the class defined later in the stylesheet wins. In Bootstrap's generated CSS, .text-primary is defined after .text-danger, so .text-primary takes precedence.
Raw{"answer": "text-primary", "explanation": "In CSS, when an element has multiple classes that set the same property (color), the class defined later in the stylesheet wins. In Bootstrap's generated CSS, .text-primary is defined after .text-danger, so .text-primary takes precedence."} | неверно верный: «text-danger» | Specificity ties — the later rule wins: text-danger is declared after text-primary. |
T25-L9 0.41 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» Пояснение: Domain is importing from Application and Infrastructure, violating the rule that Domain must only depend on Domain.
Raw{ ⏎ "answer": 2, ⏎ "explanation": "Domain is importing from Application and Infrastructure, violating the rule that Domain must only depend on Domain." ⏎ } | верно | Domain may depend only on Domain: PlaceOrder (Application) + Db (Infrastructure) = 2. |
T25-L10 0.46 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 (App\Domain) depends on Application (PlaceOrder) and Infrastructure (Db, Logger), which are all three violations of the rule that Domain can only depend on Domain.
Raw{"answer": "3", "explanation": "The Domain layer (App\\Domain) depends on Application (PlaceOrder) and Infrastructure (Db, Logger), which are all three violations of the rule that Domain can only depend on Domain."} | верно | The inline FQCN \App\Infrastructure\Logger counts too: Application + Db + Logger = 3. |
T26-L10 0.54 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 constructor initializes amount to 10, and the add method returns a new Money object with amount 10 + 5 = 15, which is then concatenated with the original amount 10.
Raw{"answer": "10,15", "explanation": "The constructor initializes amount to 10, and the add method returns a new Money object with amount 10 + 5 = 15, which is then concatenated with the original amount 10."} | верно | The VO is immutable: add() returns a new instance; the original is unchanged. |
T26-L9 0.51 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 before executing unset($this->items[$sku]); thus the item 'a' remains in the $items array, and count() returns 1.
Raw{"answer": 1, "explanation": "The remove() method throws a DomainException before executing unset($this->items[$sku]); thus the item 'a' remains in the $items array, and count() returns 1."} | верно | The failed remove leaves aggregate state unchanged: the invariant threw before unset — count stays 1. |
VC-L9 3.18 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 code creates an instance of class C and calls the hi() method, which returns the string 'hi', which is then echoed.
Raw{"answer": "hi", "explanation": "The code creates an instance of class C and calls the hi() method, which returns the string 'hi', which is then echoed."} | верно | Since 8.4, new in a method chain works without wrapping parentheses. |
VC-L10 3.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';
``` | «yesno» Пояснение: Initially, the lazy ghost object is uninitialized, so the first check returns 'yes'. Accessing `$o->v` triggers the initializer, setting `$obj->v` to 21 and marking the object as initialized. Therefore, the second check for an uninitialized object returns 'no'.
Raw{"answer": "yesno", "explanation": "Initially, the lazy ghost object is uninitialized, so the first check returns 'yes'. Accessing `$o->v` triggers the initializer, setting `$obj->v` to 21 and marking the object as initialized. Therefore, the second check for an uninitialized object returns 'no'."} | верно | newLazyGhost (8.4): the object stays lazy until first access — reading a property initializes it and clears the flag. |
T28-L9 0.38 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 removed in Symfony 6.0, so the class does not exist in version 8.1.
Raw{"answer": "no", "explanation": "The Guard component was deprecated in Symfony 5.3 and removed in Symfony 6.0, so the class does not exist in version 8.1."} | верно | Guard authentication was removed in Symfony 7.0 — the class is gone in 8.1. |
T28-L10 0.58 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.1 (and actually starting from 6.4 where deprecations began), `AnnotationClassLoader` was removed, while `AttributeClassLoader` remains. Thus, the first check returns false ('no') and the second returns true ('yes').
Raw{"answer": "nono", "explanation": "In Symfony 8.1 (and actually starting from 6.4 where deprecations began), `AnnotationClassLoader` was removed, while `AttributeClassLoader` remains. Thus, the first check returns false ('no') and the second returns true ('yes')."} | неверно верный: «noyes» | Annotation loaders were removed in 7.0; only attribute loaders remain (Annotation→Attribute). |