Cairo University Faculty of Engineering Computer Engineering Department WEB BUILDING 1 Browser Scripting JavaScript Quiz
15 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary purpose of JavaScript in web development?

  • Styling HTML pages
  • Creating database queries
  • Adding interactivity to HTML pages (correct)
  • Optimizing server performance

Where is JavaScript usually embedded in web development?

  • Directly into HTML pages (correct)
  • In external CSS files
  • In the database
  • In the server-side code

What does it mean for JavaScript to be an interpreted language?

  • Scripts interact with the database directly
  • Scripts are compiled before execution
  • Scripts execute only on the server-side
  • Scripts execute without preliminary compilation (correct)

Where are scripts placed if they are to be executed when called or when an event is triggered?

<p>Inside functions (A)</p> Signup and view all the answers

What is the purpose of including functions in the head section of an HTML page?

<p>To keep all functions in one place without interfering with page content (D)</p> Signup and view all the answers

When should a script be placed inside a function?

<p>When the script should be executed when called or when an event is triggered (C)</p> Signup and view all the answers

What is the purpose of saving JavaScript in an external file?

<p>To avoid rewriting the same script on every page (C)</p> Signup and view all the answers

Which of the following best describes JavaScript objects?

<p>Objects have properties and methods (D)</p> Signup and view all the answers

What is the correct way to access an Array object in JavaScript?

<p>myCars = ['Saab', 'Volvo', 'BMW']; (A)</p> Signup and view all the answers

How would you instantiate a date to be 5 days into the future in JavaScript?

<p>myDate2.setDate(myDate.getDate() + 5); (B)</p> Signup and view all the answers

What is the purpose of creating an instance of an object in JavaScript?

<p>To add properties to the object (B)</p> Signup and view all the answers

Which built-in object in JavaScript represents a string?

<p><strong>JS String</strong> (A)</p> Signup and view all the answers

What does the Array method concat() do in JavaScript?

<p><strong>Combines two or more arrays</strong> into a new array (C)</p> Signup and view all the answers

What does the method toUpperCase() do in JavaScript?

<p><strong>Returns a string converted to uppercase</strong> (B)</p> Signup and view all the answers

How would you set a Date object to a specific date in JavaScript?

<p><strong>myDate1.setFullYear(2010, 0, 14)</strong>; (B)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser