1. Programming Basics

Descrição

TYPO3 TYPO3 CD 2020 (zweite Auflage) (1. Programming Basics) Quiz sobre 1. Programming Basics, criado por Ma Hi em 25-03-2021.
Ma Hi
Quiz por Ma Hi, atualizado more than 1 year ago
Ma Hi
Criado por Ma Hi mais de 3 anos atrás
10
0

Resumo de Recurso

Questão 1

Questão
What are valid PHP namespaces for TYPO3 extensions? (2)
Responda
  • \typo3\MyExtension
  • \TYPO3\CMS\MyExtension
  • \VendorName\MyExtension
  • \Symfony\Console
  • \vendor_name\my_extension
  • \AwesomeNerds\my_extension

Questão 2

Questão
What are “return type declarations”? (2)
Responda
  • They declare the type of an extension, e.g. “frontend plugin” or “backend module”.
  • They specify how many methods a PHP class may contain.
  • They specify the maximum time allowed to return an object.
  • They specify the type of the value that is returned from a function or method.
  • Return values can be marked as “nullable” by prefixing the type name with a question mark since PHP version 7.1.

Questão 3

Questão
What does the “strict mode” do in PHP and how do you enable it? (2)
Responda
  • The strict mode ensures that a variable passed to a function must exactly be of the declared type.
  • The strict mode allows developers to restrict access to class properties.
  • With the strict mode enabled, class names must be written in lowerCamelCase.
  • The strict mode can be enabled and disabled in the TYPO3 Install Tool as required.
  • The strict mode can be enabled by adding the line declare(strict_types = 1); at the top of the PHP file.

Questão 4

Questão
Which statements about the PHP strict mode in TYPO3 extensions are correct? (3)
Responda
  • The PHP strict mode must not be used in any TYPO3 extension files at all (TYPO3 v9 LTS does not support this feature).
  • The PHP strict mode must not be enabled in the file ext_tables.php.
  • The PHP strict mode must not be enabled in the file ext_localconf.php.
  • The PHP strict mode must not be enabled in any TCA files under Configuration/TCA/.
  • If the PHP strict mode is enabled in controller classes, the output of the action methods is not cached.

Questão 5

Questão
Which standards should be followed when you develop TYPO3 extensions or contribute to the TYPO3 core? (3)
Responda
  • PHP coding guidelines, following the PSR-2 standard.
  • Style Guide for PHP Code (PEP-8).
  • Specific guidelines apply to PHP file and directory names.
  • The X-Mas Standard Policy applies to XLIFF language files.
  • The Airbnb JavaScript Style Guide should be used for JavaScript files.
  • TYPO3 is open-source software and therefore no coding guidelines exist.

Questão 6

Questão
Which coding rules apply in TYPO3 according to the PSR standard? (2)
Responda
  • Opening curly braces for classes must go on the same line.
  • Opening curly braces for classes must go on the next line.
  • Opening curly braces for if-statements must go on the same line.
  • Opening curly braces for if-statements must go on the next line.
  • TYPO3 does not adhere to any coding guidelines.

Questão 7

Questão
Which coding rules apply in TYPO3 according to the PSR standard? (3)
Responda
  • The maximum length of a line must not exceed 80 characters.
  • Code must use four spaces for indenting, not tabs.
  • A PHP file must not contain the closing PHP tag ?> at the end.
  • Spaces are not allowed at the end of lines.
  • Spaces are not allowed after a comma.

Questão 8

Questão
What issues in the following code violate the official TYPO3 coding guidelines? (2)
Responda
  • The namespace declaration must not start with a backslash \.
  • The opening curly bracket for PHP classes must go on the next line.
  • The opening curly bracket for methods must be on the same line as the method definition.
  • The comments with the annotation must start with /* rather than /**.

Questão 9

Questão
What issues in the following code violate the official TYPO3 coding guidelines? (2)
Responda
  • The fully qualified class name (FQCN) must always be used.
  • Property names must be written in lowerCamelCase.
  • There must not be a return type hint “string”.
  • There must not be a closing ?> tag.

Questão 10

Questão
Which coding rules apply to JavaScript files in TYPO3 projects? (2)
Responda
  • JavaScript files of the TYPO3 core must be located under typo3conf/assets/javascript/.
  • JavaScript files in extensions should be located under Resources/Public/JavaScript/.
  • TABs should be used for line indenting.
  • Strings should always use double-quotes (").
  • File endings of JavaScript files should be .js.

Questão 11

Questão
Which statements about semantic versioning are correct? (2)
Responda
  • A versioning scheme following semantic versioning has exactly two numbers separated by dots, e.g. 1.2.
  • A versioning scheme following semantic versioning has exactly three numbers separated by dots, e.g. 1.2.3.
  • A versioning scheme following semantic versioning has exactly four numbers separated by dots, e.g. 1.2.3.4.
  • The last number represents “patch” versions when developers make backwards-compatible bug fixes.
  • The first number indicates if a release is a long-term support release (LTS).

Questão 12

Questão
Which statements about semantic versioning are correct? (2)
Responda
  • Semantic versioning dictates that LTS-releases are marked appropriately, e.g. 1.2.3-lts.
  • When developers fix a bug and release a backwards-compatible version, the patch number of the version should be increased.
  • Semantic versioning is part of the PSR-2 coding standard.
  • Semantic versioning introduces conventions about breaking changes and aim to make upgrade dependencies safe.

Questão 13

Questão
Which statements about the composer.json file of a TYPO3 extension are correct? (2)
Responda
  • The property type must be set to typo3-cms-extension.
  • The property type must be set to plugin, if the extension provides a frontend plugin.
  • The extension version is required and must be set with the property version.
  • PHP classes should be auto-loaded with the appropriate namespace and path information.

Questão 14

Questão
How do you make sure that a Composer package with a specific version does not get updated when you run the composer update command? (1)
Responda
  • By adding a file DO_NOT_UPDATE to the extension directory.
  • By adding the Composer namespace of the extension to the update-lock property in the composer.json file.
  • By setting the exact version number with composer require.
  • This is not possible, because composer update always forces updates.

Questão 15

Questão
How do you install version 9.10.2 of the extension “Extension Builder” as an additional extension in an existing TYPO3 instance using Composer, assuming you have not added this package as a requirement yet? (1) Note: the Composer namespace of the extension reads “friendsoftypo3/extension-builder”.
Responda
  • composer install friendsoftypo3/extension-builder:9.10.2
  • composer install friendsoftypo3/extension-builder --version 9.10.2
  • composer require friendsoftypo3/extension-builder/9.10.2
  • composer require friendsoftypo3/extension-builder:9.10.2
  • composer require --version=9.10.2 --vendor=friendsoftypo3 extension-builder

Questão 16

Questão
What needs to be configured to auto-load PHP classes of a TYPO3 extension in a Composer-based setup? (1)
Responda
  • The PSR-4 autoload information needs to be added to the file ext_localconf.php: $GLOBALS['TYPO3_CONF_VARS']['autoload'][$_EXTKEY] = [ "psr-4" => [ "Vendor\\MyExtension\\": "Classes/" ] ];
  • The PSR-4 autoload information needs to be added to the file composer.json: "autoload": { "psr-4": { "Vendor\\MyExtension\\": "Classes/" } }
  • A configuration file autoload.yaml in the typo3conf/ directory.
  • A configuration file autoload.php in the typo3temp/ directory.

Questão 17

Questão
You want to update a Composer package that uses semantic versioning. Which version constraint do you use to get bug fixes only? (2)
Responda
  • =1.2.3
  • ^1.2.3
  • ~1.2.3
  • 1.2.*
  • =bugfix

Questão 18

Questão
You want to update a Composer package that uses semantic versioning. Which version constraint do you use if you want non-breaking updates only? (1)
Responda
  • =1.2.3
  • ^1.2.3
  • ~1.2.3
  • *1.2.3

Questão 19

Questão
Which statements about importing class names with the help of the use-statement are correct? (3)
Responda
  • They should be used in TCA files located at Configuration/TCA/.
  • They must not be used in the ext_tables.php file.
  • They must not be used in the ext_localconf.php file.
  • They can not be used for type annotations of Extbase model properties.
  • Importing class names require PHP version 7.2 at least.
  • Importing class names only work, if this feature is enabled in the Install Tool.

Questão 20

Questão
Where can you import class names with the help of the use-statement? (2)
Responda
  • In repository class definitions, when extending the class TYPO3\CMS\Extbase\Persistence\Repository.
  • In ext_localconf.php files of extensions.
  • In type annotations of Extbase controller action arguments.
  • Importing class names is not supported by TYPO3 and Extbase at all.

Questão 21

Questão
Which of the following DocBlock and inline comments are valid by convention? (2)
Responda
  • /** * @param $blog \Vendor\MyExtension\Domain\Model\Blog */
  • /** * @param \Vendor\MyExtension\Domain\Model\Blog $blog */
  • /** @var $blog \Vendor\MyExtension\Domain\Model\Blog */
  • // @var $blog \Vendor\MyExtension\Domain\Model\Blog

Semelhante

Biologia 10º ano
indialovesea
Vocabulário Inglês Básico_1
Alessandra S.
Glossário de Português
Alessandra S.
Técnico em Segurança do Trabalho
Cleber Scarduell
História da informática
Renato Costa
Curiosidades da culinária
Casa e Jardim
Introdução ao Microsoft Word
Roberto Becker
Sócrates, Platão e Aristóteles
André Matias
Hobbes, Locke e Rousseau
Ricardo l.
EMA-134 Doutrina de liderança na Marinha
Iris Gouvêa
Como criar um Mapa Mental
Alex Farias