Skip to main content

Fundamentals of Front End Development MCQs with Answers

Practice important Fundamentals of Front End Development MCQs with answers and explanations.

Chapter: 97
Q1081:
Which jQuery syntax hides all <p> elements?
A. $("p").hide()
B. $("#p").hide()
C. $(".p").hide()
D. $(p).hide()
Correct Answer: A
Chapter: 97
Q1082:
What is the purpose of the $(document).ready(function(){...}); syntax?
A. To define CSS styles
B. To execute code before the document loads
C. To perform actions after the document loads
D. To initialize jQuery methods
Correct Answer: C
Chapter: 97
Q1083:
What does the jQuery selector $("#test") target?
A. All elements with class "test"
B. All <p> elements
C. The element with id "test"
D. All elements with id "test"
Correct Answer: C
Chapter: 97
Q1084:
How can you shorten $(document).ready(function(){...});?
A. $(document).load(function(){...});
B. $(document).init(function(){...});
C. $(function(){...});
D. $(ready(){...});
Correct Answer: C
Chapter: 97
Q1085:
jQuery methods should be placed inside the $(document).ready() to ensure what?
A. The code runs before the document loads
B. The code runs when the document is partially loaded
C. The code runs after the document is fully loaded
D. The code does not run at all
Correct Answer: C
Chapter: 97
Q1086:
To select an element with an id of "example", the jQuery syntax is _______.
A. $("example")
B. $(".example")
C. $("#example")
D. $(example)
Correct Answer: C
Chapter: 97
Q1087:
The jQuery method hide() is used to _______ an element.
A. Show
B. Hide
C. Create
D. Update
Correct Answer: B
Chapter: 98
Q1088:
What does the jQuery selector $("p") do?
A. Selects all <p> elements
B. Selects the first <p> element
C. Selects all elements with class "p"
D. Selects the element with id "p"
Correct Answer: A
Chapter: 98
Q1089:
How would you select an element with id test using jQuery?
A. $(".test")
B. $("#test")
C. $("test")
D. $(#test)
Correct Answer: B
Chapter: 98
Q1090:
What is the purpose of the $("button").click(function(){ $("#test").hide(); }); code?
A. Hides all <button> elements
B. Hides the element with id test when a button is clicked
C. Hides all <button> elements when clicked
D. Shows the element with id test
Correct Answer: B
Chapter: 98
Q1091:
Which selector finds elements with a specific class in jQuery?
A. $("p")
B. $("#test")
C. $(".test")
D. $("*")
Correct Answer: C
Chapter: 98
Q1092:
Fill in the blank: To select all elements with class intro, the jQuery syntax is _______.
A. $("intro")
B. $("#intro")
C. $("p.intro")
D. $(".intro")
Correct Answer: D
Chapter: 98
Q1093:
Fill in the blank: To include jQuery functions from a separate file, you use _______.
A. <script src="my_jquery_functions.js"></script>
B. <script href="my_jquery_functions.js"></script>
C. <link src="my_jquery_functions.js">
D. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
Correct Answer: A
Chapter: 98
Q1094:
Which jQuery syntax selects all elements on a page?
A. $("p")
B. $("#test")
C. $(".test")
D. $("*")
Correct Answer: D
Chapter: 98
Q1095:
Fill in the blank: To select the first <p> element on a page, the jQuery selector is _______.
A. $("p:first")
B. $("p:last")
C. $("p:only")
D. $("first:p")
Correct Answer: A
Chapter: 98
Q1096:
What does $("ul li:first-child") select?
A. The first <li> element of every <ul>
B. The first <li> element of the first <ul>
C. The last <li> element of every <ul>
D. The last <li> element of the first <ul>
Correct Answer: A
Chapter: 98
Q1097:
Fill in the blank: To ensure jQuery code runs after the document is fully loaded, wrap it in _______.
A. $(document).ready(function() { ... });
B. $(document).load(function() { ... });
C. $(document).execute(function() { ... });
D. $(document).init(function() { ... });
Correct Answer: A
Chapter: 98
Q1098:
What does $(this).hide() do in jQuery?
A. Hides the current HTML element
B. Hides all elements
C. Hides the first element
D. Hides the element with id "this"
Correct Answer: A
Chapter: 98
Q1099:
Fill in the blank: To select all elements using jQuery, you use the syntax _______.
A. $("*")
B. $("#*")
C. $("")
D. $(".")
Correct Answer: A
Chapter: 99
Q1100:
What does the jQuery syntax $("p").click() do?
A. Selects all <p> elements
B. Assigns a click event to all <p> elements
C. Hides all <p> elements
D. Displays all <p> elements
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now