w3schools JavaScript quiz, w3schools jQuery quiz, JSON

¡Supera tus tareas y exámenes ahora con Quizwiz!

23. Look at the following selector: $(":disabled"). What does it select? All disabled input elements All hidden elements All elements containing the text "disabled" All elements that does not contain the text "disabled"

All disabled input elements

4. Look at the following selector: $("div"). What does it select? All div elements The first div element

All div elements

22. Which jQuery method is used to remove selected elements? Both methods can be used remove() detach()

Both methods can be used

5. Is jQuery a library for client scripting or server scripting? Client scripting Server scripting

Client scripting

20. Is jQuery a W3C standard? No Yes

No

Which of the following is not a valid way to parse JSON string? Select one: a. JSON.eval() b. jQuery.parseJSON() c. JSON.parse() d. eval()

a. JSON.eval()

What is the value of json in the following code? var obj = { fruit: `apple', toJSON: function () { return `orange'; } }; var json = JSON.stringify({x: obj}); Select one: a. {"x":"orange"} b. {"fruit":"orange"} c. {"x":"apple"} d. {"fruit":"apple"}

a. {"x":"orange"}

12. How does a FOR loop start? for i = 1 to 5 for (i = 0; i <= 5) for (i = 0; i <= 5; i++) for (i <= 5; i++)

for (i = 0; i <= 5; i++)

7. How do you create a function in JavaScript? function = myFunction() function myFunction() function:myFunction()

function myFunction()

10. Which jQuery method is used to hide selected elements? hidden() hide() display(none) visible(false)

hide()

1. Which of the following is correct? jQuery is a JavaScript Library jQuery is a JSON Library

jQuery is a JavaScript Library

12. Which jQuery method is used to perform an asynchronous HTTP request? jQuery.ajaxSetup() jQuery.ajaxAsync() jQuery.ajax()

jQuery.ajax()

13. What is the correct jQuery code for making all div elements 100 pixels high? $("div").height="100" $("div").height(100) $("div").yPos(100)

$("div").height(100)

25. Is JavaScript case-sensitive? No Yes

Yes

6. Is it possible to use jQuery together with AJAX? No Yes

Yes

Which statement about the space parameter in JSON.stringify() is false? Select one: a. It controls spacing in the resulting JSON string b. It is an optional parameter c. All three statements are false d. It removes whitespace

d. It removes whitespace

23. Which operator is used to assign a value to a variable? x = - *

=

19. JavaScript is the same as Java. True False

False

7. The jQuery html() method works for both HTML and XML documents True False

False

What types of values can you have in JSON key:value pairs? Select one: a. Arrays, Primitives, and Objects stored as strings b. Strings, Arrays, and Primitives c. Strings only d. Strings, Arrays, Primitives and Objects

d. Strings, Arrays, Primitives and Objects

16. Which jQuery function is used to prevent code from running, before the document is finished loading? $(document).load() $(body).onload() $(document).ready()

$(document).ready()

What kind of format is JSON, and what does the acronym mean? Select one: a. A lightweight data-interchange format. JavaScript Object Notation. b. A lightweight database framework. JavaScript Object Notation. c. A lightweight data-interchange format. Java Objective Notion. d. A lightweight data-encoding framework. Java Omnipresent Notation.

a. A lightweight data-interchange format. JavaScript Object Notation.

Which is true about JSON namespacing? Select one: a. JSON doesn't have namespaces. Though every object is inherently a namespace. b. JSON namespaces can be accessed after parsing data. c. JSON namespaces can be accessed immediately after receiving data.

a. JSON doesn't have namespaces. Though every object is inherently a namespace.

Which of the following control characters cannot be used when writing a JSON string without escaping? Select one: a. / or { b. " or \ c. ; or : d. &lt; or &gt;

b. " or \

True or false? A disadvantage of JSON is that it requires the use of JavaScript. Select one: a. True, though JavaScript is readily available in today's browsers. b. False, JSON is language independent. c. False, JavaScript must be available although it is not necessary to use. d. True, though all browsers have JavaScript enabled.

b. False, JSON is language independent.

What is a JSONStringer used for? Select one: a. It is used to create number strings in JSON. b. It is used to quickly create JSON text. c. It is used to create JSON ordered pairs. d. It quickly converts JSON to Java strings.

b. It is used to quickly create JSON text.

Which of these is a benefit JSON has over XML? Select one: a. JSON is more forgiving of poor formatting b. JSON has less markup requirements and therefore is lighter than XML c. JSON does not need to be stored in a file to be sent remotely d. JSON can be written poorly and still be parsed

b. JSON has less markup requirements and therefore is lighter than XML

In what situation would you want to use XML over JSON? Select one: a. When JSON is not offered. b. You need message validation or you're using XSLT. c. Never, JSON is worlds better. d. When you need to use tags to structure your content.

b. You need message validation or you're using XSLT.

How does JSON handle numeric values that cannot be represented by a sequence of digits (like Infiniti and Nan)? Select one: a. They are stored as strings and then converted when parsed. b. They are stored fine but it's the parsers job to convert them to numeric values. c. They are not permitted.

c. They are not permitted.

Can you use a double quote inside a JSON string? Select one: a. No, you should use single quotes b. Yes, if you use the ascii code. c. Yes, if it is escaped like ( \" ) d. Yes, you can use it without any special treatment

c. Yes, if it is escaped like ( \" )

What is the value of json in the following code? var cars = []; cars[0] = `Ford'; cars[1] = `Toyota'; cars[2] = `BMW'; var json = JSON.stringify({x: cars}); Select one: a. {"x":{"Ford","Toyota","BMW"}} b. {"cars":["Ford","Toyota","BMW"]} c. {"x":["Ford","Toyota","BMW"]} d. {"x":[`Ford','Toyota','BMW']}

c. {"x":["Ford","Toyota","BMW"]}

Which statement about the replacer parameter in JSON.stringify() is true? Select one: a. If null or omitted, all properties of the object are included in the resulting JSON string b. If an array, specifies the names of the properties in the object to include in the resulting JSON string c. If a function, transforms values and properties encountered while stringifying d. All three statements are true

d. All three statements are true

Which statement about the reviver parameter in JSON.parse() is true? Select one: a. A function that will be called for every key and value at every level of the final result b. Used to reform generic objects into instances of pseudo-classes c. Each value will be replaced by the result of the reviver function d. All three statements are true

d. All three statements are true

What function will convert a JavaScript object to a JSON string? Select one: a. JSON.text() b. JSON.toString() c. JSON.serialize() d. JSON.stringify()

d. JSON.stringify()

Which of these is supported as a JSON Value type? Select one: a. Infiniti b. NaN c. Undefined d. Null

d. Null

3. Where is the correct place to insert a JavaScript? The <body> section Both the <head> section and the <body> section are correct The <head> section

Both the <head> section and the <body> section are correct

14. How to insert a comment that has more than one line? /*This comment has more than one line*/ //This comment has more than one line// <!--This comment has more than one line-->

/*This comment has more than one line*/

13. How can you add a comment in a JavaScript? 'This is a comment <!--This is a comment--> //This is a comment

//This is a comment

True of False. The order of JSON objects is always preserved. Select one: a. False b. True

a. False

9. How to write an IF statement in JavaScript? if (i == 5) if i == 5 then if i = 5 if i = 5 then

if (i == 5)

18. What is the correct JavaScript syntax for opening a new window called "w2" ? w2 = window.open("http://www.w3schools.com"); w2 = window.new("http://www.w3schools.com");

w2 = window.open("http://www.w3schools.com");

6. How do you write "Hello World" in an alert box? alertBox("Hello World"); alert("Hello World"); msgBox("Hello World"); msg("Hello World");

alert("Hello World");

In modern websites what is the common usage for JSON? Select one: a. To store information locally. b. To store information remotely. c. To send and receive bits of data.

c. To send and receive bits of data.

3. Which sign does jQuery use as a shortcut for jQuery? the % sign the ? Sign the $ sign

the $ sign

18. Which jQuery method is used to switch between adding/removing one or more classes (for CSS) from selected elements? switch() switchClass() altClass() toggleClass()

toggleClass()

24. What will the following code return: Boolean(10 > 9) true false NaN

true

5. The external JavaScript file must contain the <script> tag. False True

False

11. How does a WHILE loop start? while (i <= 10; i++) while (i <= 10) while i = 1 to 10

while (i <= 10)

8. What is the correct jQuery code to set the background color of all p elements to red? $("p").style("background-color","red"); $("p").layout("background-color","red"); $("p").manipulate("background-color","red"); $("p").css("background-color","red");

$("p").css("background-color","red");

11. Which jQuery method is used to set one or more style properties for selected elements? html() css() style()

css()

22. How do you declare a JavaScript variable? var carName; v carName; variable carName;

var carName;

15. What scripting language is jQuery written in? C# VBScript C++ JavaScript

JavaScript

2. jQuery uses CSS selectors to select elements? True False

True

4. What is the correct syntax for referring to an external script called "xxx.js"? <script name="xxx.js"> <script src="xxx.js"> <script href="xxx.js">

<script src="xxx.js">

1. Inside which HTML element do we put the JavaScript? <scripting> <script> <js> <javascript>

<script>

9. With jQuery, look at the following selector: $("div.intro"). What does it select? All div elements with class="intro" The first div element with id="intro" All div elements with id="intro" The first div element with class="intro"

All div elements with class="intro"

19. Look at the following selector: $("div p"). What does it select? The first p element inside a div element All p elements inside a div element All div elements with a p element

All p elements inside a div element

17. How do you find the number with the highest value of x and y? ceil(x, y) Math.max(x, y) Math.ceil(x, y) top(x, y)

Math.max(x, y)

16. How do you round the number 7.25, to the nearest integer? rnd(7.25) Math.rnd(7.25) Math.round(7.25) round(7.25)

Math.round(7.25)

25. The jQuery animate() method can be used to animate ANY CSS property? All properties except the shorthand properties Yes Only properties containing numeric values

Only properties containing numeric values

21. Look at the following selector: $("p#intro"). What does it select? The p element with id="intro" All p elements with class="intro"

The p element with id="intro"

14. Which statement is true? To use jQuery, you can refer to a hosted jQuery library at Google To use jQuery, you do not have to do anything. Most browsers (Internet Explorer, Chrome, Firefox and Opera) have the jQuery library built in the browser To use jQuery, you must buy the jQuery library at www.jquery.com

To use jQuery, you can refer to a hosted jQuery library at Google

2. What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo">This is a demonstration.</p> document.getElement("p").innerHTML = "Hello World!"; #demo.innerHTML = "Hello World!"; document.getElementByName("p").innerHTML = "Hello World!"; document.getElementById("demo").innerHTML = "Hello World!";

document.getElementById("demo").innerHTML = "Hello World!";

10. How to write an IF statement for executing some code if "i" is NOT equal to 5? if (i != 5) if (i <> 5) if i =! 5 then if i <> 5

if (i != 5)

8. How do you call a function named "myFunction"? myFunction() call function myFunction() call myFunction()

myFunction()

20. How can you detect the client's browser name? client.navName navigator.appName browser.name

navigator.appName

17. Which jQuery method should be used to deal with name conflicts? nameConflict() noNameConflict() conflict() noConflict()

noConflict()

21. Which event occurs when the user clicks on an HTML element? onclick onmouseover onmouseclick onchange

onclick

24. Which jQuery method returns the direct parent element of the selected element? parent() ancestors() parents() ancestor()

parent()

15. What is the correct way to write a JavaScript array? var colors = (1:"red", 2:"green", 3:"blue") var colors = "red", "green", "blue" var colors = ["red", "green", "blue"] var colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")

var colors = ["red", "green", "blue"]


Conjuntos de estudio relacionados

Ch6. Perception and Individual Decision Making

View Set

online class social media midterm

View Set

Quiz 2 - Skeletal Muscle Function

View Set

Intro to Computers Ch. 1 and Ch. 2

View Set

The Court of Justice of the European Union

View Set

Chapter 19 Study Guide- Anatomy 2

View Set

Penny Review: Chap 17 Uterus & Vagina

View Set

Practice Test for NBCOT (TMPOT version)

View Set