frontend development using react coursera week 2 quiz answers

Javascript - Practice Quiz

1. What is the purpose of the "name" attribute in an HTML form input element?

  • To specify the label for the input field.
  • To define the type of input field.
  • To provide a unique identifier for the input field.
  • To set a default value for the input field.

2. Which of the following are valid arithmetic operators in JavaScript?

  • +
  • *
  • All of the above

3. Which of the following is a conditional statement in JavaScript?

  • for loop
  • if/else statement
  • Both A and D
  • while loop

4. Which of the following are looping structures in JavaScript?

  • if/else statement
  • switch statement
  • for loop
  • while loop

DOM - Practice Quiz

5. What is the Document Object Model (DOM) in JavaScript?

  • A data type used to store documents
  • A programming language used to create documents
  • A programming interface for web documents
  • A file format used to store documents

6. How can you access and manipulate DOM elements with JavaScript?

  • By using CSS to modify DOM elements
  • By using JavaScript methods and properties
  • By using HTML to modify DOM elements
  • By using a server-side programming language to modify DOM elements

7. What are events and event listeners in JavaScript?

  • JavaScript functions used to create animations
  • HTML tags used to define web page structure
  • Actions or occurrences that happen in the browser, and event listeners are functions that respond to those actions or occurrences
  • JavaScript methods used to modify DOM elements

8. How can you respond to user input, such as clicks and key presses, with JavaScript?

  • By using HTML tags to define web page structure
  • By using CSS to style web page elements
  • By using event listeners in JavaScript
  • By using JavaScript methods to modify DOM elements

9. What is the purpose of creating interactive user interfaces with events in JavaScript?

  • To modify DOM elements with CSS
  • To define the structure of web pages with HTML
  • To allow users to interact with web pages and provide dynamic functionality
  • To modify JavaScript data types and variables

Leave a Reply