Q1
Q1 What does the $ symbol represent in jQuery?
$ represents a library function
$ is an alias for jQuery
$ is a variable
$ is an operator
Q2
Q2 Which jQuery method is used to document-ready event?
.onDocumentReady()
.ready()
.load()
.documentReady()
Q3
Q3 What is jQuery primarily used for?
CSS manipulation
Server-side operations
HTML document manipulation
Networking
Q4
Q4 Is jQuery a library for client-side or server-side scripting?
Client-side
Server-side
Both
None
Q5
Q5 How can jQuery be added to a web page?
Link to a local copy
Link to a CDN
Both
Neither
Q6
Q6 Which jQuery function is used to select elements by tag name?
.getElement()
.select()
.$()
.query()
Q7
Q7 What type of files can be manipulated using jQuery?
HTML only
CSS only
JavaScript only
HTML, CSS, and JavaScript
Q8
Q8 Which jQuery method is used to set the text content of an element?
.setText()
.text()
.textContent()
.setContent()
Q9
Q9 A jQuery selector doesn't return any elements. What could be the most likely cause?
Incorrect selector syntax
Elements do not exist
jQuery not loaded
Script error
Q10
Q10 How do you select all elements within a using jQuery?
$('div p')
$('div > p')
$('div + p')
$('div, p')
Q11
Q11 Which selector is used to find elements with a specific class in jQuery?
.findClass()
.class()
.$()
$('.className')
Q12
Q12 How do you select an element with an ID of "unique" using jQuery?
$('#unique')
.getId('unique')
.$('unique')
.querySelector('#unique')
Q13
Q13 Which jQuery method is used to select elements that are hidden?
.hidden()
.findHidden()
.is(':hidden')
$(':hidden')
Q14
Q14 What is the result of the selector $('div:first')?
Selects the first div in the document
Selects the first div in each section
Selects the first child div
Selects none of the above
Q15
Q15 How can you select elements with an attribute value starting with "https" in jQuery?
$('[href^="https"]')
$('[href*="https"]')
$('[href$="https"]')
$('a[href^="https"]')
Q16
Q16 How do you select all input elements of type checkbox that are checked?
$('input[type="checkbox"]:checked')
$('checkbox:checked')
$('input:checked')
$('input[type=checkbox]')
Q17
Q17 What does the selector $('li:odd') select?
Every odd li element
Every even li element
All li elements
No li elements
Q18
Q18 How would you hide all elements with the class "hide-me" using jQuery?
.hideClass('hide-me')
$('.hide-me').hide()
hide('.hide-me')
$('.hide-me').remove()
Q19
Q19 Which jQuery method removes the selected element from the DOM?
.delete()
.detach()
.remove()
.erase()
Q20
Q20 How can you add a new class to selected elements in jQuery?
.addClass('newClass')
.newClass('newClass')
.setClass('newClass')
.toggleClass('newClass')
Q21
Q21 What jQuery method is used to get the value of an attribute for the first element in the set of matched elements?
.getAttr('attribute')
.attribute('attribute')
.attr('attribute')
.value('attribute')
Q22
Q22 Why might $('.class').hide() not work if the class is correctly specified?
Incorrect jQuery version
Syntax error in code
Class does not exist at runtime
jQuery not loaded
Q23
Q23 What could cause the selector $('#id') to return more than one element?
Invalid HTML structure
Multiple elements with the same ID
jQuery bug
None of these
Q24
Q24 If $('input').val() returns undefined, what might be the reason?
No input elements are present
Input is not of type text
Input has no value
Multiple inputs are present
Q25
Q25 What jQuery method is used to bind a click event to a button?
.onClick()
.click()
.buttonClick()
.triggerClick()
Q26
Q26 How do you attach an event handler to elements that may be added dynamically in jQuery?
.bind()
.on()
.live()
.delegate()
Q27
Q27 Which method stops the default action of an event?
.stop()
.preventDefault()
.halt()
.stopAction()
Q28
Q28 How do you remove an event handler in jQuery?
.unbind()
.detachEvent()
.removeEvent()
.off()
Q29
Q29 What method would you use to trigger an event handler of 'submit' event programmatically?
.trigger('submit')
.invoke('submit')
.call('submit')
.execute('submit')
Q30
Q30 What does the .stopPropagation() method do?
Stops the event from bubbling up the event chain
Stops all functions
Prevents default actions
None of the above