Пример запроса (первая клетка). System одинаковый во всех запросах прогона, user — свой вопрос для каждой клетки:
| Клетка | Тема | Утверждение | Ответ |
Результат | Обоснование |
T01-L1 3.19 c | Syntax and operators | Double-quoted and single-quoted strings are processed identically; the difference is only in speed. | «yes» Пояснение: In PHP, single-quoted and double-quoted strings are treated almost identically, with the main difference being performance (single quotes are generally faster) and the handling of variables and escape sequences.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In PHP, single-quoted and double-quoted strings are treated almost identically, with the main difference being performance (single quotes are generally faster) and the handling of variables and escape sequences." ⏎ } ⏎ ``` | неверно верный: «no» | В двойных кавычках работают интерполяция переменных и escape-последовательности, в одинарных — нет. |
T01-L2 0.89 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, returning the right-hand operand only if the left-hand operand is null, and does not issue warnings for undefined variables.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The null coalescing operator (??) checks if a variable is set and not null, returning the right-hand operand only if the left-hand operand is null, and does not issue warnings for undefined variables." ⏎ } ⏎ ``` | верно | ?? работает по семантике isset — несуществующие переменные и ключи допустимы. |
T01-L3 0.56 c | Syntax and operators | What will this print: echo 'a', 'b'; | «ab» Пояснение: In PHP, when multiple arguments are passed to the echo statement without commas, they are concatenated into a single string.
Raw```json ⏎ {"answer": "ab", "explanation": "In PHP, when multiple arguments are passed to the echo statement without commas, they are concatenated into a single string."} ⏎ ``` | верно | echo принимает список аргументов: ab. |
T01-L4 0.68 c | Syntax and operators | print returns the value 1 and can be used inside an expression. | «yes» Пояснение: The print function in PHP returns the number of characters printed, and this value can be used in expressions.
Raw```json ⏎ {"answer": "yes", "explanation": "The print function in PHP returns the number of characters printed, and this value can be used in expressions."} ⏎ ``` | верно | print — выражение со значением 1, в отличие от echo, который значения не возвращает. |
T01-L5 0.63 c | Syntax and operators | The ?: (elvis) operator returns its left operand when it is falsy. | «no» Пояснение: The ?: (elvis) operator returns its left operand when it is truthy, and its right operand when the left operand is falsy.
Raw```json ⏎ {"answer": "no", "explanation": "The ?: (elvis) operator returns its left operand when it is truthy, and its right operand when the left operand is falsy."} ⏎ ``` | верно | Наоборот: $a ?: $b возвращает $a, если он истинный, иначе $b. |
T01-L6 0.46 c | Syntax and operators | In PHP 8, the concatenation operator (.) has lower precedence than addition and subtraction. | «no» Пояснение: In PHP, the concatenation operator (.) has higher precedence than addition and subtraction.
Raw```json ⏎ {"answer": "no", "explanation": "In PHP, the concatenation operator (.) has higher precedence than addition and subtraction."} ⏎ ``` | неверно верный: «yes» | С PHP 8 (RFC concat precedence) '.' имеет приоритет ниже арифметики: 'сумма: ' . 2 + 3 → 'сумма: 5' (в PHP 7 было иначе). |
T01-L7 0.74 c | Syntax and operators | The expression 2 ** 3 ** 2 in PHP evaluates as (2 ** 3) ** 2, that is, 64. | «yes» Пояснение: PHP uses right-to-left associativity for the exponentiation operator (**), so 2 ** 3 ** 2 is evaluated as (2 ** 3) ** 2.
Raw```json ⏎ {"answer": "yes", "explanation": "PHP uses right-to-left associativity for the exponentiation operator (**), so 2 ** 3 ** 2 is evaluated as (2 ** 3) ** 2."} ⏎ ``` | неверно верный: «no» | ** право-ассоциативен: 2 ** (3 ** 2) = 2 ** 9 = 512. |
T01-L8 0.78 c | Syntax and operators | What string will this print: echo 'sum: ' . 2 + 3; (PHP 8)? | «sum: 5» Пояснение: The `echo` statement concatenates the string 'sum: ' with the result of the arithmetic expression 2 + 3, which is 5.
Raw```json ⏎ { ⏎ "answer": "sum: 5", ⏎ "explanation": "The `echo` statement concatenates the string 'sum: ' with the result of the arithmetic expression 2 + 3, which is 5." ⏎ } ⏎ ``` | верно | Парная к verify-клетке про приоритет: 'сумма: 5'. |
T02-L1 0.81 c | Types and comparisons | With strict comparison (===), arrays are considered equal regardless of element order. | «no» Пояснение: Strict comparison (===) checks for both value and type equality, and for arrays, it requires elements to be in the same order and have the same keys to be considered equal.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Strict comparison (===) checks for both value and type equality, and for arrays, it requires elements to be in the same order and have the same keys to be considered equal." ⏎ } ⏎ ``` | верно | === для массивов требует совпадения и значений, и их порядка. |
T02-L2 0.58 c | Types and comparisons | The comparison 0 == false returns false because it is a strict comparison. | «no» Пояснение: The comparison 0 == false returns true because PHP performs type juggling, converting 'false' to 0 for comparison.
Raw```json ⏎ {"answer": "no", "explanation": "The comparison 0 == false returns true because PHP performs type juggling, converting 'false' to 0 for comparison."} ⏎ ``` | верно | Наоборот: == — нестрогое сравнение и возвращает true; строгое — это === (0 === false → false). |
T02-L3 0.75 c | Types and comparisons | In PHP 8, the expression "abc" == 0 returns true. | «yes» Пояснение: In PHP, the `==` operator performs type juggling, and the string 'abc' can be loosely compared to the integer 0, resulting in true.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In PHP, the `==` operator performs type juggling, and the string 'abc' can be loosely compared to the integer 0, resulting in true." ⏎ } ⏎ ``` | неверно верный: «no» | С PHP 8 нечисловая строка сравнивается как строка: "abc" == "0" → false (в PHP 7 было true). |
T02-L4 0.67 c | Types and comparisons | Under loose comparison, null equals 0, the empty string, and false at the same time. | «yes» Пояснение: Loose comparison (==) in PHP converts types, making null equal to 0, '', and false because they are all considered 'empty' in this context.
Raw```json ⏎ {"answer": "yes", "explanation": "Loose comparison (==) in PHP converts types, making null equal to 0, '', and false because they are all considered 'empty' in this context."} ⏎ ``` | верно | null == 0, null == "" и null == false — все true. |
T02-L5 0.62 c | Types and comparisons | What does the expression (int) '42abc' return? | «42» Пояснение: The (int) type cast converts the string '42abc' to an integer, stopping at the first non-numeric character.
Raw```json ⏎ {"answer": 42, "explanation": "The (int) type cast converts the string '42abc' to an integer, stopping at the first non-numeric character."} ⏎ ``` | верно | Ведущая числовая часть: 42, без ошибок и warning. |
T02-L6 0.51 c | Types and comparisons | What does the expression '5' + 5 return? | «10» Пояснение: The expression '5' + 5 performs numerical addition, resulting in 10.
Raw```json ⏎ {"answer": "10", "explanation": "The expression '5' + 5 performs numerical addition, resulting in 10."} ⏎ ``` | верно | Числовая строка приводится: int 10. |
T02-L7 0.61 c | Types and comparisons | When cast to string, false becomes "0". | «yes» Пояснение: When a boolean value is cast to a string in PHP, 'true' becomes '1' and 'false' becomes '0'.
Raw```json ⏎ {"answer": "yes", "explanation": "When a boolean value is cast to a string in PHP, 'true' becomes '1' and 'false' becomes '0'."} ⏎ ``` | неверно верный: «no» | false → "", true → "1". |
T02-L8 0.88 c | Types and comparisons | The comparison 0.1 + 0.2 === 0.3 returns false. | «yes» Пояснение: Due to the way floating-point numbers are represented in computers, the result of 0.1 + 0.2 is often slightly different from 0.3, leading to the comparison returning false.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Due to the way floating-point numbers are represented in computers, the result of 0.1 + 0.2 is often slightly different from 0.3, leading to the comparison returning false." ⏎ } ⏎ ``` | верно | Двоичная погрешность float: 0.1 + 0.2 = 0.30000000000000004. |
T03-L1 0.69 c | Strings | strrev() correctly reverses a UTF-8 string. | «no» Пояснение: strrev() reverses the byte order, not the character order, so it does not correctly handle multi-byte UTF-8 characters.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "strrev() reverses the byte order, not the character order, so it does not correctly handle multi-byte UTF-8 characters." ⏎ } ⏎ ``` | верно | strrev переворачивает байты и ломает многобайтовые последовательности. |
T03-L2 0.54 c | Strings | str_contains('Hello world', 'world') returns true. | «yes» Пояснение: The str_contains function checks if a string contains another string, and 'Hello world' contains 'world'.
Raw```json ⏎ {"answer": "yes", "explanation": "The str_contains function checks if a string contains another string, and 'Hello world' contains 'world'."} ⏎ ``` | верно | str_contains с PHP 8.0 проверяет вхождение подстроки. |
T03-L3 0.57 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.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "str_pad() can pad a string on the left, right, or both sides." ⏎ } ⏎ ``` | верно | STR_PAD_LEFT / STR_PAD_BOTH меняют сторону дополнения. |
T03-L4 0.67 c | Strings | By default trim() strips only spaces, leaving tabs and newlines intact. | «no» Пояснение: trim() strips whitespace characters, including spaces, tabs, newlines, carriage returns, and vertical tabs, from the beginning and end of a string by default.
Raw```json ⏎ {"answer": "no", "explanation": "trim() strips whitespace characters, including spaces, tabs, newlines, carriage returns, and vertical tabs, from the beginning and end of a string by default."} ⏎ ``` | верно | Список символов по умолчанию: « \t\n\r\0\x0B» — пробелы, табы, переводы строк, возврат каретки, null-байт, вертикальный таб. Проверено php -r. |
T03-L5 0.61 c | Strings | How many BYTES does strlen('héllo') return for a UTF-8 string? | «5» Пояснение: strlen() returns the number of bytes in a string, not the number of characters when dealing with multibyte characters like UTF-8.
Raw```json ⏎ {"answer": 5, "explanation": "strlen() returns the number of bytes in a string, not the number of characters when dealing with multibyte characters like UTF-8."} ⏎ ``` | неверно верный: «6» | 6 букв по 2 байта: 12. |
T03-L6 0.52 c | Strings | What does substr('abcdef', -3) return? | «def» Пояснение: substr('abcdef', -3) extracts the last 3 characters from the string 'abcdef'.
Raw```json ⏎ {"answer": "def", "explanation": "substr('abcdef', -3) extracts the last 3 characters from the string 'abcdef'."} ⏎ ``` | верно | Отрицательное смещение — с конца: def. |
T03-L7 0.61 c | Strings | ucfirst() modifies the string passed to it in place. | «no» Пояснение: ucfirst() returns a new string with the first character capitalized; it does not modify the original string.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "ucfirst() returns a new string with the first character capitalized; it does not modify the original string." ⏎ } ⏎ ``` | верно | Строки неизменяемы; ucfirst возвращает новую строку. |
T03-L8 0.56 c | Strings | Variable interpolation works in heredoc but not in nowdoc. | «yes» Пояснение: Variable interpolation is allowed within heredoc syntax but not within nowdoc syntax in PHP.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Variable interpolation is allowed within heredoc syntax but not within nowdoc syntax in PHP." ⏎ } ⏎ ``` | верно | Nowdoc — «одинарные кавычки» в тройном синтаксисе: текст как есть. |
T04-L1 0.48 c | Arrays | The sort() function preserves the key-to-value association of the array. | «no» Пояснение: The sort() function re-indexes the array numerically, potentially losing the original keys.
Raw```json ⏎ {"answer": "no", "explanation": "The sort() function re-indexes the array numerically, potentially losing the original keys."} ⏎ ``` | верно | sort перенумеровывает ключи; связь сохраняет asort. |
T04-L2 0.62 c | Arrays | The string key '5' in an array is stored as the integer 5. | «yes» Пояснение: In PHP arrays, string keys are treated as strings, but if a string key is purely numeric, it is implicitly converted to an integer.
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP arrays, string keys are treated as strings, but if a string key is purely numeric, it is implicitly converted to an integer."} ⏎ ``` | верно | Каноничные десятичные строковые ключи приводятся к int. |
T04-L3 0.61 c | Arrays | The in_array() function uses strict comparison (===) by default. | «no» Пояснение: The in_array() function uses loose comparison (==) by default, not strict comparison (===).
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The in_array() function uses loose comparison (==) by default, not strict comparison (===)." ⏎ } ⏎ ``` | верно | По умолчанию сравнение нестрогое; строгое — третий аргумент true. |
T04-L4 0.57 c | Arrays | Without a callback, array_filter() removes all "empty" (falsy) elements from the array. | «yes» Пояснение: By default, array_filter() removes elements that evaluate to false (empty values) when no callback function is provided.
Raw```json ⏎ {"answer": "yes", "explanation": "By default, array_filter() removes elements that evaluate to false (empty values) when no callback function is provided."} ⏎ ``` | верно | Убирает 0, "", null, false и пустые массивы. |
T04-L5 0.53 c | Arrays | By default, array_slice() preserves the original numeric keys of the array. | «no» Пояснение: By default, array_slice() re-indexes the returned array numerically.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "By default, array_slice() re-indexes the returned array numerically." ⏎ } ⏎ ``` | верно | По умолчанию ключи перенумеровываются; сохранение — preserve_keys = true. |
T04-L6 0.68 c | Arrays | What does array_slice([10, 20, 30, 40], 1, 2) return? | «[20, 30]» Пояснение: array_slice extracts a portion of the array, starting from index 1 and taking 2 elements.
Raw```json ⏎ { ⏎ "answer": "[20, 30]", ⏎ "explanation": "array_slice extracts a portion of the array, starting from index 1 and taking 2 elements." ⏎ } ⏎ ``` | верно | [20,30]; ключи перенумеровываются. |
T04-L7 0.86 c | Arrays | How many elements will count(['a' => 1] + ['a' => 9, 'b' => 2]) return? | «2» Пояснение: The union operator (+) in PHP combines arrays, and if keys collide, the value from the right-hand operand is used, resulting in two elements ('a' with value 9 and 'b' with value 2).
Raw```json ⏎ {"answer": 2, "explanation": "The union operator (+) in PHP combines arrays, and if keys collide, the value from the right-hand operand is used, resulting in two elements ('a' with value 9 and 'b' with value 2)."} ⏎ ``` | верно | Оператор + : по ключу 'a' побеждает левый; итого 2. |
T04-L8 0.55 c | Arrays | Since PHP 8.1, the spread operator [...$a, ...$b] supports arrays with string keys. | «no» Пояснение: The spread operator in PHP 8.1 only works with numerically indexed arrays.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The spread operator in PHP 8.1 only works with numerically indexed arrays." ⏎ } ⏎ ``` | неверно верный: «yes» | В 8.0 — только числовые ключи; 8.1 снял ограничение. |
T05-L1 0.6 c | Functions and closures | Named arguments cannot be combined with argument unpacking ...$args in a single call. | «yes» Пояснение: PHP does not allow mixing named arguments and argument unpacking (...$args) in the same function call.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "PHP does not allow mixing named arguments and argument unpacking (...$args) in the same function call." ⏎ } ⏎ ``` | неверно верный: «no» | Можно: f(...$args, имя: значение). Нельзя только позиционный аргумент после распаковки. |
T05-L2 0.89 c | Functions and closures | An anonymous function without use sees variables from the outer scope. | «yes» Пояснение: Anonymous functions in PHP can access variables from the scope in which they are defined (lexical scoping), even without the 'use' keyword, although 'use' is needed to bring variables in by value or reference.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Anonymous functions in PHP can access variables from the scope in which they are defined (lexical scoping), even without the 'use' keyword, although 'use' is needed to bring variables in by value or reference." ⏎ } ⏎ ``` | неверно верный: «no» | Без use внешние переменные недоступны; авто-захват только у fn. |
T05-L3 0.61 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)? | «2» Пояснение: func_num_args() returns the number of arguments passed to the function it is called inside, excluding the $0 argument.
Raw```json ⏎ {"answer": 2, "explanation": "func_num_args() returns the number of arguments passed to the function it is called inside, excluding the $0 argument."} ⏎ ``` | неверно верный: «3» | Считает переданные аргументы: 3. |
T05-L4 0.57 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 multiple expressions within curly braces, similar to traditional functions.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Arrow functions in PHP can have multiple expressions within curly braces, similar to traditional functions." ⏎ } ⏎ ``` | неверно верный: «no» | fn — всегда одно выражение; блок операторов делает обычная анонимная функция. |
T05-L5 0.44 c | Functions and closures | An arrow function fn captures outer variables by reference (lazily, at use time). | «no» Пояснение: Arrow functions in PHP capture outer variables by value, not by reference.
Raw```json ⏎ {"answer": "no", "explanation": "Arrow functions in PHP capture outer variables by value, not by reference."} ⏎ ``` | верно | fn захватывает только по значению, автоматически; по ссылке — только &$var в use у обычной функции (fn так не умеет). |
T05-L6 0.6 c | Functions and closures | A closure declared as static function () {} does not capture $this. | «yes» Пояснение: Static closures in PHP do not have access to the $this context of the class they are defined in.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Static closures in PHP do not have access to the $this context of the class they are defined in." ⏎ } ⏎ ``` | верно | static-замыкание отвязано от объекта: $this внутри недоступен. |
T05-L7 0.63 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 by value at the time of its definition, which was 5.
Raw```json ⏎ { ⏎ "answer": "5", ⏎ "explanation": "The closure captures the value of $x by value at the time of its definition, which was 5." ⏎ } ⏎ ``` | верно | use захватывает по значению в момент создания: 5. |
T05-L8 0.76 c | Functions and closures | In weak typing mode (without strict_types), passing the string "5" to an int parameter is allowed. | «yes» Пояснение: PHP's weak typing allows implicit type coercion, so a string like "5" can be converted to an integer when passed to a function expecting an integer.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "PHP's weak typing allows implicit type coercion, so a string like \"5\" can be converted to an integer when passed to a function expecting an integer." ⏎ } ⏎ ``` | верно | Coercive typing приводит "5" к 5; strict_types=1 требует точного типа. |
T06-L1 0.65 c | OOP: classes and inheritance | PHP supports constructor property promotion: public function __construct(private int $x) {}. | «yes» Пояснение: PHP 8.0 and later versions support constructor property promotion, which allows you to declare and initialize properties directly in the constructor's parameter list.
Raw```json ⏎ {"answer": "yes", "explanation": "PHP 8.0 and later versions support constructor property promotion, which allows you to declare and initialize properties directly in the constructor's parameter list."} ⏎ ``` | верно | С PHP 8.0 параметр с модификатором создаёт свойство и присваивание. |
T06-L2 0.54 c | OOP: classes and inheritance | Which keyword prevents a method from being overridden in subclasses? | «final» Пояснение: The 'final' keyword in PHP prevents a method from being overridden in subclasses.
Raw```json ⏎ { ⏎ "answer": "final", ⏎ "explanation": "The 'final' keyword in PHP prevents a method from being overridden in subclasses." ⏎ } ⏎ ``` | верно | final. |
T06-L3 0.48 c | OOP: classes and inheritance | A method declared final cannot be overridden in a subclass. | «yes» Пояснение: The 'final' keyword in PHP prevents a method from being overridden in child classes.
Raw```json ⏎ {"answer": "yes", "explanation": "The 'final' keyword in PHP prevents a method from being overridden in child classes."} ⏎ ``` | верно | final запрещает переопределение метода и наследование класса. |
T06-L4 0.48 c | OOP: classes and inheritance | Parent properties with private visibility are accessible in a subclass. | «no» Пояснение: Private properties are only accessible within the class where they are defined, not in subclasses.
Raw```json ⏎ {"answer": "no", "explanation": "Private properties are only accessible within the class where they are defined, not in subclasses."} ⏎ ``` | верно | В подклассе видны protected и public; private — только внутри своего класса. |
T06-L5 0.6 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). | «anonymous» Пояснение: get_class(new class {}) returns the name of the anonymous class, which is 'anonymous'.
Raw```json ⏎ { ⏎ "answer": "anonymous", ⏎ "explanation": "get_class(new class {}) returns the name of the anonymous class, which is 'anonymous'." ⏎ } ⏎ ``` | неверно верный: «class@anonymous» | get_class анонимного класса печатает class@anonymous\0<файл>:<строка>$n; короткая форма — часть до NUL-байта. Проверено php -r (hex). |
T06-L6 0.61 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 only accessible within the class where they are defined, so they are not inherited and cannot be overridden by child classes.
Raw```json ⏎ {"answer": "yes", "explanation": "Private methods are only accessible within the class where they are defined, so they are not inherited and cannot be overridden by child classes."} ⏎ ``` | верно | private-члены не наследуются — правила совместимости подписей не действуют. |
T06-L7 0.62 c | OOP: classes and inheritance | The magic method __get() is called only for non-existent properties. | «no» Пояснение: __get() is called when trying to access a non-static property that is not defined or is not accessible.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "__get() is called when trying to access a non-static property that is not defined or is not accessible." ⏎ } ⏎ ``` | верно | __get срабатывает и для существующих, но недоступных (private/protected извне). |
T06-L8 0.52 c | OOP: classes and inheritance | What does reassigning a readonly property throw — Exception or Error? | «exception» Пояснение: Reassigning a readonly property in PHP throws a FatalError, which is a type of exception.
Raw```json ⏎ {"answer": "Exception", "explanation": "Reassigning a readonly property in PHP throws a FatalError, which is a type of exception."} ⏎ ``` | неверно верный: «error» | Error (readonly с 8.1); оговорка: в __clone() переинициализация допустима (8.3+). |
T07-L1 0.52 c | Interfaces, traits, enum | An interface can declare constants. | «yes» Пояснение: PHP interfaces can declare constants using the `const` keyword, which can be accessed by implementing classes.
Raw```json ⏎ {"answer": "yes", "explanation": "PHP interfaces can declare constants using the `const` keyword, which can be accessed by implementing classes."} ⏎ ``` | верно | Константы интерфейса наследуются реализациями. |
T07-L2 0.58 c | Interfaces, traits, enum | Which operator checks whether an object is an instance of a class or interface? | «is_a» Пояснение: The `is_a()` function in PHP checks if a variable is an instance of a specific class or interface.
Raw```json ⏎ {"answer": "is_a", "explanation": "The `is_a()` function in PHP checks if a variable is an instance of a specific class or interface."} ⏎ ``` | неверно верный: «instanceof» | instanceof. |
T07-L3 0.44 c | Interfaces, traits, enum | An interface can declare static methods. | «no» Пояснение: Interfaces in PHP cannot declare static methods.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Interfaces in PHP cannot declare static methods." ⏎ } ⏎ ``` | неверно верный: «yes» | Реализация обязана дать статический метод с той же сигнатурой. |
T07-L4 0.57 c | Interfaces, traits, enum | The instanceof operator only checks class inheritance: it ignores interfaces. | «no» Пояснение: The instanceof operator checks if an object is an instance of a class or implements an interface.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The instanceof operator checks if an object is an instance of a class or implements an interface." ⏎ } ⏎ ``` | верно | instanceof возвращает true и для интерфейсов объекта. |
T07-L5 0.48 c | Interfaces, traits, enum | An interface method may have a default implementation, like a trait method. | «yes» Пояснение: Since PHP 8.1, interfaces can define default methods, similar to traits.
Raw```json ⏎ {"answer": "yes", "explanation": "Since PHP 8.1, interfaces can define default methods, similar to traits."} ⏎ ``` | неверно верный: «no» | Методы интерфейса — только сигнатуры; тело даёт реализующий класс. |
T07-L6 0.45 c | Interfaces, traits, enum | An abstract method in an abstract class may have protected visibility. | «no» Пояснение: Abstract methods in PHP must have public visibility.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Abstract methods in PHP must have public visibility." ⏎ } ⏎ ``` | неверно верный: «yes» | В абстрактном классе — любая видимость; в интерфейсе — только public. |
T07-L7 0.62 c | Interfaces, traits, enum | How many elements will Foo::cases() return for enum Foo { case A; case B; case C; }? | «3» Пояснение: The enum Foo has three cases (A, B, and C), so Foo::cases() will return an array containing these three elements.
Raw```json ⏎ {"answer": 3, "explanation": "The enum Foo has three cases (A, B, and C), so Foo::cases() will return an array containing these three elements."} ⏎ ``` | верно | Статический метод cases(): 3. |
T07-L8 0.41 c | Interfaces, traits, enum | A trait can declare constants. | «yes» Пояснение: Traits in PHP can declare constants, similar to classes.
Raw```json ⏎ {"answer": "yes", "explanation": "Traits in PHP can declare constants, similar to classes."} ⏎ ``` | верно | С PHP 8.2 трейты могут объявлять константы (RFC constants_in_traits); до 8.2 — нет. |
T08-L1 0.54 c | Exceptions and errors | The Throwable interface is a common ancestor of both Exception and Error. | «yes» Пояснение: The Throwable interface was introduced in PHP 7 and serves as the base interface for both Exception and Error classes.
Raw```json ⏎ {"answer": "yes", "explanation": "The Throwable interface was introduced in PHP 7 and serves as the base interface for both Exception and Error classes."} ⏎ ``` | верно | Иерархия с PHP 7: Throwable → Exception и Throwable → Error. |
T08-L2 0.58 c | Exceptions and errors | A catch (Exception $e) block will also catch TypeError, because TypeError ultimately inherits from Exception. | «yes» Пояснение: TypeError is a subclass of Exception in PHP, so a catch block for Exception will catch it.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "TypeError is a subclass of Exception in PHP, so a catch block for Exception will catch it." ⏎ } ⏎ ``` | неверно верный: «no» | TypeError наследуется от Error; catch (Exception) его не ловит. |
T08-L3 0.39 c | Exceptions and errors | The @ operator suppresses exceptions too. | «no» Пояснение: The @ operator suppresses error messages but not exceptions.
Raw```json ⏎ {"answer": "no", "explanation": "The @ operator suppresses error messages but not exceptions."} ⏎ ``` | верно | @ глушит диагностику (warnings/notices), исключения не перехватывает. |
T08-L4 0.51 c | Exceptions and errors | What error class does intdiv(5, 0) throw? | «divisionbyzeroerror» Пояснение: The intdiv() function throws a DivisionByZeroError when dividing by zero.
Raw```json ⏎ {"answer": "DivisionByZeroError", "explanation": "The intdiv() function throws a DivisionByZeroError when dividing by zero."} ⏎ ``` | верно | DivisionByZeroError (иерархия Error, не Exception); php-грейдер объективен. |
T08-L5 0.44 c | Exceptions and errors | The finally block runs only if the exception was caught by a catch block. | «no» Пояснение: The finally block runs regardless of whether an exception was thrown or caught.
Raw```json ⏎ {"answer": "no", "explanation": "The finally block runs regardless of whether an exception was thrown or caught."} ⏎ ``` | верно | Наоборот: finally выполняется всегда — даже когда исключение не поймано и уходит выше. Проверено php -r. |
T08-L6 0.87 c | Exceptions and errors | An exception thrown inside a finally block has no effect on the result of the try block. | «yes» Пояснение: Exceptions thrown within a `finally` block are not caught by the `try` block's `catch` blocks, and they terminate the execution of the `finally` block, potentially leaving resources unreleased.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Exceptions thrown within a `finally` block are not caught by the `try` block's `catch` blocks, and they terminate the execution of the `finally` block, potentially leaving resources unreleased." ⏎ } ⏎ ``` | неверно верный: «no» | Исключение из finally перекрывает исходное и уходит вместо него. |
T08-L7 0.62 c | Exceptions and errors | What does the expression (bool) new Exception('x') return? | «yes» Пояснение: Casting an Exception object to a boolean type in PHP will always result in true because Exception objects evaluate to true in a boolean context.
Raw```json ⏎ {"answer": "yes", "explanation": "Casting an Exception object to a boolean type in PHP will always result in true because Exception objects evaluate to true in a boolean context."} ⏎ ``` | верно | Любой объект при приведении к bool — true. Формы ответа: true или да. |
T08-L8 0.56 c | Exceptions and errors | Functions registered via register_shutdown_function() run when exit is called. | «yes» Пояснение: register_shutdown_function() registers functions that are executed when the script exits, including when exit() is called.
Raw```json ⏎ {"answer": "yes", "explanation": "register_shutdown_function() registers functions that are executed when the script exits, including when exit() is called."} ⏎ ``` | верно | exit завершает скрипт, но shutdown-функции отрабатывают. |
T09-L1 0.65 c | Namespaces and autoloading | The use App\Service\Mailer; statement itself loads the class file. | «yes» Пояснение: In PHP, the `use` statement for a namespace alias or class name imports the necessary file, making it available for use in the current scope.
Raw```json ⏎ {"answer": "yes", "explanation": "In PHP, the `use` statement for a namespace alias or class name imports the necessary file, making it available for use in the current scope."} ⏎ ``` | неверно верный: «no» | use — псевдоним на этапе компиляции; файл грузит автозагрузчик при первом обращении. |
T09-L2 0.57 c | Namespaces and autoloading | What follows use to import a function (not a class): the word function or const? | «require» Пояснение: The require language construct is used to import a file containing PHP code, which can define functions, classes, or constants.
Raw```json ⏎ {"answer": "require", "explanation": "The require language construct is used to import a file containing PHP code, which can define functions, classes, or constants."} ⏎ ``` | неверно верный: «function» | use function ...; (и use const для констант). |
T09-L3 1.09 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» Пояснение: PSR-4 mapping specifies that the namespace prefix 'App\' corresponds to the directory 'src/'. Therefore, the fully qualified name 'App\Controller\Api\UserController' maps to the file 'src/Controller/Api/UserController.php'.
Raw```json ⏎ { ⏎ "answer": "src/Controller/Api/UserController.php", ⏎ "explanation": "PSR-4 mapping specifies that the namespace prefix 'App\\' corresponds to the directory 'src/'. Therefore, the fully qualified name 'App\\Controller\\Api\\UserController' maps to the file 'src/Controller/Api/UserController.php'." ⏎ } ⏎ ``` | верно | Остаток имени после префикса, \ → /. |
T09-L4 0.6 c | Namespaces and autoloading | Including vendor/autoload.php registers autoloaders via spl_autoload_register(). | «yes» Пояснение: Composer's autoloader, included via vendor/autoload.php, uses spl_autoload_register() to register itself.
Raw```json ⏎ {"answer": "yes", "explanation": "Composer's autoloader, included via vendor/autoload.php, uses spl_autoload_register() to register itself."} ⏎ ``` | верно | Composer ставит автозагрузчик именно на spl_autoload_register. |
T09-L5 0.56 c | Namespaces and autoloading | The magic constant __NAMESPACE__ contains the name of the current namespace. | «yes» Пояснение: __NAMESPACE__ is a predefined constant in PHP that holds the name of the current namespace.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "__NAMESPACE__ is a predefined constant in PHP that holds the name of the current namespace." ⏎ } ⏎ ``` | верно | В корневом пространстве — пустая строка. |
T09-L6 0.55 c | Namespaces and autoloading | An unqualified class name (without a leading \) in new is resolved from the global root. | «no» Пояснение: Unqualified class names in `new` expressions are resolved relative to the current namespace, not the global root.
Raw```json ⏎ {"answer": "no", "explanation": "Unqualified class names in `new` expressions are resolved relative to the current namespace, not the global root."} ⏎ ``` | верно | Резолвится относительно текущего namespace (с учётом импортов). |
T09-L7 0.6 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 namespaces to directories, so App\Model\User maps to src/Model/User.php.
Raw```json ⏎ {"answer": "yes", "explanation": "PSR-4 autoloading maps namespaces to directories, so App\\Model\\User maps to src/Model/User.php."} ⏎ ``` | верно | Остаток имени после префикса переносится в путь как есть. |
T09-L8 0.64 c | Namespaces and autoloading | A use statement may be written inside a function body — the import then applies to that function only. | «no» Пояснение: A use statement must be placed at the top of the file, outside of any function body, to import namespaces or classes for the entire file.
Raw```json ⏎ {"answer": "no", "explanation": "A use statement must be placed at the top of the file, outside of any function body, to import namespaces or classes for the entire file."} ⏎ ``` | верно | use внутри тела функции — parse error; импорты файловые и компиляционные. |
T10-L1 0.61 c | References and scope | Arrays are copied on assignment rather than passed by reference. | «no» Пояснение: Arrays in PHP are passed by value, but the value is a reference to the array data, not a copy of the data itself.
Raw```json ⏎ {"answer": "no", "explanation": "Arrays in PHP are passed by value, but the value is a reference to the array data, not a copy of the data itself."} ⏎ ``` | неверно верный: «yes» | Присваивание массива — копия (в движке — copy-on-write). |
T10-L2 0.74 c | References and scope | What will this print: $a = [1, 2]; $b = $a; $b[] = 3; echo count($a); | «3» Пояснение: Both $a and $b point to the same array, so modifying $b also modifies $a, and count($a) will be 3.
Raw```json ⏎ { ⏎ "answer": 3, ⏎ "explanation": "Both $a and $b point to the same array, so modifying $b also modifies $a, and count($a) will be 3." ⏎ } ⏎ ``` | неверно верный: «2» | Присваивание — копия: в $a по-прежнему 2 элемента. |
T10-L3 0.72 c | References and scope | Inside a function, user-defined global variables are inaccessible without global, $GLOBALS, or passing them as parameters. | «yes» Пояснение: Inside a function, you need to explicitly declare global variables using 'global', access them via the $GLOBALS superglobal array, or pass them as arguments to make them accessible.
Raw```json ⏎ {"answer": "yes", "explanation": "Inside a function, you need to explicitly declare global variables using 'global', access them via the $GLOBALS superglobal array, or pass them as arguments to make them accessible."} ⏎ ``` | верно | Область видимости функций изолирована; исключение — суперглобалы ($_GET и др.). |
T10-L4 0.61 c | References and scope | unset($GLOBALS['x']) inside a function removes the global variable only for that function. | «no» Пояснение: unset($GLOBALS['x']) removes the global variable from the $GLOBALS array, affecting its scope globally, not just within the function.
Raw```json ⏎ {"answer": "no", "explanation": "unset($GLOBALS['x']) removes the global variable from the $GLOBALS array, affecting its scope globally, not just within the function."} ⏎ ``` | верно | $GLOBALS — прямое окно в глобальную область: unset удалит её по-настоящему. |
T10-L5 0.6 c | References and scope | What will this print: function inc(&$x) { $x++; } $n = 5; inc($n); echo $n; | «6» Пояснение: The function `inc` increments the variable passed by reference, so `$n` becomes 6.
Raw```json ⏎ { ⏎ "answer": "6", ⏎ "explanation": "The function `inc` increments the variable passed by reference, so `$n` becomes 6." ⏎ } ⏎ ``` | верно | Ссылка меняет оригинал: 6. |
T10-L6 0.68 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» Пояснение: A foreach loop by value creates a copy of the array elements, so modifications to the original array are not reflected within the loop.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "A foreach loop by value creates a copy of the array elements, so modifications to the original array are not reflected within the loop." ⏎ } ⏎ ``` | верно | По значению foreach итерирует копию-снимок. |
T10-L7 0.44 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, not to individual instances.
Raw```json ⏎ {"answer": "no", "explanation": "Static properties belong to the class itself, not to individual instances."} ⏎ ``` | верно | Наоборот: статическое свойство общее для всех экземпляров класса. Проверено php -r. |
T10-L8 0.58 c | References and scope | An array can have a boolean key true, and it will be stored as bool. | «no» Пояснение: PHP arrays use integer keys, and boolean 'true' will be implicitly cast to 1.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PHP arrays use integer keys, and boolean 'true' will be implicitly cast to 1." ⏎ } ⏎ ``` | верно | Булев ключ приводится к int: true → 1, false → 0. |
T11-L1 0.58 c | Generators, iterators, SPL | Inside a generator, return with a value can be used, and it becomes available via $gen->getReturn(). | «yes» Пояснение: The yield statement in PHP generators can return a value, which can be accessed using the generator's getReturn() method.
Raw```json ⏎ {"answer": "yes", "explanation": "The yield statement in PHP generators can return a value, which can be accessed using the generator's getReturn() method."} ⏎ ``` | верно | return-значение генератора доступно через getReturn() после прохода. |
T11-L2 0.54 c | Generators, iterators, SPL | A fully consumed generator can be rewound with rewind() and traversed again. | «no» Пояснение: Once a generator is fully consumed, it cannot be rewound or traversed again.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Once a generator is fully consumed, it cannot be rewound or traversed again." ⏎ } ⏎ ``` | верно | Генератор одноразовый: rewind после начала итерации бросает Exception. |
T11-L3 0.64 c | Generators, iterators, SPL | The yield from construct delegates traversal to another generator or iterable. | «yes» Пояснение: The `yield from` construct in PHP is used to delegate the traversal of an iterable (like an array or another generator) to the current generator.
Raw```json ⏎ {"answer": "yes", "explanation": "The `yield from` construct in PHP is used to delegate the traversal of an iterable (like an array or another generator) to the current generator."} ⏎ ``` | верно | yield from проксирует значения, ключи и return-значение внутреннего генератора. |
T11-L4 0.52 c | Generators, iterators, SPL | What does get_class(g()) return for function g() { yield 1; }? | «generator» Пояснение: get_class() on a generator object returns the string 'Generator'.
Raw```json ⏎ { ⏎ "answer": "Generator", ⏎ "explanation": "get_class() on a generator object returns the string 'Generator'." ⏎ } ⏎ ``` | верно | Функция с yield возвращает Generator. |
T11-L5 0.48 c | Generators, iterators, SPL | How many elements will count(iterator_to_array((function () { yield from [1, 2, 3]; })())) return? | «3» Пояснение: The iterator yields three elements: 1, 2, and 3.
Raw```json ⏎ {"answer": 3, "explanation": "The iterator yields three elements: 1, 2, and 3."} ⏎ ``` | верно | yield from делегирует все 3 элемента. |
T11-L6 0.67 c | Generators, iterators, SPL | The SplStack class implements a FIFO queue. | «no» Пояснение: SplStack implements a LIFO (Last-In, First-Out) stack, not a FIFO (First-In, First-Out) queue.
Raw```json ⏎ {"answer": "no", "explanation": "SplStack implements a LIFO (Last-In, First-Out) stack, not a FIFO (First-In, First-Out) queue."} ⏎ ``` | верно | SplStack — стек LIFO; очередь FIFO — SplQueue. |
T11-L7 0.43 c | Generators, iterators, SPL | ArrayIterator allows wrapping an array and traversing it via the Iterator interface. | «yes» Пояснение: ArrayIterator implements the Iterator interface and allows iteration over array elements.
Raw```json ⏎ {"answer": "yes", "explanation": "ArrayIterator implements the Iterator interface and allows iteration over array elements."} ⏎ ``` | верно | Объектная обёртка над массивом. |
T11-L8 0.48 c | Generators, iterators, SPL | An ArrayObject instance cannot be traversed with foreach. | «no» Пояснение: ArrayObject implements the Traversable interface, which allows it to be used with foreach.
Raw```json ⏎ {"answer": "no", "explanation": "ArrayObject implements the Traversable interface, which allows it to be used with foreach."} ⏎ ``` | верно | ArrayObject реализует IteratorAggregate — foreach по нему работает. |
T12-L1 0.71 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 when hashing a password, so you don't need to provide one manually.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The password_hash() function in PHP automatically generates a unique salt when hashing a password, so you don't need to provide one manually." ⏎ } ⏎ ``` | верно | Соль встраивается в строку результата; параметр salt устарел. |
T12-L2 0.57 c | Configuration and security | In PHP 8, PASSWORD_DEFAULT is md5 with an automatically added salt. | «no» Пояснение: PASSWORD_DEFAULT in PHP 8 uses the strong bcrypt algorithm with a randomly generated salt.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PASSWORD_DEFAULT in PHP 8 uses the strong bcrypt algorithm with a randomly generated salt." ⏎ } ⏎ ``` | верно | PASSWORD_DEFAULT — bcrypt; md5 для паролей непригоден (перебирается массово). |
T12-L3 0.58 c | Configuration and security | What does password_verify('secret', password_hash('secret', PASSWORD_DEFAULT)) return? | «yes» Пояснение: password_verify compares a plain-text password with its hash, returning true if they match.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "password_verify compares a plain-text password with its hash, returning true if they match." ⏎ } ⏎ ``` | верно | Соль и хеш в одной строке: true (форма ответа: true или да). |
T12-L4 0.63 c | Configuration and security | strip_tags() protects against SQL injection. | «no» Пояснение: strip_tags() removes HTML and PHP tags, not SQL code, so it does not prevent SQL injection.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "strip_tags() removes HTML and PHP tags, not SQL code, so it does not prevent SQL injection." ⏎ } ⏎ ``` | верно | strip_tags режет HTML-теги (помощник против XSS), к параметризации SQL отношения не имеет. |
T12-L5 0.57 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, effectively preventing session fixation attacks that might occur upon login.
Raw```json ⏎ {"answer": "yes", "explanation": "session_regenerate_id() creates a new session ID, effectively preventing session fixation attacks that might occur upon login."} ⏎ ``` | верно | Новый ID сессии после логина — стандартная защита от session fixation. |
T12-L6 0.61 c | Configuration and security | Which built-in function returns the SAPI name (e.g., cli)? | «php_sapi_name()» Пояснение: The php_sapi_name() function returns the Server API name.
Raw```json ⏎ { ⏎ "answer": "php_sapi_name()", ⏎ "explanation": "The php_sapi_name() function returns the Server API name." ⏎ } ⏎ ``` | верно | php_sapi_name(). |
T12-L7 0.59 c | Configuration and security | session_destroy() deletes session data on the server but not the cookie in the user's browser. | «no» Пояснение: session_destroy() deletes the session data on the server and also unsets the session cookie in the user's browser.
Raw```json ⏎ {"answer": "no", "explanation": "session_destroy() deletes the session data on the server and also unsets the session cookie in the user's browser."} ⏎ ``` | неверно верный: «yes» | Удаление cookie — отдельный шаг через setcookie с истёкшим сроком. |
T12-L8 0.52 c | Configuration and security | Without calling session_start(), the $_SESSION array is automatically populated with session data. | «no» Пояснение: session_start() must be called to initialize the session and populate the $_SESSION superglobal array.
Raw```json ⏎ {"answer": "no", "explanation": "session_start() must be called to initialize the session and populate the $_SESSION superglobal array."} ⏎ ``` | верно | Без session_start() данные сессии в массив не загружаются ($_SESSION можно заполнить вручную, но привязки к сессии нет). |
VC-L1 0.51 c | PHP 8.4–8.5 | In which PHP version was the array_find() function introduced? | «php 7.3» Пояснение: The array_find() function was introduced in PHP 7.3.
Raw```json ⏎ {"answer": "PHP 7.3", "explanation": "The array_find() function was introduced in PHP 7.3."} ⏎ ``` | неверно верный: «8.4» | PHP 8.4 (RFC array_find). |
VC-L2 0.56 c | PHP 8.4–8.5 | Property hooks (get/set right in the property declaration) landed in PHP 8.4. | «no» Пояснение: Property hooks (get/set methods defined directly in the property declaration) were introduced in PHP 8.0.
Raw```json ⏎ {"answer": "no", "explanation": "Property hooks (get/set methods defined directly in the property declaration) were introduced in PHP 8.0."} ⏎ ``` | неверно верный: «yes» | Property hooks — PHP 8.4 (ноябрь 2024). |
VC-L3 0.49 c | PHP 8.4–8.5 | Asymmetric visibility (public private(set) string $name) appeared in PHP 8.4. | «no» Пояснение: Asymmetric visibility was introduced in PHP 8.2, not 8.4.
Raw```json ⏎ {"answer": "no", "explanation": "Asymmetric visibility was introduced in PHP 8.2, not 8.4."} ⏎ ``` | неверно верный: «yes» | Asymmetric visibility v2 — PHP 8.4. |
VC-L4 0.57 c | PHP 8.4–8.5 | In which PHP version was the #[\NoDiscard] attribute introduced? Answer with the version number. | «8.1» Пояснение: The #[\NoDiscard] attribute was introduced in PHP 8.1.
Raw```json ⏎ { ⏎ "answer": "8.1", ⏎ "explanation": "The #[\NoDiscard] attribute was introduced in PHP 8.1." ⏎ } ⏎ ``` | неверно верный: «8.5» | #[\NoDiscard] — PHP 8.5 (marking return values as important). |
VC-L5 0.52 c | PHP 8.4–8.5 | In which PHP version did the pipe operator |> first appear? Answer with the version number. | «8.0» Пояснение: The pipe operator was introduced in PHP 8.0.
Raw```json ⏎ { ⏎ "answer": "8.0", ⏎ "explanation": "The pipe operator was introduced in PHP 8.0." ⏎ } ⏎ ``` | неверно верный: «8.5» | Pipe operator — PHP 8.5 (2025). |
VC-L6 0.65 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. | «7.4» Пояснение: The `clone()` function with the ability to specify properties to clone was introduced in PHP 7.4.
Raw```json ⏎ { ⏎ "answer": "7.4", ⏎ "explanation": "The `clone()` function with the ability to specify properties to clone was introduced in PHP 7.4." ⏎ } ⏎ ``` | неверно верный: «8.5» | Clone with v2 — PHP 8.5. |
VC-L7 0.58 c | PHP 8.4–8.5 | In which PHP version were the array_first() and array_last() functions introduced? | «php 7.3» Пояснение: The array_first() and array_last() functions were introduced in PHP 7.3.
Raw```json ⏎ {"answer": "PHP 7.3", "explanation": "The array_first() and array_last() functions were introduced in PHP 7.3."} ⏎ ``` | неверно верный: «8.5» | PHP 8.5. |
VC-L8 0.56 c | PHP 8.4–8.5 | For which PHP version was RFC Partial Function Application v2 adopted (as of 2026-11-07)? Answer with the version number. | «8.3» Пояснение: RFC Partial Function Application v2 was adopted in PHP 8.3.
Raw```json ⏎ { ⏎ "answer": "8.3", ⏎ "explanation": "RFC Partial Function Application v2 was adopted in PHP 8.3." ⏎ } ⏎ ``` | неверно верный: «8.6» | PFA v2 принят 05.12.2025 (33-0-0), реализован в PHP 8.6. |
VF-L1 0.55 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.1» Пояснение: The clamp() function was introduced in PHP 8.1.
Raw```json ⏎ { ⏎ "answer": "8.1", ⏎ "explanation": "The clamp() function was introduced in PHP 8.1." ⏎ } ⏎ ``` | неверно верный: «8.6» | По данным владельца (wiki.php.net/rfc): clamp_v2 — 8.6; clamp() в 8.5.11 отсутствует (косвенное подтверждение). Дата-якорь делает клетку монотонной. |
VF-L2 0.67 c | PHP: 8.6+ and the future | RFC Context Managers v2 has already been adopted in PHP (as of 2026-11-07). | «no» Пояснение: RFC Context Managers v2 was proposed but not yet adopted in PHP as of November 7, 2026.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "RFC Context Managers v2 was proposed but not yet adopted in PHP as of November 7, 2026." ⏎ } ⏎ ``` | верно | На 06.11.2026 — в обсуждении (создан 2026-10-23); не принят. |
VF-L3 0.61 c | PHP: 8.6+ and the future | RFC Bound-Erased Generic Types (generics) was declined in 2026. | «no» Пояснение: RFC Bound-Erased Generic Types (generics) was declined in 2023, not 2026.
Raw```json ⏎ {"answer": "no", "explanation": "RFC Bound-Erased Generic Types (generics) was declined in 2023, not 2026."} ⏎ ``` | неверно верный: «yes» | Голосование завершилось 2026-06-28: отклонён (wiki.php.net/rfc). |
VF-L4 0.6 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 November 7, 2026, the RFC to enable ZTS by default has not yet been accepted.
Raw```json ⏎ {"answer": "no", "explanation": "As of November 7, 2026, the RFC to enable ZTS by default has not yet been accepted."} ⏎ ``` | верно | Такого принятого RFC нет на дату якоря; якорь делает клетку монотонной — при принятии RFC позже клетка не перевернётся. |
VF-L5 0.5 c | PHP: 8.6+ and the future | As of PHP 8.5, generics (parameterized types) are still absent. | «no» Пояснение: PHP 8.0 introduced generics (parameterized types).
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PHP 8.0 introduced generics (parameterized types)." ⏎ } ⏎ ``` | неверно верный: «yes» | Generics в PHP отсутствуют; отрицательный контроль (не путать с C#/Java). |
VF-L6 0.96 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» Пояснение: As of 2026-11-07, the latest stable version is 8.5, and 8.6 is not yet released (GA on 2026-11-19).
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "As of 2026-11-07, the latest stable version is 8.5, and 8.6 is not yet released (GA on 2026-11-19)." ⏎ } ⏎ ``` | неверно верный: «yes» | 8.5 — релиз осени 2025; 8.6 GA 19.11.2026 (wiki.php.net/todo/php86). Дата снимка — 06.11.2026. |
VF-L7 0.58 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 skipped, and the next major version after PHP 5.6 was PHP 7.0.
Raw```json ⏎ {"answer": "yes", "explanation": "PHP 6 was skipped, and the next major version after PHP 5.6 was PHP 7.0."} ⏎ ``` | верно | Исторический факт: ветка 6 не была релизнута. |
VF-L8 0.59 c | PHP: 8.6+ and the future | The RFC adding the #[\Deprecated] attribute to the core was adopted. | «yes» Пояснение: The RFC introducing the #[\Deprecated] attribute for marking deprecated code in PHP core was indeed adopted.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The RFC introducing the #[\Deprecated] attribute for marking deprecated code in PHP core was indeed adopted." ⏎ } ⏎ ``` | верно | #[\Deprecated] — принят, реализован в PHP 8.4. |
T25-L1 0.61 c | Clean architecture | The dependency rule of clean and onion architecture: inner layers know nothing about outer ones — dependencies point toward the center. | «yes» Пояснение: In both Clean Architecture and Onion Architecture, dependencies point inwards, meaning inner layers are independent of outer layers.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In both Clean Architecture and Onion Architecture, dependencies point inwards, meaning inner layers are independent of outer layers." ⏎ } ⏎ ``` | верно | Чистая (Robert C. Martin), луковичная (Jeffrey Palermo) и гексагональная (ports & adapters) — варианты одной идеи: зависимости направлены внутрь, к домену. Слоями в проекте следит deptrac. |
T25-L2 0.58 c | Clean architecture | Domain entities import neither Doctrine nor Symfony — only the language and, possibly, the standard library. | «yes» Пояснение: Domain entities represent the core business logic and data, independent of specific frameworks like Doctrine or Symfony.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Domain entities represent the core business logic and data, independent of specific frameworks like Doctrine or Symfony." ⏎ } ⏎ ``` | верно | Изоляция домена от инфраструктуры; deptrac в проекте как раз следит за слоями. |
T25-L3 0.71 c | Clean architecture | Controllers and Twig templates belong to the business-logic layer because they are the ones calling use cases. | «no» Пояснение: Controllers and Twig templates typically belong to the presentation layer, responsible for handling user requests and rendering the user interface, while use cases reside in the application or business logic layer.
Raw```json ⏎ {"answer": "no", "explanation": "Controllers and Twig templates typically belong to the presentation layer, responsible for handling user requests and rendering the user interface, while use cases reside in the application or business logic layer."} ⏎ ``` | верно | Наоборот: это интерфейсные адаптеры (внешний слой); они зависят от use cases, а не наоборот. |
T25-L4 0.55 c | Clean architecture | What sits at the very center of the onion architecture? | «domain model» Пояснение: The Domain Model, representing the core business logic and data, resides at the center of the onion architecture.
Raw```json ⏎ {"answer": "Domain Model", "explanation": "The Domain Model, representing the core business logic and data, resides at the center of the onion architecture."} ⏎ ``` | верно | Центральное кольцо — Domain Model: сущности и бизнес-правила без зависимостей; далее Domain Services → Application Services → Infrastructure/UI/Tests (Palermo). |
T25-L5 0.49 c | Clean architecture | Layer boundary violations can be caught automatically: a layer-dependency analyzer (e.g. deptrac) fails on a forbidden call. | «yes» Пояснение: Tools like deptrac can automatically detect violations of layer boundaries by analyzing code dependencies.
Raw```json ⏎ {"answer": "yes", "explanation": "Tools like deptrac can automatically detect violations of layer boundaries by analyzing code dependencies."} ⏎ ``` | верно | depfile.yaml в проекте TasK: CI проверяет правила слоёв на каждом пайплайне. |
T25-L6 0.69 c | Clean architecture | A use case (interactor) may accept an HTTP request or an EntityManager as arguments — it is simpler that way. | «yes» Пояснение: Interactors are decoupled from request/response formats and persistence layers, so they can accept various dependencies like HTTP requests or EntityManager for flexibility.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Interactors are decoupled from request/response formats and persistence layers, so they can accept various dependencies like HTTP requests or EntityManager for flexibility." ⏎ } ⏎ ``` | неверно верный: «no» | Use case принимает DTO и порты; привязка к HTTP/ORM протекает инфраструктуру во внутренние слои. |
T25-L7 0.6 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 provides an abstraction layer over the data access logic, hiding the data source details.
Raw```json ⏎ { ⏎ "answer": "Repository", ⏎ "explanation": "The Repository pattern provides an abstraction layer over the data access logic, hiding the data source details." ⏎ } ⏎ ``` | верно | Repository pattern (DDD/Evans); в проекте — Doctrine-репозитории за портами. |
T25-L8 0.67 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 database is an implementation detail of the infrastructure layer, decoupled from the core domain and use case layers.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In clean architecture, the database is an implementation detail of the infrastructure layer, decoupled from the core domain and use case layers." ⏎ } ⏎ ``` | верно | Следствие правила зависимостей: инфраструктура взаимозаменяема. |
T26-L1 0.62 c | DDD | In DDD, an aggregate is just another name for a database table. | «no» Пояснение: An aggregate represents a cluster of domain objects that can be treated as a single unit, not a database table.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "An aggregate represents a cluster of domain objects that can be treated as a single unit, not a database table." ⏎ } ⏎ ``` | верно | Агрегат — кластер объектов с границей согласованности (транзакционной вокруг корня); таблица — деталь хранения. |
T26-L2 0.38 c | DDD | A Value Object is immutable and compared by the values of its fields, not by identity. | «yes» Пояснение: This is the definition of a Value Object.
Raw```json ⏎ {"answer": "yes", "explanation": "This is the definition of a Value Object."} ⏎ ``` | верно | Классика Evans: Money, Email; равенство структурное. |
T26-L3 0.52 c | DDD | What is the single external entry point of an aggregate, through which all changes must go, called? | «aggregate root» Пояснение: The aggregate root is the single point of access for an aggregate.
Raw```json ⏎ { ⏎ "answer": "aggregate root", ⏎ "explanation": "The aggregate root is the single point of access for an aggregate." ⏎ } ⏎ ``` | верно | Aggregate Root: внешние объекты ссылаются только на корень; он защищает инварианты агрегата. |
T26-L4 0.69 c | DDD | In DDD, a repository is declared for an aggregate (its root), not for every entity. | «yes» Пояснение: A repository in Domain-Driven Design (DDD) typically focuses on managing aggregates, which are clusters of domain objects treated as a single unit, rather than individual entities.
Raw```json ⏎ {"answer": "yes", "explanation": "A repository in Domain-Driven Design (DDD) typically focuses on managing aggregates, which are clusters of domain objects treated as a single unit, rather than individual entities."} ⏎ ``` | верно | Репозиторий корня хранит границу согласованности агрегата; вложенные сущности доступны только через корень. |
T26-L5 0.56 c | DDD | Ubiquitous language is the model's shared language common to developers and domain experts. | «yes» Пояснение: Ubiquitous language is indeed the common language used by both developers and domain experts in a specific project or domain.
Raw```json ⏎ {"answer": "yes", "explanation": "Ubiquitous language is indeed the common language used by both developers and domain experts in a specific project or domain."} ⏎ ``` | верно | Evans: язык из требований переходит в имена классов и методов. |
T26-L6 0.74 c | DDD | What is the boundary called within which a model and its language are consistent, while outside the same words mean other models? | «hallucination boundary» Пояснение: The hallucination boundary refers to the limits of a model's knowledge and consistency, beyond which it starts generating nonsensical or unrelated outputs.
Raw```json ⏎ { ⏎ "answer": "Hallucination boundary", ⏎ "explanation": "The hallucination boundary refers to the limits of a model's knowledge and consistency, beyond which it starts generating nonsensical or unrelated outputs." ⏎ } ⏎ ``` | неверно верный: «bounded context» | Bounded Context; «Заказ» в биллинге и в доставке — разные модели. |
T26-L7 0.65 c | DDD | An anemic model (objects with only getters/setters, logic in services) is the recommended DDD style. | «no» Пояснение: Anemic domain models are generally discouraged in DDD, as they lack behavior and violate the principle of encapsulating domain logic within the domain objects themselves.
Raw```json ⏎ {"answer": "no", "explanation": "Anemic domain models are generally discouraged in DDD, as they lack behavior and violate the principle of encapsulating domain logic within the domain objects themselves."} ⏎ ``` | верно | Наоборот: Evans называет анемичность антипаттерном — поведение должно жить в доменных объектах. |
T26-L8 0.55 c | DDD | Bounded context means each context has its own model: the same concept in different contexts is a different class. | «yes» Пояснение: Bounded context, a core concept in Domain-Driven Design, defines explicit boundaries within which a particular model applies.
Raw```json ⏎ {"answer": "yes", "explanation": "Bounded context, a core concept in Domain-Driven Design, defines explicit boundaries within which a particular model applies."} ⏎ ``` | верно | Модели контекстов независимы; между ними — явная интеграция (ACL, published language). |
T13-L1 0.62 c | Symfony | Services in the Symfony DI container are created lazily by default — on first use. | «yes» Пояснение: Symfony's DI container uses lazy loading by default, meaning services are instantiated only when they are first requested.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony's DI container uses lazy loading by default, meaning services are instantiated only when they are first requested." ⏎ } ⏎ ``` | верно | Контейнер инстанцирует сервис при первом извлечении; eager-создания по умолчанию нет. |
T13-L2 0.62 c | Symfony | Which Symfony console command lists all registered routes? | «bin/console router:debug» Пояснение: The `router:debug` command in Symfony lists all registered routes with their details.
Raw```json ⏎ { ⏎ "answer": "bin/console router:debug", ⏎ "explanation": "The `router:debug` command in Symfony lists all registered routes with their details." ⏎ } ⏎ ``` | неверно верный: «debug:router» | bin/console debug:router (FrameworkBundle); в Symfony 3 команда называлась router:debug. |
T13-L3 0.62 c | Symfony | Symfony autowiring requires manually declaring every service in services.yaml. | «no» Пояснение: Symfony autowiring automatically detects and configures services based on their dependencies and tags, reducing the need for manual declaration in services.yaml.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony autowiring automatically detects and configures services based on their dependencies and tags, reducing the need for manual declaration in services.yaml."} ⏎ ``` | верно | Autowire+autoconfigure регистрируют и связывают сервисы автоматически; ручное перечисление — исключение. |
T13-L4 0.44 c | Symfony | Twig templates are compiled into PHP classes and cached between requests. | «yes» Пояснение: Twig templates are compiled into optimized PHP code and cached for performance reasons.
Raw```json ⏎ {"answer": "yes", "explanation": "Twig templates are compiled into optimized PHP code and cached for performance reasons."} ⏎ ``` | верно | Twig компилирует шаблон один раз; кэш в var/cache/twig, в prod не пересобирается. |
T13-L5 0.59 c | Symfony | In the Symfony dev environment the DI container is rebuilt only after tracked files change, not on every request. | «yes» Пояснение: In the Symfony dev environment, the DI container is rebuilt only when tracked files change, optimizing performance by avoiding rebuilding on every request.
Raw```json ⏎ {"answer": "yes", "explanation": "In the Symfony dev environment, the DI container is rebuilt only when tracked files change, optimizing performance by avoiding rebuilding on every request."} ⏎ ``` | верно | Kernel проверяет freshness ресурсов (конфиги, классы); иначе переиспользуется кэш контейнера. |
T13-L6 0.74 c | Symfony | Which environment variable selects the active Symfony environment (dev/prod)? | «symfony_env» Пояснение: The Symfony framework uses the `Symfony_env` environment variable to determine the active environment (e.g., 'dev', 'prod').
Raw```json ⏎ { ⏎ "answer": "Symfony_env", ⏎ "explanation": "The Symfony framework uses the `Symfony_env` environment variable to determine the active environment (e.g., 'dev', 'prod')." ⏎ } ⏎ ``` | неверно верный: «app_env» | APP_ENV в .env; APP_DEBUG — отдельный флаг отладки. |
T13-L7 0.5 c | Symfony | A controller method can be private — Symfony routing works with any method of the class. | «no» Пояснение: Symfony routing only works with public methods of a controller class.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Symfony routing only works with public methods of a controller class." ⏎ } ⏎ ``` | верно | Действие контроллера должно быть public; приватный метод по маршруту не вызывается. |
T13-L8 0.58 c | Symfony | Event subscribers always receive events before listeners, because the interface gives them priority. | «no» Пояснение: Event listeners are typically dispatched before subscribers in most PHP event systems like Symfony's EventDispatcher.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Event listeners are typically dispatched before subscribers in most PHP event systems like Symfony's EventDispatcher." ⏎ } ⏎ ``` | верно | Порядок определяет priority, а не тип подписки; приоритеты задаются в getSubscribedEvents() так же, как у слушателей. |
T22-L1 0.6 c | Symfony: Security and forms | In modern Symfony (6.0+) authentication is built on authenticator classes (AuthenticatorInterface); the old guard system has been removed. | «yes» Пояснение: Symfony 6.0 and later versions replaced the Guard system with the AuthenticatorInterface for authentication.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony 6.0 and later versions replaced the Guard system with the AuthenticatorInterface for authentication." ⏎ } ⏎ ``` | верно | Guard объявлен устаревшим в 5.3 и удалён в 6.0; в проекте symfony/security-bundle 8.1. |
T22-L2 0.7 c | Symfony: Security and forms | Which Symfony attribute checks a role/permission right on a controller method (403 without it)? | «[require_role]» Пояснение: The [REQUIRE_ROLE] attribute in Symfony is used to check if the user has a specific role to access a controller method.
Raw```json ⏎ { ⏎ "answer": "[REQUIRE_ROLE]", ⏎ "explanation": "The [REQUIRE_ROLE] attribute in Symfony is used to check if the user has a specific role to access a controller method." ⏎ } ⏎ ``` | неверно верный: «isgranted» | #[IsGranted('ROLE_ADMIN')]; атрибут из symfony/security-http. |
T22-L3 0.68 c | Symfony: Security and forms | Voters are Symfony's mechanism for checking access to a specific object: isGranted('EDIT', $post). | «yes» Пояснение: Symfony Voters are used to determine if a user is granted a specific permission (like 'EDIT') for a given object ($post).
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony Voters are used to determine if a user is granted a specific permission (like 'EDIT') for a given object ($post)." ⏎ } ⏎ ``` | верно | VoterInterface->vote(); docs Symfony — Voters. |
T22-L4 0.59 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» Пояснение: Symfony 7 and later versions primarily use PHP attributes for validation constraints, deprecating Doctrine annotations.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony 7 and later versions primarily use PHP attributes for validation constraints, deprecating Doctrine annotations." ⏎ } ⏎ ``` | верно | Докблок-аннотации удалены в Symfony 7.0; стандарт — атрибуты. В проекте symfony/validator 8.1. |
T22-L5 0.45 c | Symfony: Security and forms | CSRF protection of Symfony forms is enabled by default: the form validates the token on submission. | «yes» Пояснение: Symfony automatically adds CSRF protection to forms, validating the token upon submission.
Raw```json ⏎ {"answer": "yes", "explanation": "Symfony automatically adds CSRF protection to forms, validating the token upon submission."} ⏎ ``` | верно | FormType добавляет скрытое поле _token и проверяет его при валидации; отключение — осознанное исключение (csrf: false). |
T22-L6 0.57 c | Symfony: Security and forms | Form validation in Symfony runs server-side even if the client-side (HTML5) checks passed. | «yes» Пояснение: Symfony's form validation is performed on the server to ensure data integrity and security, regardless of client-side validation.
Raw```json ⏎ {"answer": "yes", "explanation": "Symfony's form validation is performed on the server to ensure data integrity and security, regardless of client-side validation."} ⏎ ``` | верно | Клиентская валидация — только удобство; серверная обязательна и идёт по метаданным объекта формы. |
T22-L7 0.59 c | Symfony: Security and forms | Which Symfony maker command generates a form class (FormType)? | «make:form» Пояснение: The `make:form` command generates a form class (FormType) in Symfony.
Raw```json ⏎ { ⏎ "answer": "make:form", ⏎ "explanation": "The `make:form` command generates a form class (FormType) in Symfony." ⏎ } ⏎ ``` | верно | bin/console make:form (symfony/maker-bundle — в проекте). |
T22-L8 0.61 c | Symfony: Security and forms | Symfony stores the user's password in the session in plain text. | «no» Пояснение: Symfony stores user passwords securely, typically using hashing algorithms like bcrypt, not in plain text in the session.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Symfony stores user passwords securely, typically using hashing algorithms like bcrypt, not in plain text in the session." ⏎ } ⏎ ``` | верно | В сессии живёт объект пользователя в токене; хеш затирается eraseCredentials(), plaintext там никогда не лежит. |
T23-L1 0.72 c | Symfony: configuration and services | Symfony bundle configuration lives in config/packages — one file per bundle or topic. | «yes» Пояснение: Symfony bundles often have their configuration files located in the `config/packages` directory, typically named after the bundle or a specific topic within the bundle.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony bundles often have their configuration files located in the `config/packages` directory, typically named after the bundle or a specific topic within the bundle." ⏎ } ⏎ ``` | верно | Стандартная структура (config/packages/*.yaml); перегрузка — config/packages/<env>. |
T23-L2 0.61 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 practice for managing environment-specific configurations and secrets in PHP projects using frameworks like Laravel.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "This is a common practice for managing environment-specific configurations and secrets in PHP projects using frameworks like Laravel." ⏎ } ⏎ ``` | верно | symfony/dotenv: .env — общий безопасный набор значений; локальные секреты — .env.local (gitignored) или secrets-хранилище. |
T23-L3 0.68 c | Symfony: configuration and services | Which Symfony command lists the container's registered services and their aliases? | «bin/console debug:container» Пояснение: The command `bin/console debug:container` lists the container's registered services and their aliases.
Raw```json ⏎ { ⏎ "answer": "bin/console debug:container", ⏎ "explanation": "The command `bin/console debug:container` lists the container's registered services and their aliases." ⏎ } ⏎ ``` | верно | bin/console debug:container; параметры контейнера — debug:parameter. |
T23-L4 0.57 c | Symfony: configuration and services | The Symfony container allows changing parameters at runtime: $container->setParameter() works from a controller. | «yes» Пояснение: The Symfony container allows setting or modifying parameters at runtime using the setParameter() method.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The Symfony container allows setting or modifying parameters at runtime using the setParameter() method." ⏎ } ⏎ ``` | неверно верный: «no» | Контейнер компилируется и замораживается; runtime-значения — только через переменные окружения. |
T23-L5 0.64 c | Symfony: configuration and services | By default, Symfony services are public (public: true) — you can fetch them directly from the container. | «no» Пояснение: By default, Symfony services are private (public: false) and must be explicitly fetched from the container using their ID.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "By default, Symfony services are private (public: false) and must be explicitly fetched from the container using their ID." ⏎ } ⏎ ``` | верно | С Symfony 4.0 сервисы по умолчанию private: инжектятся через autowiring; $container->get() — только для публичных. |
T23-L6 0.58 c | Symfony: configuration and services | Without a config file in config/packages a bundle will not work — configuration is mandatory for every bundle. | «no» Пояснение: Bundles in Symfony can work without mandatory configuration files, especially if they don't require specific configuration or provide default settings.
Raw```json ⏎ {"answer": "no", "explanation": "Bundles in Symfony can work without mandatory configuration files, especially if they don't require specific configuration or provide default settings."} ⏎ ``` | верно | У бандлов есть встроенные умолчания (Extension); конфиг нужен только для отклонений от них. |
T23-L7 0.62 c | Symfony: configuration and services | Environment variable values are injected into services.yaml using the %env(VAR)% syntax. | «yes» Пояснение: The %env(VAR)% syntax in Symfony's services.yaml is used to inject environment variable values.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The %env(VAR)% syntax in Symfony's services.yaml is used to inject environment variable values." ⏎ } ⏎ ``` | верно | %env(...)% резолвится в рантайме env-процессорами; docs — Env Var Processors. |
T23-L8 0.69 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 enables debug mode in Symfony, which activates features like the web profiler and Twig debugging.
Raw```json ⏎ { ⏎ "answer": "APP_DEBUG", ⏎ "explanation": "The APP_DEBUG environment variable enables debug mode in Symfony, which activates features like the web profiler and Twig debugging." ⏎ } ⏎ ``` | верно | APP_DEBUG=1 (в .env dev-окружения); окружение выбирает APP_ENV — см. T13-L6. |
T16-L1 0.46 c | Symfony: Messenger | A single message in Symfony Messenger can only have one handler. | «no» Пояснение: A single message in Symfony Messenger can have multiple handlers registered for it.
Raw```json ⏎ {"answer": "no", "explanation": "A single message in Symfony Messenger can have multiple handlers registered for it."} ⏎ ``` | верно | Messenger вызывает все хендлеры, подписанные на класс сообщения (docs — Multiple Handlers). |
T16-L2 0.56 c | Symfony: Messenger | The sync transport in Messenger queues the message for a worker, just like async. | «yes» Пояснение: The sync transport in Messenger queues the message for a worker, similar to the async transport, but guarantees synchronous execution.
Raw```json ⏎ {"answer": "yes", "explanation": "The sync transport in Messenger queues the message for a worker, similar to the async transport, but guarantees synchronous execution."} ⏎ ``` | неверно верный: «no» | Наоборот: sync обрабатывает немедленно в том же процессе, что и отправка; очередь — это async-транспорт. |
T16-L3 0.59 c | Symfony: Messenger | Which console command starts the worker that processes Messenger queue messages? | «php artisan queue:work» Пояснение: The command `php artisan queue:work` starts the Laravel queue worker process.
Raw```json ⏎ { ⏎ "answer": "php artisan queue:work", ⏎ "explanation": "The command `php artisan queue:work` starts the Laravel queue worker process." ⏎ } ⏎ ``` | неверно верный: «messenger:consume» | bin/console messenger:consume async; воркеры под supervisord/systemd в проде. |
T16-L4 0.35 c | Symfony: Messenger | Retries for failed messages (retry_strategy) are configured per Messenger transport. | «yes» Пояснение: Retry strategies for failed messages are indeed configured per Messenger transport.
Raw{"answer": "yes", "explanation": "Retry strategies for failed messages are indeed configured per Messenger transport."} | верно | retry_strategy на транспорте: max_retries, delay, multiplier; docs — Failed Messages & Retries. |
T16-L5 0.39 c | Symfony: Messenger | By default, Messenger serializes messages to JSON. | «yes» Пояснение: Messenger automatically converts messages into JSON format for transmission.
Raw```json ⏎ {"answer": "yes", "explanation": "Messenger automatically converts messages into JSON format for transmission."} ⏎ ``` | неверно верный: «no» | Дефолтный сериализатор — PhpSerializer (serialize()); JSON-сериализатор включается отдельно. |
T16-L6 0.44 c | Symfony: Messenger | Symfony Scheduler produces messages on a schedule and dispatches them through Messenger. | «yes» Пояснение: Symfony Scheduler integrates with Symfony Messenger to send messages on a defined schedule.
Raw```json ⏎ {"answer": "yes", "explanation": "Symfony Scheduler integrates with Symfony Messenger to send messages on a defined schedule."} ⏎ ``` | верно | Schedule → RecurringMessage → шина Messenger; docs — Scheduler. |
T16-L7 0.53 c | Symfony: Messenger | Which built-in Messenger transport stores messages in database tables via Doctrine? | «doctrine» Пояснение: The Doctrine Messenger transport uses Doctrine ORM to store messages in database tables.
Raw```json ⏎ { ⏎ "answer": "doctrine", ⏎ "explanation": "The Doctrine Messenger transport uses Doctrine ORM to store messages in database tables." ⏎ } ⏎ ``` | верно | Транспорт doctrine (symfony/doctrine-messenger); таблица messenger_messages. В проекте стоит amqp-messenger + doctrine-messenger. |
T16-L8 0.5 c | Symfony: Messenger | The Messenger pipeline can be extended with custom middleware, placed before or after the built-in ones. | «yes» Пояснение: The Messenger pipeline allows for flexible extension with custom middleware that can be inserted at various points.
Raw```json ⏎ {"answer": "yes", "explanation": "The Messenger pipeline allows for flexible extension with custom middleware that can be inserted at various points."} ⏎ ``` | верно | messenger.bus.*.middleware в yaml; docs — Middleware. |
T28-L1 0.58 c | Symfony: versions | Symfony major releases come every two years, minor ones every six months (in May and November). | «yes» Пояснение: Symfony follows a predictable release schedule with major versions every two years and minor versions every six months.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony follows a predictable release schedule with major versions every two years and minor versions every six months." ⏎ } ⏎ ``` | верно | Стандартный релизный цикл: 8.0 — ноябрь 2025, 8.1 — май 2026, 8.2 — ноябрь 2026. |
T28-L2 0.53 c | Symfony: versions | What is the minimum PHP version required by Symfony 8? | «8.1» Пояснение: Symfony 8 requires PHP version 8.1 or higher.
Raw```json ⏎ { ⏎ "answer": "8.1", ⏎ "explanation": "Symfony 8 requires PHP version 8.1 or higher." ⏎ } ⏎ ``` | неверно верный: «8.4» | Symfony 8.0 поднял требование до PHP >= 8.4.1 (в vendor проекта: "php": ">=8.4.1"). |
T28-L3 0.63 c | Symfony: versions | Symfony 7.0 kept support for docblock annotations (validation, routes). | «yes» Пояснение: Symfony 7.0 continues to support docblock annotations for validation and routing, although attributes are the recommended approach.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony 7.0 continues to support docblock annotations for validation and routing, although attributes are the recommended approach." ⏎ } ⏎ ``` | неверно верный: «no» | Наоборот: в 7.0 аннотации удалены — только PHP-атрибуты (#[Route], #[Assert\NotBlank]). |
T28-L4 0.62 c | Symfony: versions | AssetMapper manages CSS/JS without node or webpack — via importmap.php. | «yes» Пояснение: AssetMapper uses importmap.php to manage CSS and JS assets without requiring Node.js or Webpack.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "AssetMapper uses importmap.php to manage CSS and JS assets without requiring Node.js or Webpack." ⏎ } ⏎ ``` | верно | symfony/asset-mapper (с 6.3, стандарт с 7.x); в проекте — importmap.php в корне и asset-mapper 8.1. |
T28-L5 0.89 c | Symfony: versions | Symfony 6.4 is a regular release without long-term support. | «no» Пояснение: Symfony 6.4 is a minor release within the Symfony 6.x series, which receives bug fixes and security updates, but it is not a major release designated for long-term support (LTS).
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Symfony 6.4 is a minor release within the Symfony 6.x series, which receives bug fixes and security updates, but it is not a major release designated for long-term support (LTS)." ⏎ } ⏎ ``` | верно | Наоборот: 6.4 — LTS (расширенная поддержка); LTS выходит вместе с очередным мажором (6.4 — вместе с 7.0). |
T28-L6 0.44 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» Пояснение: Symfony major releases typically remove deprecated features from the previous major version.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony major releases typically remove deprecated features from the previous major version."} ⏎ ``` | верно | Наоборот: мажорный релиз удаляет всё устаревшее (7.0 убрал деприкейшены 6.x, 8.0 — 7.x). |
T28-L7 0.57 c | Symfony: versions | Every Symfony major release is accompanied by an UPGRADE guide listing the changes. | «yes» Пояснение: Symfony provides an official UPGRADE guide for each major release to document changes and migration steps.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony provides an official UPGRADE guide for each major release to document changes and migration steps." ⏎ } ⏎ ``` | верно | UPGRADE-7.0.md, UPGRADE-8.0.md в репозитории symfony/symfony. |
T28-L8 0.58 c | Symfony: versions | Which Symfony component manages assets and the importmap without node/webpack? | «asset» Пояснение: The Symfony Asset component manages assets and the importmap without needing Node.js or Webpack.
Raw```json ⏎ { ⏎ "answer": "Asset", ⏎ "explanation": "The Symfony Asset component manages assets and the importmap without needing Node.js or Webpack." ⏎ } ⏎ ``` | неверно верный: «asset-mapper» | symfony/asset-mapper 8.1 — в проекте. |
T29-L1 0.56 c | Symfony: 8.2 and beyond | As of 2026-11-07, Symfony 8.2 has already been released. | «no» Пояснение: Symfony 8.2 was released in April 2024, not November 2026.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony 8.2 was released in April 2024, not November 2026."} ⏎ ``` | верно | Наоборот: 8.2 ещё не выпущена — релиз в конце ноября 2026; последняя стабильная — 8.1. |
T29-L2 0.58 c | Symfony: 8.2 and beyond | As of 2026-11-07, Symfony 8.2 is scheduled for November 2026, following the usual six-month cycle. | «no» Пояснение: Symfony 8.2 was released in June 2024, not scheduled for November 2026.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony 8.2 was released in June 2024, not scheduled for November 2026."} ⏎ ``` | неверно верный: «yes» | Политика релизов: 8.1 — май 2026, 8.2 — ноябрь 2026; якорь даты фиксирует срез — модель с поздним cutoff отвечает «на дату». |
T29-L3 0.59 c | Symfony: 8.2 and beyond | Which Symfony version comes after 8.1 (as of 2026-11-07)? | «9.0» Пояснение: Symfony 9.0 is the version that followed Symfony 8.1.
Raw```json ⏎ { ⏎ "answer": "9.0", ⏎ "explanation": "Symfony 9.0 is the version that followed Symfony 8.1." ⏎ } ⏎ ``` | неверно верный: «8.2» | 8.2 — следующий минорный релиз (ноябрь 2026); после его выхода проект переходит с 8.1.* на 8.2.*. |
T29-L4 0.61 c | Symfony: 8.2 and beyond | Symfony 8.2 is a major release requiring applications to be rewritten for new APIs. | «no» Пояснение: Symfony 8.2 is a minor release, not a major one requiring rewriting for new APIs.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Symfony 8.2 is a minor release, not a major one requiring rewriting for new APIs." ⏎ } ⏎ ``` | верно | Наоборот: 8.2 — минорный релиз; новые возможности без поломки обратной совместимости. Мажор — 9.0. |
T29-L5 0.74 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 aims to maintain backward compatibility between major versions, meaning code written for PHP 8.1 should generally work without modification in PHP 8.2.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "PHP aims to maintain backward compatibility between major versions, meaning code written for PHP 8.1 should generally work without modification in PHP 8.2." ⏎ } ⏎ ``` | верно | Политика Symfony: минорные релизы обратно совместимы; BC-break допустим только в мажорных. |
T29-L6 0.84 c | Symfony: 8.2 and beyond | Which minor version of the 8.x branch is released last, before Symfony 9.0? | «8.2» Пояснение: PHP 8.2 is the last minor version of the 8.x branch released before Symfony 9.0's requirement for PHP 8.1 or higher.
Raw```json ⏎ { ⏎ "answer": "8.2", ⏎ "explanation": "PHP 8.2 is the last minor version of the 8.x branch released before Symfony 9.0's requirement for PHP 8.1 or higher." ⏎ } ⏎ ``` | неверно верный: «8.4» | По циклу: 8.2 (ноя 2026), 8.3 (май 2027), 8.4 (ноя 2027, вместе с 9.0) — как 6.4 выходила вместе с 7.0. |
T29-L7 0.53 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.2 requires PHP 8.2 or higher, not 8.5.
Raw```json ⏎ {"answer": "no", "explanation": "Symfony 8.2 requires PHP 8.2 or higher, not 8.5."} ⏎ ``` | верно | Наоборот: минорные релизы не поднимают требования PHP; для всей ветки 8.x остаётся PHP >= 8.4. |
T29-L8 0.72 c | Symfony: 8.2 and beyond | Deprecations added in the 8.x branch will not be removed before Symfony 9.0. | «yes» Пояснение: Symfony's deprecation policy states that deprecations introduced in the 8.x branch will not be removed until the 9.0 release.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Symfony's deprecation policy states that deprecations introduced in the 8.x branch will not be removed until the 9.0 release." ⏎ } ⏎ ``` | верно | Политика: деприкейшены живут до следующего мажора; 9.0 — ноябрь 2027. |
T21-L1 0.56 c | Twig | Inside {{ }}, Twig allows calling arbitrary PHP code directly. | «yes» Пояснение: Twig allows executing PHP code directly within templates using the `{{ }}` syntax.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Twig allows executing PHP code directly within templates using the `{{ }}` syntax." ⏎ } ⏎ ``` | неверно верный: «no» | Twig — DSL: только разрешённые окружением функции/фильтры; произвольный PHP не исполняется. |
T21-L2 0.67 c | Twig | By default, Twig auto-escapes printed variables. | «yes» Пояснение: Twig's default behavior is to automatically escape variables when they are printed to prevent cross-site scripting (XSS) vulnerabilities.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Twig's default behavior is to automatically escape variables when they are printed to prevent cross-site scripting (XSS) vulnerabilities." ⏎ } ⏎ ``` | верно | Autoescape включён по умолчанию; {{ '<b>' }} → <b>. Проверено на Twig 3.30. |
T21-L3 0.57 c | Twig | The Twig |e filter escapes a string for safe output in an HTML context. | «yes» Пояснение: The Twig |e filter escapes a string for HTML context, preventing cross-site scripting (XSS) vulnerabilities.
Raw```json ⏎ {"answer": "yes", "explanation": "The Twig |e filter escapes a string for HTML context, preventing cross-site scripting (XSS) vulnerabilities."} ⏎ ``` | верно | |e ('html') по умолчанию; есть контексты js/url/css. От SQL-инъекций он не защищает — это задача подготовленных запросов Doctrine. |
T21-L4 0.65 c | Twig | Which filter from twig/intl-extra formats a number according to a locale? | «number_format» Пояснение: The `number_format` filter in twig/intl-extra formats a number according to a specified locale.
Raw```json ⏎ { ⏎ "answer": "number_format", ⏎ "explanation": "The `number_format` filter in twig/intl-extra formats a number according to a specified locale." ⏎ } ⏎ ``` | неверно верный: «format_number» | |format_number(locale=...) из IntlExtension (twig/intl-extra есть в проекте). Проверено на Twig 3.30: 12345.6 → 12 345,6 (ru). |
T21-L5 0.78 c | Twig | The |raw filter disables auto-escaping for the value. | «yes» Пояснение: The question is incomplete, but assuming it refers to the existence of the `|raw` filter in PHP, it is a valid filter modifier that disables auto-escaping.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The question is incomplete, but assuming it refers to the existence of the `|raw` filter in PHP, it is a valid filter modifier that disables auto-escaping." ⏎ } ⏎ ``` | верно | {{ x|raw }} выводит HTML как есть; опасно с пользовательскими данными. Проверено на Twig 3.30. |
T21-L6 0.63 c | Twig | In Twig, {{ }} prints an expression value, while {% %} executes tags — conditions, loops, set. | «yes» Пояснение: In Twig, double curly braces {{ }} are used for printing expressions, and double percent signs {% %} are used for control structures like tags.
Raw```json ⏎ {"answer": "yes", "explanation": "In Twig, double curly braces {{ }} are used for printing expressions, and double percent signs {% %} are used for control structures like tags."} ⏎ ``` | верно | Два блока синтаксиса Twig: вывод (echo) против логики. |
T21-L7 0.51 c | Twig | In Twig you cannot declare a variable inside a template — values only come from the controller. | «no» Пояснение: Twig allows variable assignment within templates using the `set` tag.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Twig allows variable assignment within templates using the `set` tag." ⏎ } ⏎ ``` | верно | {% set y = ... %} объявляет переменную в шаблоне. Проверено на Twig 3.30. |
T21-L8 0.8 c | Twig | Which Twig function dumps the debug structure of a variable (array, object)? | «dump» Пояснение: The Twig function `dump()` displays detailed information about a variable, including its type and contents.
Raw```json ⏎ { ⏎ "answer": "dump", ⏎ "explanation": "The Twig function `dump()` displays detailed information about a variable, including its type and contents." ⏎ } ⏎ ``` | верно | {{ dump(x) }} (DebugExtension; в Symfony доступна в dev-окружении). |
T24-L1 0.63 c | Bootstrap | Bootstrap is a CSS/JS library of ready-made UI components, not an SPA framework. | «yes» Пояснение: Bootstrap provides pre-built UI components using CSS and JavaScript, but it is not a Single Page Application (SPA) framework like React or Angular.
Raw```json ⏎ {"answer": "yes", "explanation": "Bootstrap provides pre-built UI components using CSS and JavaScript, but it is not a Single Page Application (SPA) framework like React or Angular."} ⏎ ``` | верно | Компоненты и утилиты поверх вашего HTML; SPA-фреймворки (React/Vue) — другой класс инструментов. В проекте vendored 5.3.3. |
T24-L2 0.52 c | Bootstrap | Which Bootstrap class gives a responsive container with a fixed max width per breakpoint? | «container» Пояснение: The `container` class provides a responsive, fixed-width container.
Raw```json ⏎ { ⏎ "answer": "container", ⏎ "explanation": "The `container` class provides a responsive, fixed-width container." ⏎ } ⏎ ``` | верно | .container (фиксированная макс-ширина по брейкпоинтам) vs .container-fluid (на всю ширину). |
T24-L3 0.6 c | Bootstrap | The Bootstrap grid is built on CSS floats and splits a row into 16 columns. | «no» Пояснение: The Bootstrap grid is built on flexbox and splits a row into 12 columns by default.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The Bootstrap grid is built on flexbox and splits a row into 12 columns by default." ⏎ } ⏎ ``` | верно | Наоборот: flexbox (с Bootstrap 4) и 12 колонок; float-сетка — это Bootstrap 3. |
T24-L4 0.55 c | Bootstrap | Bootstrap's named breakpoints (the infix used in class names) are sm, md, lg, xl, xxl — five of them. | «yes» Пояснение: Bootstrap 5 and later versions use sm, md, lg, xl, and xxl as their responsive breakpoints.
Raw```json ⏎ {"answer": "yes", "explanation": "Bootstrap 5 and later versions use sm, md, lg, xl, and xxl as their responsive breakpoints."} ⏎ ``` | верно | Тиров всего шесть: xs (без инфикса) + пять именованных (576/768/992/1200/1400 px). |
T24-L5 0.63 c | Bootstrap | Utilities like .mt-3 or .px-2 use the spacing scale: the number is a multiple of $spacer. | «yes» Пояснение: Utilities like .mt-3 or .px-2 use the spacing scale, where the number is a multiple of the $spacer variable.
Raw```json ⏎ {"answer": "yes", "explanation": "Utilities like .mt-3 or .px-2 use the spacing scale, where the number is a multiple of the $spacer variable."} ⏎ ``` | неверно верный: «no» | Spacing utilities; $spacer = 1rem. |
T24-L6 0.76 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 to enable Bootstrap 5 components like dropdowns, modals, popovers, etc.
Raw```json ⏎ { ⏎ "answer": "data-bs-toggle", ⏎ "explanation": "The `data-bs-toggle` attribute is used to enable Bootstrap 5 components like dropdowns, modals, popovers, etc." ⏎ } ⏎ ``` | верно | data-bs-toggle="dropdown" и т.п.; в Bootstrap 4 атрибут назывался data-toggle. |
T24-L7 0.54 c | Bootstrap | Bootstrap 5 components work without jQuery — in plain vanilla JS. | «yes» Пояснение: Bootstrap 5 removed its dependency on jQuery and now relies on vanilla JavaScript.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "Bootstrap 5 removed its dependency on jQuery and now relies on vanilla JavaScript." ⏎ } ⏎ ``` | верно | jQuery удалён в Bootstrap 5.0: data-bs-* атрибуты и JS API. В проекте vendored 5.3.3. |
T24-L8 0.66 c | Bootstrap | Dark mode in Bootstrap is enabled with a .dark class on the root element. | «no» Пояснение: Dark mode in Bootstrap 5 is enabled using JavaScript and CSS variables, not a static .dark class on the root element.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Dark mode in Bootstrap 5 is enabled using JavaScript and CSS variables, not a static .dark class on the root element." ⏎ } ⏎ ``` | верно | Наоборот: тема включается атрибутом data-bs-theme="dark" (Color modes, с 5.3); класса .dark не существует. В проекте 5.3.3. |
T14-L1 0.76 c | Doctrine | Doctrine ORM creates database tables on the fly the first time an entity is used at runtime. | «no» Пояснение: Doctrine ORM requires schema creation (either manually or using tools like migrations) before entities can be persisted; it doesn't create tables on the fly at runtime.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Doctrine ORM requires schema creation (either manually or using tools like migrations) before entities can be persisted; it doesn't create tables on the fly at runtime." ⏎ } ⏎ ``` | верно | Схему создают инструменты (migrations, schema tool); рантайм структуру БД не меняет. |
T14-L2 0.71 c | Doctrine | Which EntityManager method marks a new object as managed without executing SQL until flush()? | «persist» Пояснение: The persist() method adds a new entity to the EntityManager's management, scheduling it for persistence but not yet saving it to the database.
Raw```json ⏎ { ⏎ "answer": "persist", ⏎ "explanation": "The persist() method adds a new entity to the EntityManager's management, scheduling it for persistence but not yet saving it to the database." ⏎ } ⏎ ``` | верно | persist() регистрирует объект в Unit of Work; INSERT выполняется на flush(). |
T14-L3 0.67 c | Doctrine | In Doctrine ORM 3, the EntityManager::merge() method exists and makes the passed object managed. | «yes» Пояснение: The EntityManager::merge() method in Doctrine ORM 3 persists or updates an object, making it managed by the EntityManager.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The EntityManager::merge() method in Doctrine ORM 3 persists or updates an object, making it managed by the EntityManager." ⏎ } ⏎ ``` | неверно верный: «no» | В ORM 3 merge() удалён (в vendor проекта 3.7.6 метода нет); в Doctrine 2.x merge() возвращал управляемую копию. Версия зафиксирована — ORM 3. |
T14-L4 0.61 c | Doctrine | DQL queries are written in terms of entities and their fields, not tables and columns. | «yes» Пояснение: DQL (Doctrine Query Language) operates on entity classes and their properties, abstracting away the underlying database schema of tables and columns.
Raw```json ⏎ {"answer": "yes", "explanation": "DQL (Doctrine Query Language) operates on entity classes and their properties, abstracting away the underlying database schema of tables and columns."} ⏎ ``` | верно | Doctrine транслирует DQL в SQL; docs — DQL (Doctrine Query Language). |
T14-L5 0.55 c | Doctrine | What does $repository->find(999) return when no record with id 999 exists? | «null» Пояснение: The find() method typically returns null if no record matching the criteria is found.
Raw```json ⏎ { ⏎ "answer": "null", ⏎ "explanation": "The find() method typically returns null if no record matching the criteria is found." ⏎ } ⏎ ``` | верно | find() возвращает null, если объект не найден (docs Repository methods). |
T14-L6 0.69 c | Doctrine | DoctrineBundle in Symfony automatically calls flush() at the end of every request. | «no» Пояснение: DoctrineBundle does not automatically call flush() at the end of every request; you need to call it explicitly or use autocommit.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "DoctrineBundle does not automatically call flush() at the end of every request; you need to call it explicitly or use autocommit." ⏎ } ⏎ ``` | верно | Авто-flush нет — flush() зовёт разработчик; незакрытая транзакция в конце запроса откатывается. |
T14-L7 0.64 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's Unit of Work, managed entities automatically have their changes tracked and flushed upon calling `flush()`.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "In Doctrine's Unit of Work, managed entities automatically have their changes tracked and flushed upon calling `flush()`." ⏎ } ⏎ ``` | верно | Dirty checking сравнивает снимки свойств; persist нужен только новым/отсоединённым объектам. |
T14-L8 0.77 c | Doctrine | remove() executes the SQL DELETE immediately, without waiting for flush(). | «no» Пояснение: remove() in PHP's database extensions typically uses prepared statements and executes the DELETE statement, but it doesn't bypass the flushing mechanism of the underlying database system.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "remove() in PHP's database extensions typically uses prepared statements and executes the DELETE statement, but it doesn't bypass the flushing mechanism of the underlying database system." ⏎ } ⏎ ``` | верно | remove() планирует удаление в Unit of Work; DELETE выполняется на flush() (docs — Deleting Objects). |
T15-L1 0.57 c | PostgreSQL | PostgreSQL uses MVCC, therefore readers block writers and writers block readers. | «no» Пояснение: PostgreSQL's MVCC allows readers and writers to operate concurrently without blocking each other.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PostgreSQL's MVCC allows readers and writers to operate concurrently without blocking each other." ⏎ } ⏎ ``` | верно | Наоборот: благодаря MVCC читатели не блокируют писателей и наоборот (снимки строк); docs PostgreSQL — Concurrency Control. |
T15-L2 0.62 c | PostgreSQL | Which SQL command shows a query's execution plan without executing the query? | «explain» Пояснение: The EXPLAIN statement is used in SQL to retrieve the execution plan for a query without actually running it.
Raw```json ⏎ { ⏎ "answer": "EXPLAIN", ⏎ "explanation": "The EXPLAIN statement is used in SQL to retrieve the execution plan for a query without actually running it." ⏎ } ⏎ ``` | верно | EXPLAIN без ANALYZE только строит план; проверено на PostgreSQL 17.7. |
T15-L3 0.99 c | PostgreSQL | SERIAL and GENERATED ... AS IDENTITY are just two names for the same mechanism. | «no» Пояснение: SERIAL is a MySQL data type for auto-incrementing integer columns, while GENERATED ... AS IDENTITY is a SQL standard feature for identity columns, supported by various database systems including MySQL (since version 8.0.17) and PostgreSQL.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "SERIAL is a MySQL data type for auto-incrementing integer columns, while GENERATED ... AS IDENTITY is a SQL standard feature for identity columns, supported by various database systems including MySQL (since version 8.0.17) and PostgreSQL." ⏎ } ⏎ ``` | верно | SERIAL — нестандартный макрос (sequence + DEFAULT), IDENTITY — SQL-стандарт; различаются владением и правами. Оба есть в PG 17 (проверено). |
T15-L4 0.52 c | PostgreSQL | By default, a PostgreSQL UNIQUE constraint allows only one row with NULL in the column. | «no» Пояснение: PostgreSQL UNIQUE constraints treat NULL values specially, allowing multiple rows to have NULL in the constrained column.
Raw```json ⏎ {"answer": "no", "explanation": "PostgreSQL UNIQUE constraints treat NULL values specially, allowing multiple rows to have NULL in the constrained column."} ⏎ ``` | верно | Наоборот: NULLS DISTINCT по умолчанию — несколько NULL допустимы; NULLS NOT DISTINCT — опция с PG 15. Проверено на PG 17.7. |
T15-L5 0.67 c | PostgreSQL | Which PostgreSQL aggregate function concatenates strings with a separator? | «string_agg» Пояснение: The string_agg function in PostgreSQL concatenates strings from multiple rows into a single string, separated by a specified delimiter.
Raw```json ⏎ { ⏎ "answer": "string_agg", ⏎ "explanation": "The string_agg function in PostgreSQL concatenates strings from multiple rows into a single string, separated by a specified delimiter." ⏎ } ⏎ ``` | верно | string_agg(значение, разделитель); проверено на PostgreSQL 17.7. |
T15-L6 0.67 c | PostgreSQL | Plain VACUUM returns the space occupied by dead tuples to the operating system. | «yes» Пояснение: Plain VACUUM reclaims storage occupied by dead tuples, making it available for reuse by the database system, which eventually returns the space to the OS.
Raw```json ⏎ {"answer": "yes", "explanation": "Plain VACUUM reclaims storage occupied by dead tuples, making it available for reuse by the database system, which eventually returns the space to the OS."} ⏎ ``` | неверно верный: «no» | VACUUM помечает место для переиспользования внутри таблицы; ОС его возвращает только VACUUM FULL (с эксклюзивной блокировкой). |
T15-L7 0.61 c | PostgreSQL | Which keyword in a window function definition partitions rows into groups the function is computed over? | «partition by» Пояснение: The PARTITION BY clause in a window function definition divides the result set into partitions or groups.
Raw```json ⏎ { ⏎ "answer": "PARTITION BY", ⏎ "explanation": "The PARTITION BY clause in a window function definition divides the result set into partitions or groups." ⏎ } ⏎ ``` | верно | OVER (PARTITION BY ...); проверено на PostgreSQL 17.7. |
T15-L8 0.49 c | PostgreSQL | The READ COMMITTED isolation level protects against non-repeatable reads. | «yes» Пояснение: READ COMMITTED isolation level prevents dirty reads but allows non-repeatable reads.
Raw```json ⏎ {"answer": "yes", "explanation": "READ COMMITTED isolation level prevents dirty reads but allows non-repeatable reads."} ⏎ ``` | неверно верный: «no» | READ COMMITTED допускает неповторяющееся чтение; защищает REPEATABLE READ. Проверено: SHOW transaction_isolation → read committed. |
T17-L1 0.63 c | PostgreSQL: transactions and indexes | By default, PostgreSQL wraps each single SQL statement in its own implicit transaction (autocommit). | «no» Пояснение: PostgreSQL's default is autocommit mode, meaning each statement is treated as its own transaction and committed immediately.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PostgreSQL's default is autocommit mode, meaning each statement is treated as its own transaction and committed immediately." ⏎ } ⏎ ``` | неверно верный: «yes» | Без BEGIN каждый оператор коммитится сам; docs PostgreSQL — Transactions. Проверено на PG 17. |
T17-L2 0.52 c | PostgreSQL: transactions and indexes | Which SQL command ends a transaction, committing all its changes? | «commit» Пояснение: The COMMIT command saves all changes made during the transaction to the database.
Raw```json ⏎ { ⏎ "answer": "COMMIT", ⏎ "explanation": "The COMMIT command saves all changes made during the transaction to the database." ⏎ } ⏎ ``` | верно | COMMIT (END — синоним). Проверено на PG 17. |
T17-L3 0.52 c | PostgreSQL: transactions and indexes | Indexes speed up more than SELECT: UPDATE and DELETE with a search on an indexed column benefit too. | «yes» Пояснение: Indexes significantly speed up UPDATE and DELETE operations when searching by an indexed column, similar to SELECT statements.
Raw```json ⏎ {"answer": "yes", "explanation": "Indexes significantly speed up UPDATE and DELETE operations when searching by an indexed column, similar to SELECT statements."} ⏎ ``` | верно | Поиск строк для изменения идёт по индексу; docs PostgreSQL — Indexes. |
T17-L4 0.47 c | PostgreSQL: transactions and indexes | To roll back part of the statements inside a transaction, PostgreSQL uses SAVEPOINT. | «yes» Пояснение: SAVEPOINT allows you to rollback to a specific point within a transaction in PostgreSQL.
Raw```json ⏎ {"answer": "yes", "explanation": "SAVEPOINT allows you to rollback to a specific point within a transaction in PostgreSQL."} ⏎ ``` | верно | SAVEPOINT name; ROLLBACK TO name — частичный откат без отмены всей транзакции. Проверено на PG 17. |
T17-L5 0.73 c | PostgreSQL: transactions and indexes | EXPLAIN ANALYZE shows the query plan without executing the query. | «yes» Пояснение: EXPLAIN ANALYZE is a command in PostgreSQL (and some other database systems) used to display the query plan and execution statistics for a given query.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "EXPLAIN ANALYZE is a command in PostgreSQL (and some other database systems) used to display the query plan and execution statistics for a given query." ⏎ } ⏎ ``` | неверно верный: «no» | Наоборот: ANALYZE реально выполняет запрос (с побочными эффектами!) и показывает фактические времена узлов; план без выполнения — plain EXPLAIN. |
T17-L6 0.61 c | PostgreSQL: transactions and indexes | Which PostgreSQL extension adds vector types and indexes for embedding search? | «pgvector» Пояснение: The pgvector extension provides vector data types and associated functions for PostgreSQL, enabling similarity searches on embeddings.
Raw```json ⏎ { ⏎ "answer": "pgvector", ⏎ "explanation": "The pgvector extension provides vector data types and associated functions for PostgreSQL, enabling similarity searches on embeddings." ⏎ } ⏎ ``` | верно | CREATE EXTENSION vector (проект pgvector; в проекте образ pgvector/pgvector:pg17). |
T17-L7 0.6 c | PostgreSQL: transactions and indexes | A partial index (CREATE INDEX ... WHERE ...) is built only over rows satisfying the condition. | «yes» Пояснение: A partial index in databases like PostgreSQL only indexes rows that meet the specified condition in the WHERE clause.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "A partial index in databases like PostgreSQL only indexes rows that meet the specified condition in the WHERE clause." ⏎ } ⏎ ``` | верно | docs PostgreSQL — Partial Indexes; типичный кейс — индекс по «активным» записям. |
T17-L8 1.06 c | PostgreSQL: transactions and indexes | The SERIALIZABLE level in PostgreSQL is implemented by locking the rows a transaction reads. | «no» Пояснение: SERIALIZABLE level in PostgreSQL uses locking mechanisms like locking ranges and potentially taking locks on rows, but it primarily relies on concurrency control mechanisms like multi-version concurrency control (MVCC) and pessimistic locking strategies to ensure serializability, not solely by locking every row read by a transaction.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "SERIALIZABLE level in PostgreSQL uses locking mechanisms like locking ranges and potentially taking locks on rows, but it primarily relies on concurrency control mechanisms like multi-version concurrency control (MVCC) and pessimistic locking strategies to ensure serializability, not solely by locking every row read by a transaction." ⏎ } ⏎ ``` | верно | SSI (Serializable Snapshot Isolation): предикатные блокировки на снимках, не блокировки прочитанных строк; docs PostgreSQL. |
T19-L1 0.7 c | HTTP and REST API | HTTP status 201 means the request resulted in a new resource being created. | «yes» Пояснение: HTTP status code 201 (Created) indicates that the request has been fulfilled, resulting in the creation of a new resource.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "HTTP status code 201 (Created) indicates that the request has been fulfilled, resulting in the creation of a new resource." ⏎ } ⏎ ``` | верно | 201 Created; обычно на POST, часто с Location; RFC 9110. |
T19-L2 0.6 c | HTTP and REST API | Which HTTP status means a successful request with an empty response body (e.g. after DELETE)? | «204» Пояснение: HTTP status code 204 No Content indicates a successful request, but the server does not return a message body.
Raw```json ⏎ {"answer": "204", "explanation": "HTTP status code 204 No Content indicates a successful request, but the server does not return a message body."} ⏎ ``` | верно | 204 No Content; RFC 9110. |
T19-L3 0.43 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» Пояснение: The DELETE method is defined as idempotent in the HTTP specification.
Raw```json ⏎ {"answer": "yes", "explanation": "The DELETE method is defined as idempotent in the HTTP specification."} ⏎ ``` | верно | RFC 9110: DELETE идемпотентен (как PUT); идемпотентность ≠ безопасность — ресурс удаляется при первом вызове. |
T19-L4 0.58 c | HTTP and REST API | The Access-Control-Allow-Origin header is sent by the client so that the server agrees to accept requests from another origin. | «no» Пояснение: The Access-Control-Allow-Origin header is sent by the server to indicate which origins are allowed to access the resource.
Raw```json ⏎ {"answer": "no", "explanation": "The Access-Control-Allow-Origin header is sent by the server to indicate which origins are allowed to access the resource."} ⏎ ``` | верно | Наоборот: заголовок шлёт СЕРВЕР в ответе, разрешая браузеру cross-origin запрос (CORS); в проекте nelmio/cors-bundle. |
T19-L5 0.71 c | HTTP and REST API | Status 429 Too Many Requests is used when a client exceeds a rate limit. | «yes» Пояснение: HTTP status code 429 (Too Many Requests) is specifically used to indicate that the user has sent too many requests in a given amount of time ('rate limiting').
Raw```json ⏎ {"answer": "yes", "explanation": "HTTP status code 429 (Too Many Requests) is specifically used to indicate that the user has sent too many requests in a given amount of time ('rate limiting')."} ⏎ ``` | верно | 429 (+ Retry-After); RFC 6585. В проекте symfony/rate-limiter. |
T19-L6 0.54 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```json ⏎ { ⏎ "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.6 c | HTTP and REST API | Which HTTP header indicates the MIME type of the request or response body? | «content-type» Пояснение: The Content-Type header specifies the MIME type of the body of the request or response.
Raw```json ⏎ { ⏎ "answer": "Content-Type", ⏎ "explanation": "The Content-Type header specifies the MIME type of the body of the request or response." ⏎ } ⏎ ``` | верно | Content-Type: application/json и т.п. |
T19-L8 0.68 c | HTTP and REST API | PATCH is not required to be idempotent per RFC 5789, unlike PUT. | «no» Пояснение: RFC 5789 states that PATCH *is* required to be idempotent if the idempotency token is included in the request.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "RFC 5789 states that PATCH *is* required to be idempotent if the idempotency token is included in the request." ⏎ } ⏎ ``` | неверно верный: «yes» | RFC 5789 прямо оговаривает: PATCH не гарантированно идемпотентен; PUT идемпотентен. |
T20-L1 0.69 c | Security and OAuth | Checking a password by comparing its hash to the stored hash with a plain == is sufficient. | «no» Пояснение: Comparing password hashes with '==' is vulnerable to timing attacks and doesn't guarantee a secure comparison; use password_verify() instead.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Comparing password hashes with '==' is vulnerable to timing attacks and doesn't guarantee a secure comparison; use password_verify() instead." ⏎ } ⏎ ``` | верно | Нужна постоянновременная проверка (password_verify) — timing-атаки; соль и алгоритм уже внутри хеша. |
T20-L2 0.43 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» Пояснение: This accurately describes the function and implementation of a CSRF token.
Raw```json ⏎ {"answer": "yes", "explanation": "This accurately describes the function and implementation of a CSRF token."} ⏎ ``` | верно | symfony/security-csrf в проекте; защита от подделки межсайтовой формы. |
T20-L3 0.73 c | Security and OAuth | Which HTTP header enables the CSP (Content Security Policy) policy? | «content-security-policy» Пояснение: The Content-Security-Policy HTTP response header is used to specify the sources from which the user agent is allowed to load resources.
Raw```json ⏎ { ⏎ "answer": "Content-Security-Policy", ⏎ "explanation": "The Content-Security-Policy HTTP response header is used to specify the sources from which the user agent is allowed to load resources." ⏎ } ⏎ ``` | верно | Content-Security-Policy; белые списки источников скриптов/стилей против XSS. |
T20-L4 0.9 c | Security and OAuth | OAuth 2.0 is an authentication protocol: the access token tells you who the user is. | «no» Пояснение: The access token in OAuth 2.0 grants access to resources on behalf of the user, but the identity of the user is typically provided by an ID token or is known by the client application through other means.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The access token in OAuth 2.0 grants access to resources on behalf of the user, but the identity of the user is typically provided by an ID token or is known by the client application through other means." ⏎ } ⏎ ``` | верно | OAuth 2.0 — авторизация/делегирование доступа; аутентификацию добавляет OpenID Connect. В проекте knpuniversity/oauth2-client-bundle (yandex/github/google). |
T20-L5 0.72 c | Security and OAuth | XSS is prevented by validating input on the server before writing it to the database. | «no» Пояснение: Server-side validation prevents SQL injection and ensures data integrity, but XSS prevention requires escaping output when displaying user-supplied data in the browser.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "Server-side validation prevents SQL injection and ensures data integrity, but XSS prevention requires escaping output when displaying user-supplied data in the browser." ⏎ } ⏎ ``` | верно | XSS лечится контекстным экранированием НА ВЫВОДЕ (Twig autoescape, CSP); валидация ввода не покрывает все контексты вывода. |
T20-L6 0.5 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» Пояснение: The authorization code is the parameter received at the redirect_uri after user authentication and consent.
Raw```json ⏎ {"answer": "code", "explanation": "The authorization code is the parameter received at the redirect_uri after user authentication and consent."} ⏎ ``` | верно | Параметр code; обмен на токен POST-ом на /token с client_secret. |
T20-L7 0.47 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 for longer-term persistence and automatically renewing access tokens.
Raw```json ⏎ {"answer": "yes", "explanation": "Refresh tokens are designed for longer-term persistence and automatically renewing access tokens."} ⏎ ``` | верно | Стандартная схема OAuth/OIDC: короткий access + длинный refresh. |
T20-L8 0.68 c | Security and OAuth | A password salt must be kept secret: without it the hash cannot be verified. | «yes» Пояснение: Salts are used to protect passwords, and keeping them secret prevents attackers from using precomputed tables (rainbow tables) or brute-force attacks to crack the hashes.
Raw```json ⏎ {"answer": "yes", "explanation": "Salts are used to protect passwords, and keeping them secret prevents attackers from using precomputed tables (rainbow tables) or brute-force attacks to crack the hashes."} ⏎ ``` | неверно верный: «no» | Соль хранится открыто (password_hash включает её в строку хеша); секретность соли не нужна. |
T18-L1 0.62 c | Testing: PHPUnit | PHPUnit runs test methods of any class — extending TestCase is not required. | «no» Пояснение: PHPUnit requires test methods to be part of a class that extends the TestCase class or implements the Test interface.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PHPUnit requires test methods to be part of a class that extends the TestCase class or implements the Test interface." ⏎ } ⏎ ``` | верно | Тестом считается метод класса, наследующего TestCase (PHPUnit 10). |
T18-L2 0.48 c | Testing: PHPUnit | In PHPUnit, setUp() runs once before all tests of the class. | «no» Пояснение: setUp() runs before each test method in the class.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "setUp() runs before each test method in the class." ⏎ } ⏎ ``` | верно | setUp() — перед КАЖДЫМ тестом; один раз на класс — setUpBeforeClass(). Проверено живым счётчиком на PHPUnit 10.5. |
T18-L3 0.44 c | Testing: PHPUnit | A data provider lets a test run with exactly one set of arguments. | «no» Пояснение: Data providers can provide multiple sets of arguments for a single test method.
Raw```json ⏎ {"answer": "no", "explanation": "Data providers can provide multiple sets of arguments for a single test method."} ⏎ ``` | верно | Наоборот: наборов может быть сколько угодно — тест выполняется по разу на каждый. Проверено на PHPUnit 10.5 (#[DataProvider]). |
T18-L4 0.58 c | Testing: PHPUnit | Which PHPUnit method declares an expectation that an exception of a given class is thrown? | «expectsexception» Пояснение: The expectsException method in PHPUnit is used to assert that a specific exception is thrown.
Raw```json ⏎ { ⏎ "answer": "expectsException", ⏎ "explanation": "The expectsException method in PHPUnit is used to assert that a specific exception is thrown." ⏎ } ⏎ ``` | неверно верный: «expectexception» | $this->expectException(\LogicException::class); проверено на PHPUnit 10.5. |
T18-L5 0.42 c | Testing: PHPUnit | In PHPUnit, a stub verifies which methods were called on it, while a mock only returns data. | «no» Пояснение: A stub returns data, while a mock verifies method calls.
Raw```json ⏎ {"answer": "no", "explanation": "A stub returns data, while a mock verifies method calls."} ⏎ ``` | верно | Наоборот: стаб подставляет данные, мок проверяет взаимодействия (createStub/createMock); docs PHPUnit — Test Doubles. |
T18-L6 0.55 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» Пояснение: The @dataProvider annotation is deprecated in PHPUnit 10+ in favor of the #[DataProvider] attribute.
Raw```json ⏎ {"answer": "yes", "explanation": "The @dataProvider annotation is deprecated in PHPUnit 10+ in favor of the #[DataProvider] attribute."} ⏎ ``` | верно | Аннотация ещё парсится в PHPUnit 10/11 (AnnotationParser в 10.5.66), удаление — в 12; атрибут — стандарт. |
T18-L7 0.62 c | Testing: PHPUnit | PHPUnit does not allow one test to depend on the result of another. | «no» Пояснение: PHPUnit allows dependencies between tests using annotations like @depends, although it's generally discouraged for maintainability.
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "PHPUnit allows dependencies between tests using annotations like @depends, although it's generally discouraged for maintainability." ⏎ } ⏎ ``` | верно | Зависимости есть: #[Depends] — зависимый тест не запустится, еслиProducer упал. |
T18-L8 0.55 c | Testing: PHPUnit | Which PHPUnit command-line option makes tests run in random order? | «--randomize» Пояснение: The --randomize option shuffles the order in which tests are executed.
Raw```json ⏎ { ⏎ "answer": "--randomize", ⏎ "explanation": "The --randomize option shuffles the order in which tests are executed." ⏎ } ⏎ ``` | неверно верный: «--order-by=random» | --order-by=random (PHPUnit 9+); опция есть в --help PHPUnit 10.5 (проектная). |
T01-L9 3.06 c | Syntax and operators | What does this code output?
```php
echo intdiv(7, 2) . intdiv(-7, 2);
``` | «3-4» Пояснение: intdiv(7, 2) returns 3, and intdiv(-7, 2) returns -4, so the output is their concatenation.
Raw```json ⏎ {"answer": "3-4", "explanation": "intdiv(7, 2) returns 3, and intdiv(-7, 2) returns -4, so the output is their concatenation."} ⏎ ``` | неверно верный: «3-3» | intdiv truncates toward zero: intdiv(-7, 2) = -3, not -4. |
T01-L10 0.65 c | Syntax and operators | What does this code output?
```php
echo -3 ** 2;
``` | «9» Пояснение: The exponentiation operator (**) calculates -3 raised to the power of 2, which is (-3) * (-3) = 9.
Raw```json ⏎ {"answer": 9, "explanation": "The exponentiation operator (**) calculates -3 raised to the power of 2, which is (-3) * (-3) = 9."} ⏎ ``` | неверно верный: «-9» | ** is right-associative and binds tighter than unary minus: -(3²). |
T02-L9 0.63 c | Types and comparisons | What does this code output?
```php
echo '1e1' == '10' ? 'true' : 'false';
``` | «true» Пояснение: The expression '1e1' evaluates to 10.0 in PHP, which is loosely equal to the string '10'.
Raw```json ⏎ {"answer": "true", "explanation": "The expression '1e1' evaluates to 10.0 in PHP, which is loosely equal to the string '10'."} ⏎ ``` | верно | Both strings are numeric — compared as numbers: 10 == 10. |
T02-L10 0.64 c | Types and comparisons | What does this code output?
```php
switch ('a') {
case 0: echo 'zero'; break;
default: echo 'other';
}
``` | «other» Пояснение: The switch statement evaluates the expression 'a'. Since 'a' is a string and not equal to 0, the default case is executed.
Raw```json ⏎ {"answer": "other", "explanation": "The switch statement evaluates the expression 'a'. Since 'a' is a string and not equal to 0, the default case is executed."} ⏎ ``` | верно | PHP 8: 'a' == 0 → false (used to be true) — default fires. |
T03-L9 1.02 c | Strings | What does this code output?
```php
echo strtr('abc', ['a' => '1', 'ab' => '2']);
``` | «1bc» Пояснение: The strtr function replaces 'a' with '1' and 'ab' with '2'. Since 'a' is replaced first, 'ab' becomes '2b', then 'a' in '2b' is replaced with '1', resulting in '1bc'.
Raw```json ⏎ {"answer": "1bc", "explanation": "The strtr function replaces 'a' with '1' and 'ab' with '2'. Since 'a' is replaced first, 'ab' becomes '2b', then 'a' in '2b' is replaced with '1', resulting in '1bc'."} ⏎ ``` | неверно верный: «2c» | strtr with an array prefers the longest matching key. |
T03-L10 0.84 c | Strings | What does this code output?
```php
echo '[' . substr('hello', -10) . ']';
``` | «[o]» Пояснение: substr('hello', -10) extracts the last 10 characters from 'hello', which is 'hello', and then the last character 'o' is extracted because the length is less than 10.
Raw```json ⏎ {"answer": "[o]", "explanation": "substr('hello', -10) extracts the last 10 characters from 'hello', which is 'hello', and then the last character 'o' is extracted because the length is less than 10."} ⏎ ``` | неверно верный: «[hello]» | A negative start beyond the string is clamped to the beginning. |
T04-L9 0.79 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 '+' operator merges associative arrays, keeping the first value if keys collide, and array_keys returns an array of keys. implode converts this array to a comma-separated string.
Raw```json ⏎ {"answer": "k,n,m", "explanation": "The '+' operator merges associative arrays, keeping the first value if keys collide, and array_keys returns an array of keys. implode converts this array to a comma-separated string."} ⏎ ``` | верно | The + operator: on duplicate string keys the left array wins. |
T04-L10 0.52 c | Arrays | What does this code output?
```php
$a = [[1, 'x', 2], [2, 'y', 1], [3, 'z', 2]];
usort($a, fn($p, $q) => $p[2] <=> $q[2]);
echo implode('', array_column($a, 1));
``` | «yxz» Пояснение: The code sorts the array by the third element and then concatenates the second elements.
Raw```json ⏎ {"answer": "yxz", "explanation": "The code sorts the array by the third element and then concatenates the second elements."} ⏎ ``` | верно | Sorts are stable since 8.0: x and z keep their order on a tie. |
T05-L10 3.23 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 function f subtracts the value associated with key 'b' from the value associated with key 'a' in the provided array, resulting in 5 - 1 = 4.
Raw```json ⏎ {"answer": 4, "explanation": "The function f subtracts the value associated with key 'b' from the value associated with key 'a' in the provided array, resulting in 5 - 1 = 4."} ⏎ ``` | верно | String keys of a spread array become named arguments. |
T05-L9 1.21 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 code creates an object of class P, calls the method g() which returns the value of the private variable v (which is 3), stores the result in $f, then sets $p to null, and finally echoes the value returned by the method referenced by $f (which is g()), which is 3.
Raw```json ⏎ { ⏎ "answer": "3", ⏎ "explanation": "The code creates an object of class P, calls the method g() which returns the value of the private variable v (which is 3), stores the result in $f, then sets $p to null, and finally echoes the value returned by the method referenced by $f (which is g()), which is 3." ⏎ } ⏎ ``` | верно | First-class callable syntax binds $this at creation time. |
T06-L9 0.68 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» Пояснение: The who() method in class A returns the name of the class it's called on, which is B when called on an instance of class B.
Raw```json ⏎ {"answer": "B", "explanation": "The who() method in class A returns the name of the class it's called on, which is B when called on an instance of class B."} ⏎ ``` | верно | Late static binding: static::class is the receiver's class. |
T06-L10 0.61 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» Пояснение: The setter method multiplies the input value by 2 before assigning it to the property x.
Raw```json ⏎ { ⏎ "answer": 10, ⏎ "explanation": "The setter method multiplies the input value by 2 before assigning it to the property x." ⏎ } ⏎ ``` | верно | Inside the set hook, $this->x writes the backing store (no recursion): 5*2. |
T07-L9 0.88 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 code uses traits TA and TB, both with a method f. Class TC uses both traits, resolving the conflict by preferring TB's f and aliasing TA's f as g.
Raw```json ⏎ { ⏎ "answer": "BA", ⏎ "explanation": "The code uses traits TA and TB, both with a method f. Class TC uses both traits, resolving the conflict by preferring TB's f and aliasing TA's f as g." ⏎ } ⏎ ``` | верно | insteadof picks the implementation; as keeps the other under an alias. |
T07-L10 0.69 c | Interfaces, traits, enum | What does this code output?
```php
trait Counter
{
public static int $n = 0;
}
class CX { use Counter; }
class CY { use Counter; }
CX::$n = 1;
echo CY::$n;
``` | «1» Пояснение: Traits define properties that can be used by multiple classes; modifying a static property of a trait through one class affects its value for all classes using that trait.
Raw```json ⏎ {"answer": "1", "explanation": "Traits define properties that can be used by multiple classes; modifying a static property of a trait through one class affects its value for all classes using that trait."} ⏎ ``` | неверно верный: «0» | A trait's static property is copied into each consuming class. |
T08-L10 0.48 c | Exceptions and errors | What does this code output?
```php
function f(): int
{
try { return 1; } finally { return 2; }
}
echo f();
``` | «2» Пояснение: The finally block always executes, overriding the return value of the try block.
Raw```json ⏎ {"answer": "2", "explanation": "The finally block always executes, overriding the return value of the try block."} ⏎ ``` | верно | A return in finally overrides the return from try. |
T08-L9 0.59 c | Exceptions and errors | What does this code output?
```php
try {
try {
throw new RuntimeException('first');
} finally {
throw new LogicException('second');
}
} catch (LogicException $e) {
echo $e->getMessage();
}
``` | «second» Пояснение: The inner finally block throws a LogicException, which is caught by the outer catch block, and its message is echoed.
Raw```json ⏎ {"answer": "second", "explanation": "The inner finally block throws a LogicException, which is caught by the outer catch block, and its message is echoed."} ⏎ ``` | верно | An exception from finally replaces the in-flight one — the last thrown is caught. |
T09-L9 0.95 c | Namespaces and autoloading | What does this code output?
```php
namespace N;
use App\Foo as Baz;
echo Baz::class . '|' . \Baz::class;
``` | «app\baz|n\baz» Пояснение: The code echoes the fully qualified class name of App\Foo (aliased as Baz in the current namespace N) followed by '|' and then the fully qualified class name of the global namespace Baz.
Raw```json ⏎ { ⏎ "answer": "App\\Baz|N\\Baz", ⏎ "explanation": "The code echoes the fully qualified class name of App\\Foo (aliased as Baz in the current namespace N) followed by '|' and then the fully qualified class name of the global namespace Baz." ⏎ } ⏎ ``` | неверно верный: «app\foo|baz» | The use alias applies to unqualified names; a leading \ escapes to the global scope. |
T09-L10 0.72 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');
``` | «yesyes» Пояснение: The code checks if the class 'Foo' exists in the current namespace (Ns\Foo) and if the namespace 'Ns' exists, both are true.
Raw```json ⏎ {"answer": "yesyes", "explanation": "The code checks if the class 'Foo' exists in the current namespace (Ns\\Foo) and if the namespace 'Ns' exists, both are true."} ⏎ ``` | неверно верный: «noyes» | Dynamic names are not resolved against the namespace — 'Foo' is the global class. |
T10-L9 0.63 c | References and scope | What does this code output?
```php
$a = [1, 2, 3];
foreach ($a as &$v) {}
$v = 99;
echo implode(',', $a);
``` | «1, 2, 99» Пояснение: The foreach loop iterates by reference, so modifying $v after the loop affects the original array element.
Raw```json ⏎ {"answer": "1, 2, 99", "explanation": "The foreach loop iterates by reference, so modifying $v after the loop affects the original array element."} ⏎ ``` | верно | After a by-ref foreach, $v remains a reference to the last element. |
T10-L10 1.32 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();
``` | «3» Пояснение: The static variable `$n` in class `A` persists its value across instances and calls. The first call to `$a->inc()` increments `$n` to 1. The call to `$b->inc()` increments `$n` to 2. The final call to `$a->inc()` increments `$n` to 3, which is then returned.
Raw```json ⏎ { ⏎ "answer": "3", ⏎ "explanation": "The static variable `$n` in class `A` persists its value across instances and calls. The first call to `$a->inc()` increments `$n` to 1. The call to `$b->inc()` increments `$n` to 2. The final call to `$a->inc()` increments `$n` to 3, which is then returned." ⏎ } ⏎ ``` | верно | A method's static variable belongs to the parent's method — subclasses share it. |
T11-L9 1.03 c | Generators, iterators, SPL | What does this code output?
```php
function g(): Generator
{
$x = yield 1;
return $x + 1;
}
$g = g();
$g->send(10);
echo $g->getReturn();
``` | «11» Пояснение: The generator yields 1, which is sent to the generator via send(10). The value sent (10) is assigned to $x. The generator returns $x + 1 (10 + 1 = 11).
Raw```json ⏎ { ⏎ "answer": "11", ⏎ "explanation": "The generator yields 1, which is sent to the generator via send(10). The value sent (10) is assigned to $x. The generator returns $x + 1 (10 + 1 = 11)." ⏎ } ⏎ ``` | верно | send() resumes the generator: $x = 10, return 10+1. |
T11-L10 1.08 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» Пояснение: The inner generator yields 1 and 2, then returns 'ok'. The outer generator yields from inner(), receiving 1 and 2, then yields the return value 'ok'. Finally, the result is converted to an array and joined by commas.
Raw```json ⏎ { ⏎ "answer": "1,2,ok", ⏎ "explanation": "The inner generator yields 1 and 2, then returns 'ok'. The outer generator yields from inner(), receiving 1 and 2, then yields the return value 'ok'. Finally, the result is converted to an array and joined by commas." ⏎ } ⏎ ``` | неверно верный: «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.97 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';
``` | «yesyes» Пояснение: The first call checks if the hash needs rehash with cost 4, which it doesn't, so it outputs 'no'. The second call checks if the hash needs rehash with cost 5, which it does, so it outputs 'yes'.
Raw```json ⏎ {"answer": "yesyes", "explanation": "The first call checks if the hash needs rehash with cost 4, which it doesn't, so it outputs 'no'. The second call checks if the hash needs rehash with cost 5, which it does, so it outputs 'yes'."} ⏎ ``` | неверно верный: «noyes» | password_needs_rehash compares the hash's options with the target: cost 4 = 4 → 'no', cost 5 ≠ 4 → 'yes'. |
T12-L10 1.27 c | Configuration and security | What does this code output on PHP 8.5?
```php
echo (E_ALL & 2048) === 0 ? 'strict-out' : 'strict-in';
``` | «strict-in» Пояснение: E_ALL is 33554432, and 2048 is E_NOTICE. E_ALL & 2048 (33554432 & 2048) is 2048, which is not equal to 0, so the expression evaluates to 'strict-in'.
Raw```json ⏎ {"answer": "strict-in", "explanation": "E_ALL is 33554432, and 2048 is E_NOTICE. E_ALL & 2048 (33554432 & 2048) is 2048, which is not equal to 0, so the expression evaluates to 'strict-in'."} ⏎ ``` | неверно верный: «strict-out» | Since PHP 8.4, E_STRICT is out of E_ALL: the 2048 bit is unset → 'strict-out' (2048 is the historical E_STRICT bit). |
T13-L9 0.76 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» Пояснение: The code checks if the 'X-Token' request header exists and its value is 'abc', which it does, so it outputs 'mapped'.
Raw```json ⏎ { ⏎ "answer": "mapped", ⏎ "explanation": "The code checks if the 'X-Token' request header exists and its value is 'abc', which it does, so it outputs 'mapped'." ⏎ } ⏎ ``` | верно | 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 1.12 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;
``` | «cab» Пояснение: Event listeners are executed based on their priority, with higher priorities executing first. Listener with priority 5 executes before listeners with default priority (0) and priority 10. Listener with priority 10 executes before the listener with default priority (0). Therefore, the output is CAB.
Raw```json ⏎ { ⏎ "answer": "CAB", ⏎ "explanation": "Event listeners are executed based on their priority, with higher priorities executing first. Listener with priority 5 executes before listeners with default priority (0) and priority 10. Listener with priority 10 executes before the listener with default priority (0). Therefore, the output is CAB." ⏎ } ⏎ ``` | неверно верный: «bca» | Listeners run by descending priority: 10 (B), 5 (C), 0 (A). |
T14-L10 0.81 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» Пояснение: Both `$a` and `$b` are assigned the same object instance retrieved from the EntityManager based on the same ID, so they will have the same object ID.
Raw```json ⏎ { ⏎ "answer": "same", ⏎ "explanation": "Both `$a` and `$b` are assigned the same object instance retrieved from the EntityManager based on the same ID, so they will have the same object ID." ⏎ } ⏎ ``` | верно | Identity map: a second find for the same id returns the same instance. |
T14-L9 0.63 c | Doctrine | Given: Doctrine ORM 3, an EntityManager on in-memory SQLite, entity User with an auto-increment primary key. The users table is empty. What does this code output?
```php
$u = new User(name: 'B');
$em->persist($u);
$em->remove($u);
$em->flush();
echo count($em->getConnection()->fetchAllAssociative('SELECT * FROM users'));
``` | «0» Пояснение: The user is persisted and then immediately removed before the flush operation, resulting in an empty users table.
Raw```json ⏎ { ⏎ "answer": "0", ⏎ "explanation": "The user is persisted and then immediately removed before the flush operation, resulting in an empty users table." ⏎ } ⏎ ``` | верно | The unit of work schedules INSERT at flush: remove after persist cancels it. |
T15-L10 0.54 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» Пояснение: The COUNT function counts non-NULL values in the specified column.
Raw```json ⏎ { ⏎ "answer": 1, ⏎ "explanation": "The COUNT function counts non-NULL values in the specified column." ⏎ } ⏎ ``` | верно | count(column) skips NULLs; count(*) would return 2. |
T15-L9 0.84 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 query calculates the cumulative sum of the 'x' column ordered by 'id' and then concatenates these sums into a comma-separated string.
Raw```json ⏎ { ⏎ "answer": "10,30,60", ⏎ "explanation": "The query calculates the cumulative sum of the 'x' column ordered by 'id' and then concatenates these sums into a comma-separated string." ⏎ } ⏎ ``` | верно | With ORDER BY the default window frame is running (start to current row). |
T16-L9 0.82 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 code dispatches a message through a MessageBus with two middlewares, 'M1' and 'M2', which print their respective tags sequentially.
Raw```json ⏎ { ⏎ "answer": "M1M2", ⏎ "explanation": "The code dispatches a message through a MessageBus with two middlewares, 'M1' and 'M2', which print their respective tags sequentially." ⏎ } ⏎ ``` | верно | The first-added middleware runs first (outermost). |
T16-L10 0.88 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 code dispatches a Ping message, which is handled by two handlers sequentially, incrementing the counter $n by 1 and then by 10, resulting in a final value of 11.
Raw```json ⏎ {"answer": 11, "explanation": "The code dispatches a Ping message, which is handled by two handlers sequentially, incrementing the counter $n by 1 and then by 10, resulting in a final value of 11."} ⏎ ``` | верно | All registered handlers of the message run: 1 + 10 = 11. |
T17-L9 0.88 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 query inserts the value 1 into the table t, but the unique index prevents duplicate values, so only the first insertion succeeds, and the second is ignored by ON CONFLICT DO NOTHING.
Raw```json ⏎ { ⏎ "answer": 1, ⏎ "explanation": "The query inserts the value 1 into the table t, but the unique index prevents duplicate values, so only the first insertion succeeds, and the second is ignored by ON CONFLICT DO NOTHING." ⏎ } ⏎ ``` | верно | ON CONFLICT DO NOTHING skips the duplicate: one insert. |
T17-L10 0.76 c | PostgreSQL: transactions and indexes | What does this sequence of psql commands output?
```sql
BEGIN;
CREATE TEMP TABLE t (a int, UNIQUE (a) DEFERRABLE INITIALLY DEFERRED);
INSERT INTO t VALUES (1);
INSERT INTO t VALUES (1);
SELECT count(*) FROM t;
``` | «1» Пояснение: The UNIQUE constraint with DEFERRABLE INITIALLY DEFERRED allows duplicate inserts within the transaction, and the SELECT counts the rows present after the inserts.
Raw```json ⏎ { ⏎ "answer": "1", ⏎ "explanation": "The UNIQUE constraint with DEFERRABLE INITIALLY DEFERRED allows duplicate inserts within the transaction, and the SELECT counts the rows present after the inserts." ⏎ } ⏎ ``` | неверно верный: «2» | DEFERRED postpones the uniqueness check to COMMIT — count sees 2 rows. |
T18-L9 1.19 c | Testing: PHPUnit | How many tests will this command run?
```php
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
final class CalcTest extends TestCase
{
public static function prov(): array
{
return [[1], [2], [3]];
}
#[DataProvider('prov')]
public function test_sum(int $x): void
{
$this->assertTrue($x > 0);
}
#[DataProvider('prov')]
public function test_sum_abs(int $x): void
{
$this->assertTrue($x > 0);
}
public function test_other(): void
{
$this->assertTrue(true);
}
}
```
Command: `phpunit CalcTest.php --filter test_sum` (PHPUnit 10.5) | «6» Пояснение: The command runs the 'test_sum' method twice (once for each data provider), and the 'test_sum_abs' method twice (once for each data provider), plus the 'test_other' method once, for a total of 2 + 2 + 1 = 5 tests.
Raw```json ⏎ { ⏎ "answer": 6, ⏎ "explanation": "The command runs the 'test_sum' method twice (once for each data provider), and the 'test_sum_abs' method twice (once for each data provider), plus the 'test_other' method once, for a total of 2 + 2 + 1 = 5 tests." ⏎ } ⏎ ``` | верно | --filter is a substring match: test_sum also matches test_sum_abs (3+3 datasets). |
T18-L10 0.68 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 test suite has two test cases defined by the data provider, and one of them (with -1) will fail the assertion.
Raw```json ⏎ {"answer": "2,1", "explanation": "The test suite has two test cases defined by the data provider, and one of them (with -1) will fail the assertion."} ⏎ ``` | верно | 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.72 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` option in curl specifies data to be sent in the body of the request, which is typically associated with the POST method.
Raw```json ⏎ { ⏎ "answer": "POST", ⏎ "explanation": "The `-d` option in curl specifies data to be sent in the body of the request, which is typically associated with the POST method." ⏎ } ⏎ ``` | верно | -d/-F switches curl to POST by default. |
T19-L10 0.69 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 specifies that the request should use the GET method, even if data is provided via `-d`.
Raw```json ⏎ { ⏎ "answer": "GET", ⏎ "explanation": "The `-G` flag in curl specifies that the request should use the GET method, even if data is provided via `-d`." ⏎ } ⏎ ``` | верно | -G turns -d data into the query string; the method stays GET. |
T20-L9 0.73 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» Пояснение: The `invalid_client` error is returned when the client authentication fails, typically due to an incorrect or non-existent client ID.
Raw```json ⏎ { ⏎ "answer": "invalid_client", ⏎ "explanation": "The `invalid_client` error is returned when the client authentication fails, typically due to an incorrect or non-existent client ID." ⏎ } ⏎ ``` | верно | Unknown client → invalid_client (RFC 6749 §5.2). |
T20-L10 0.7 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» Пояснение: When response_type=token, the access token is returned in the URL fragment (after the '#') of the redirect_uri.
Raw```json ⏎ { ⏎ "answer": "fragment", ⏎ "explanation": "When response_type=token, the access token is returned in the URL fragment (after the '#') of the redirect_uri." ⏎ } ⏎ ``` | верно | The implicit flow passes the token in the URL fragment (#) — it never reaches the server. |
T21-L9 0.57 c | Twig | What does this Twig template output?
```twig
{{ false|default(2) * 3 }}
``` | «6» Пояснение: The `default` filter replaces `false` with `2`, which is then multiplied by `3`.
Raw```json ⏎ {"answer": 6, "explanation": "The `default` filter replaces `false` with `2`, which is then multiplied by `3`."} ⏎ ``` | верно | default replaces exactly false/null/''/[] — false becomes 2, 2*3 = 6; the naive 'default is for undefined only' yields 0. |
T21-L10 0.92 c | Twig | What exception class does render() of this template throw?
```twig
{{ 'a' ~ 1 + 2 }}
``` | «no» Пояснение: The code attempts to concatenate a string ('a') with an integer (3), which is not a valid operation in Twig and will likely result in a parse error, not a specific exception class being thrown by render().
Raw```json ⏎ { ⏎ "answer": "no", ⏎ "explanation": "The code attempts to concatenate a string ('a') with an integer (3), which is not a valid operation in Twig and will likely result in a parse error, not a specific exception class being thrown by render()." ⏎ } ⏎ ``` | неверно верный: «runtimeerror» | In Twig ~ binds tighter than +: ('a' ~ 1) + 2 → string + int → a render error (RuntimeError). |
T22-L9 0.53 c | Symfony: Security and forms | What does this code output?
```php
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Constraints as Assert;
$v = Validation::createValidator();
echo count($v->validate([''], [new Assert\NotBlank()]));
``` | «1» Пояснение: The code validates an empty string against a NotBlank constraint, which results in one validation error.
Raw```json ⏎ {"answer": 1, "explanation": "The code validates an empty string against a NotBlank constraint, which results in one validation error."} ⏎ ``` | неверно верный: «0» | NotBlank treats null, '', [] as blank — the array [''] is not blank. |
T22-L10 0.53 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);
}
``` | «invalid» Пояснение: The form is created but not submitted or validated with data, so isValid() returns false.
Raw```json ⏎ {"answer": "invalid", "explanation": "The form is created but not submitted or validated with data, so isValid() returns false."} ⏎ ``` | неверно верный: «symfony\component\form\exception\logicexception» | isValid() on a non-submitted form throws LogicException, it does not return false. |
T23-L9 1.05 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 code registers a service 'a' of type stdClass, compiles the container, and then retrieves it twice using `get('a')`. Since the container manages the object's lifecycle, retrieving it twice will return the same object instance, thus comparing their object IDs will result in equality.
Raw```json ⏎ {"answer": "same", "explanation": "The code registers a service 'a' of type stdClass, compiles the container, and then retrieves it twice using `get('a')`. Since the container manages the object's lifecycle, retrieving it twice will return the same object instance, thus comparing their object IDs will result in equality."} ⏎ ``` | верно | Container services are shared: two get() calls yield one instance. |
T23-L10 0.9 c | Symfony: configuration and services | What does this code output?
```php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$c = new ContainerBuilder();
$c->setParameter('name', 'Bob');
$c->setParameter('greeting', 'hi %name%');
$c->setParameter('message', '%greeting%!');
$c->compile();
echo $c->getParameter('message');
``` | «hi bob!» Пояснение: The code uses Symfony's ContainerBuilder to define parameters and interpolate them. The 'message' parameter uses the 'greeting' parameter, which in turn uses the 'name' parameter, resulting in the final string 'hi Bob!'.
Raw```json ⏎ {"answer": "hi Bob!", "explanation": "The code uses Symfony's ContainerBuilder to define parameters and interpolate them. The 'message' parameter uses the 'greeting' parameter, which in turn uses the 'name' parameter, resulting in the final string 'hi Bob!'."} ⏎ ``` | верно | compile() resolves %-references transitively: %greeting% → 'hi %name%' → 'hi Bob!', the answer assembles over two hops. |
T24-L9 1.04 c | Bootstrap | What is the max-width of .container in Bootstrap 5.3 at a 992px viewport? | «960» Пояснение: Bootstrap 5.3 uses a 12-column grid system and defines specific container widths for different screen sizes. At the 'lg' breakpoint (992px and above), the container has a max-width of 960px.
Raw```json ⏎ { ⏎ "answer": "960", ⏎ "explanation": "Bootstrap 5.3 uses a 12-column grid system and defines specific container widths for different screen sizes. At the 'lg' breakpoint (992px and above), the container has a max-width of 960px." ⏎ } ⏎ ``` | верно | 5.x container widths: 540/720/960/1140/1320 (sm–xxl); 992 → 960px. |
T24-L10 0.69 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-danger» Пояснение: The `text-danger` class sets the text color to red (danger color) in Bootstrap 5.3.
Raw```json ⏎ { ⏎ "answer": "text-danger", ⏎ "explanation": "The `text-danger` class sets the text color to red (danger color) in Bootstrap 5.3." ⏎ } ⏎ ``` | верно | Specificity ties — the later rule wins: text-danger is declared after text-primary. |
T25-L9 0.75 c | Clean architecture | Layers: Domain, Application, Infrastructure. Deptrac rules: Application → Domain; Infrastructure → Domain, Application; Domain → Domain only.
How many violations will deptrac report for this class?
```php
namespace App\Domain;
use App\Application\PlaceOrder;
use App\Infrastructure\Db;
class OrderService
{
public function __construct(
private PlaceOrder $handler,
private Db $db,
) {}
}
``` | «2» Пояснение: The class OrderService is in the Domain layer, but it depends on classes from the Application and Infrastructure layers, violating the Deptrac rules.
Raw```json ⏎ { ⏎ "answer": 2, ⏎ "explanation": "The class OrderService is in the Domain layer, but it depends on classes from the Application and Infrastructure layers, violating the Deptrac rules." ⏎ } ⏎ ``` | верно | Domain may depend only on Domain: PlaceOrder (Application) + Db (Infrastructure) = 2. |
T25-L10 0.76 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,
) {}
}
``` | «2» Пояснение: BillingService in the Domain layer depends on classes from the Application layer (PlaceOrder) and Infrastructure layer (Db, Logger), violating the defined dependency rules.
Raw```json ⏎ { ⏎ "answer": 2, ⏎ "explanation": "BillingService in the Domain layer depends on classes from the Application layer (PlaceOrder) and Infrastructure layer (Db, Logger), violating the defined dependency rules." ⏎ } ⏎ ``` | неверно верный: «3» | The inline FQCN \App\Infrastructure\Logger counts too: Application + Db + Logger = 3. |
T26-L10 1.21 c | DDD | What does this code output?
```php
final class Money
{
public function __construct(public readonly int $amount) {}
public function add(Money $o): Money
{
return new self($this->amount + $o->amount);
}
}
$a = new Money(10);
$c = $a->add(new Money(5));
echo $a->amount . ',' . $c->amount;
``` | «10,15» Пояснение: The code creates a Money object with amount 10, adds another Money object with amount 5 to it, resulting in a new Money object with amount 15, and then prints the amount of the original object (10) and the new object (15) separated by a comma.
Raw```json ⏎ { ⏎ "answer": "10,15", ⏎ "explanation": "The code creates a Money object with amount 10, adds another Money object with amount 5 to it, resulting in a new Money object with amount 15, and then prints the amount of the original object (10) and the new object (15) separated by a comma." ⏎ } ⏎ ``` | верно | The VO is immutable: add() returns a new instance; the original is unchanged. |
T26-L9 0.78 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();
``` | «0» Пояснение: The code adds item 'a', then attempts to remove it. Since it's the only item, a DomainException is thrown and caught. The count then returns 0.
Raw```json ⏎ {"answer": 0, "explanation": "The code adds item 'a', then attempts to remove it. Since it's the only item, a DomainException is thrown and caught. The count then returns 0."} ⏎ ``` | неверно верный: «1» | The failed remove leaves aggregate state unchanged: the invariant threw before unset — count stays 1. |
VC-L9 3.09 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, calls the method 'hi' on it, which returns the string 'hi', and then echoes that string to the output.
Raw```json ⏎ {"answer": "hi", "explanation": "The code creates an instance of class C, calls the method 'hi' on it, which returns the string 'hi', and then echoes that string to the output."} ⏎ ``` | верно | Since 8.4, new in a method chain works without wrapping parentheses. |
VC-L10 3.07 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';
``` | «non» Пояснение: The lazy ghost object is initialized when its property is accessed, so the second check returns false.
Raw```json ⏎ { ⏎ "answer": "non", ⏎ "explanation": "The lazy ghost object is initialized when its property is accessed, so the second check returns false." ⏎ } ⏎ ``` | неверно верный: «yesno» | newLazyGhost (8.4): the object stays lazy until first access — reading a property initializes it and clears the flag. |
T28-L9 0.64 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';
``` | «yes» Пояснение: The Symfony\Component\Security\Guard\AbstractGuardAuthenticator class exists in Symfony 8.1.
Raw```json ⏎ { ⏎ "answer": "yes", ⏎ "explanation": "The Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator class exists in Symfony 8.1." ⏎ } ⏎ ``` | неверно верный: «no» | Guard authentication was removed in Symfony 7.0 — the class is gone in 8.1. |
T28-L10 0.5 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';
``` | «yesyes» Пояснение: Both classes exist in Symfony 8.1.
Raw```json ⏎ { ⏎ "answer": "yesyes", ⏎ "explanation": "Both classes exist in Symfony 8.1." ⏎ } ⏎ ``` | неверно верный: «noyes» | Annotation loaders were removed in 7.0; only attribute loaders remain (Annotation→Attribute). |