🎨 Moyen 5 questions

QCM - Section 4: Callbacks and (Partie 8)

Quiz interactif avec 5 questions. Testez vos connaissances!

#html

Comment jouer ?

  • 1. Lisez chaque question attentivement
  • 2. Choisissez votre réponse parmi les options
  • 3. Cliquez sur "Voir la réponse" pour vérifier
  • 4. Comptez vos bonnes réponses à la fin !

Quiz: QCM - Section 4: Callbacks and (Partie 8)

5 questions | Difficulté: moyen


Question 1

What is the pattern used in the code example for creating vehicles?

  • A. Singleton Pattern
  • B. Factory Method Pattern
  • C. Prototype Pattern
  • D. Abstract Factory Pattern
Voir la réponse

Réponse correcte: D

The pattern used is the Abstract Factory Pattern.


Question 2

What will be the output of console.log(car === truck) in the code example?

  • A. true
  • B. false
  • C. undefined
  • D. null
Voir la réponse

Réponse correcte: C

The objects are created using the Abstract Factory Pattern, but they are not the same instance, so the output will be ‘false’.


Question 3

What does the code typeof InstallTrigger !== 'undefined' check for in the browser detection method?

  • A. Firefox version
  • B. Opera version
  • C. Safari version
  • D. Chrome version
Voir la réponse

Réponse correcte: B

This code checks if Firefox is being used by checking the existence of the InstallTrigger variable.


Question 4

What does the code Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 check for in the browser detection method?

  • A. Firefox version
  • B. Opera version
  • C. Safari version
  • D. Edge version
Voir la réponse

Réponse correcte: C

This code checks if the browser is Safari by looking for the presence of the ‘Constructor’ in the toString method of the HTMLElement constructor.


Question 5

What is the purpose of the !!window.chrome && !!window.chrome.webstore condition in the browser detection method?

  • A. Checking if the browser is Chrome
  • B. Checking if the browser is Firefox
  • C. Checking if the browser is Safari
  • D. Checking if the browser supports the web store feature of Chrome
Voir la réponse

Réponse correcte: D

This condition checks if the browser supports the web store feature of Chrome.