Вы находитесь на странице: 1из 30

- Client 

1. jQuery is - Server
a).Light weight b).Interpreter compiled - Both a and b
c).parallelly processed d).Runs in js shell - None of these

63. Minified and compressed version of 10. To deal with cookies in jQuery we have to use
jQuery is usually used as ______ cookie plugin
a).Development version b).Production version - Dough
c).Beta Version d).Alpha version - Session
- Dazzler
1. request? - None of these

2. How many types of selectors available in jquery. 11. $('#pcds').attr('disabled', true); these code is
- One used for the ______ form element.
- Two - enable
- Three - disable
- Four
12. For the purposes of selecting specific class, class
3. Is it compulsory to add jquery file both at master must contain prefix as “__“.
page and content page? -$
- Yes -#
- No -.
-%
4. ________________ is use for alternately expand
and collapse a page element 13. In which version of the jquery, efficiency of the
- .hover() web page increased.
- stopPropagation() - minified version
- .toggle() - normal version
- .trigger()
14. The .each method is the more convenient form
5. CDN stands for_______ of _______ loop.
- Content Distribution Network - do while
- Common Distribution Network - for
- Collective Distribution Network - for each
- None of these - None of these

6. “ Jquery is faster than javascript at execution 15. ”Jquery is the programming language”
time.” - Yes
- True - No
- False
16. Which of the following is jquery primary method
7. jquery has _______ method for inserting element for wrapping element around other element.
before other element. - .hover()
- One - .wrapall()
- Two - .wrap()
- Three - .each()
- Four
17. ”JQuery don’t have DOM traversing capability.”
8. jquery html() method works for _______ - True
- HTML - False
- XML
- HTML and XML 18. jquery written in which scripting language?
- None of these - java script
- VBscript
9. Jquery is a library for _______ scripting.
Thursday, August 20, 2020 Page |1
- HTML - 178KB
- None of these - 76.7 KB

19. How many methods are available in jquery to


give fade effect to the elements. 1) jQuery is a 
- One a). JavaScript Library. b).JavaScript Language
- Two c).JavaScript Method d). PHP Method
- Three Ans: a
- Four
2. jQuery uses CSS selectors to select elements?
20. Using ________ function, we can hold or release A. False
the execution of jQuery’s ready event. B. True
- jQuery.holdReady() Ans:B
- jQuery.ready()
- jQuery.hold() 3. Which sign does jQuery use as a shortcut for
- jQuery.holdready() jQuery?
A. the % sign
21. Use __________ event handlers to reach to a B. the ? Sign
user click on page element with .bind() or .click(). C. the $ sign
- mouse Ans: C
- windows
- click 4. With jQuery, look at the following selector: $
- None of these ("div"). What does it select?
A. All div elements
22. jQuery ______is used to set/return arbitrary data B. The first div element
to/from an element. Ans: A
- .data()  
- .item() 5. Is jQuery a library for client scripting or server
- .all scripting?
- All of these A. Server scripting
B. Client scripting
23. Which of the following method is used to hide
the selected elements?
- visible(false)  6. Is it possible to use jQuery together with AJAX?
- hidden() A. No
- display(none)  B. Yes
- hide() Ans:B

24. AJAX stand for____________ 7. The jQuery html() method works for both HTML
and XML documents
- Asynchronous java script and XML A. False
- Alternate java script and XML B. True
- All time java and XML Ans:A
- None of these
25. There are how many ways to check or unchecked 8. What is the correct jQuery code to set the
the radio button. background color of all p elements to red?
- One A. $("p").layout("background-color","red");
- Two B. $("p").manipulate("background-color","red");
- Three C. $("p").css("background-color","red");
- Four D. $("p").style("background-color","red");
Ans:C
26. What is the file size of minified version of
jQuery.x.x.x-min.js?

Thursday, August 20, 2020 Page |2


9. With jQuery, look at the following selector: $ 16. Which jQuery function is used to prevent code
("div.intro"). What does it select? from running, before the document is finished
A. The first div element with class="intro" loading?
B. The first div element with id="intro" A. $(document).load()
C. All div elements with class="intro" B. $(document).ready()
D. All div elements with id="intro" C. $(body).onload()
Ans:C  Ans:C

10. Which jQuery method is used to hide selected 17. Which jQuery method should be used to deal with
elements? name conflicts?
A. hidden() A. noNameConflict()
B. hide() B. noConflict()
C. visible(false) C. nameConflict()
D. display(none) D. conflict()
Ans:B

11. Which jQuery method is used to set one or more 18. Which jQuery method is used to switch between
style properties for selected elements? adding/removing one or more classes (for CSS) from
A. css() selected elements?
B. html() A. toggleClass()
C. style() B. switch()
 Ans:A C. altClass()
D. switchClass()
12. Which jQuery method is used to perform an
asynchronous HTTP request?
A. jQuery.ajaxAsync() 19. Look at the following jQuery selector: $
B. jQuery.ajax() ("div#intro .head"). What does it select?
C. jQuery.ajaxSetup() A. The first element with id="head" inside any div
   Ans:B element with class="intro"
B. All elements with class="head" inside the first div
13. What is the correct jQuery code for making all div element with id="intro"
elements 100 pixels high? C. All div elements with id="intro" or class="head"
A. $("div").height="100" Ans:C
B. $("div").height(100)
C. $("div").yPos(100) 20. Is jQuery a W3C standard?
Ans:C A. No
B. Yes
14. Which statement is true?   Ans: B
A. To use jQuery, you must buy the jQuery library at
www.jquery.com 21. Which statement best explains what "unobtrusive
B. To use jQuery, you do not have to do anything. JavaScript" is?
Most browsers (Internet Explorer, Chrome, Firefox A. JavaScript that doesn't annoy users
and Opera) have the jQuery library built in the B. JavaScript that is separate from HTML
browser C. JavaScript that does not affect a web page
C. To use jQuery, you can refer to a hosted jQuery D. JavaScript that works even with scripting turned off
library at Google Ans: B
22. Which of these is NOT a valid comment in
JavaScript?
15. What scripting language is jQuery written in? A. // This is a comment
A. VBScript B. /* This is a comment. */
B. JavaScript C. /* This is a comment
C. C# D. .<!-- This is a comment.
D. C++ Ans: C
Ans: B 23. How do you use JavaScript within CoffeeScript
code?
Thursday, August 20, 2020 Page |3
A. Use the JavaScript keyword
B. Wrap the code in <script> tags 31. $(document).ready(function() {
C. Wrap the code in backticks or grave accents [`] // Some code.
D. You can't embed JavaScript code within });
CoffeeScript The above code is used to..
Ans: C A. Make sure no code is executed till the entire page is
24. In JavaScript, we can keep a reference to the fully loaded
context outside a function by assigning it to a variable: B. Make sure no code is executed till the DOM is fully
var self = this. In CoffeeScript, we use: loaded
C. Both A and B
A. self = this printScope -> console.log self D. Neither A nor B
B. printScope => console.log @ Ans: B
C. printScope => console.log this
D. All of the above 32. Can you can use CSS3 selectors to select or find
Ans: D elements using jQuery?
25. What is the correct JavaScript syntax to write A. Yes
"Hello World"? B. No
A. document.write("Hello World") Ans: A
B. ("Hello World")
C. response.write("Hello World") 33. You can test whether the browser supports
D. "Hello World" specific features using...
Ans: A A. $.support
B. $.browser
26. jQuery is a... C. $.featureTest
A. JavaScript library D. $.browserTest
B. Ruby Gem Ans: A
C. PHP Framework
D. None of the above 34. Multiple document.ready blocks can be placed in a
Ans: A page without detriments. This statement is..
27. jQuery's main focus is.. A. True
A. AJAX B. False
B. DOM Manipulation Ans: A
C. Animations
D. All of the above 35. Query.noConflict(true) is used to..
Ans: D A. Free up the $ symbol for use by other libraries
28. $.foo() is equivalent to.. B. Improve compatibility
A. javascript.foo() C. Remove all jQuery variables from the global scope
B. document.foo() D. All of the above
C. jQuery.foo() Ans: D
D. None of the above
Ans: C 36. $('p').click(function(){
// Code here
29. Can jQuery be used on the same page alongside });
other libraries? Inside the commented section, the value of the
A. Yes variable this is a..
B. No A. Array
Ans: A B. String
C. Reference to the DOM node
30. var ps = $("p"); D. jQuery object
ps will be.. Ans: C
A. A linked list
B. A hash or dictionary 37. The method that provides AJAX functionality
C. An array within jQuery is named..
D. A jQuery object A. ajax
Ans: D B. easyAJAX
Thursday, August 20, 2020 Page |4
C. jQueryajax a) $.get(url,data,callback,type)
D. jQajax b) $.ajax(options)
Ans: A c) $.post(url,data,callback,type)
38. The CSS selector engine that jQuery uses is called? d) $.getScript(url,callback)
A. Badaboom Ans: A
B. Mango
C. Sizzle 45) Triggers, or binds a function to the error event of
D. AwesomeX selected elements.
Ans: C a) click()
b) error()
39. You can attach a handler to an event using which c) event.pageX
method? d) click.error()
A. eventBind Ans: B
B. bind
C. attach 46. What are the :odd and :even filters?
D. eventAttach a) They allow you to determine if a number is odd or
Ans: B even.
b) They  allow you to determine if a specific element is
40. $('#masterList').find('li') in an odd or even position.
.width(500).addClass('selected'); c) None of the above.
The phenomena occuring in the above code is called? Ans: B
A. Chaining 47. When referencing an HTML element preceded by
B. Event bubbling a # (pound or hash), what javascript function is this
C. AJAX equivalent to?
D. Animating a) getElementById
Ans: A b) getElementByClassName
c) getElementByTagName
41.  What is jQuery? d) None of the above
a) jQuery is a library of JavaScript Functions. Ans: A
b) jQuery stands for Structured Query Language
c) jQuery stands for Cascading Style Sheets. 48. When referencing an HTML element preceded by
d) jQuery communication between computers on the a . (dot), what javascript function is this equivalent to?
Internet. a) getElementById
Ans: A b) getElementByClassName
42) The jQuery library contains the following features c) getElementByTagName
a)  HTML element selections. HTML element d) None of the above
manipulation .HTML event functions Ans: D
b)  CSS manipulation. JavaScript Effects and
animations. HTML DOM traversal and modification 49. What is the each function used for?
c)  JavaScript Effects and animations. HTML DOM a) The Each function allows you to loop though every
traversal and modification. AJAX. Utilities element in a parent element.
d)  all of the above b) The Each function allows you to put the word
Ans:D "Each" into each element
43) AJAX and jQuery c) The Each function allows you to loop through
a) jQuery provides a rich set of methods (functions) different elements with a class or ID.
for AJAX web development. d) None of the above.
b) With jQuery AJAX, you can request TXT, HTML, XML Ans: C
or JSON data from a remote server using both HTTP
Get and HTTP Post. 50. What is the difference between Hover and
c) a and b Mouseover
d) AJAX and jQuery are cross-platform (you can a) Mouseover allows you to specify an optional
develop in Windows and serve on a Unix platform) function to use for the mouseout event
Ans: C b) Hover allows you to specify an optional function to
use for the mouseout event
44) Load remote data using HTTP GET c) No Difference; Mouseover and Hover are the same
Thursday, August 20, 2020 Page |5
Ans: B b) stop() ends any currently running animations on
the element, and prevents conflicts and pile-ups.
51. What are the various speed options? c) We tell jQuery that the animation has to be
a) The words "slow" and "fast" as well as integers for stopped at some point.
the milliseconds Ans: B
b) Only the words "slow", "fast", and "medium"
c) All of the above 58. What is the difference between .width() and
d) None of the above .outerWidth()?
Ans: A a) The methods are basically the same. The only
difference is that .width() returns a number, whereas
52. The speed options can be applied to which outerWidth() a string.
jQuery functions? b) width() returns the computed width of the
a) css and ajax element, while outerWidth() returns the width plus all
b) show and fadeIn the margins and paddings.
c) toggleCss c) No difference. width() is a shorthand alias for
d) All of the above outerWidth()
Ans: B Ans: B

53. If you want to stop your jQuery for a few 59. How do you fetch the first span on the page,
milliseconds, which function do you use? which has the class ‘green’?
a) stop() a) $('span, .green, :first')
b) pause() b) $('first .green span')
c) slowdown() c) $('span.green:first')
d) delay() Ans: C

60. What does the $('#myDiv').hover() method do?


54. Which function do you reference in HTML form a) It binds the functions you pass as parameters, to
data? the mouseenter and mouseleave events.
a) value() b) Converts the element upon which it was called, into
b) formData() a hoverable menu.
c) val()
d) None of the above Ans: A
Ans: C
61. Which of the following is correct?
A. jQuery is a JavaScript Library
55. When do you use the $(this) code? B. jQuery is a JSON Library
a) When an HTML element will reference its own Ans: A
action.
b) When an HTML element will reference its parent
element's action 62).jQuery is
c) When an HTML element will reference the entire a).Light weight b).Interpreter compiled c).parallelly
document processed d).Runs in js shell
d) None of the above.
Ans: A
63).jQuery does not support which of the following
56. What does the function $(“.selector”) return? a).HTML/DOM Manipulation b).HTML events c).AJAX
a) An array. d).PHP Bytecode
b) A node list.
c) A new jQuery object. 64).Minified and compressed version of jQuery is
Ans: C usually used as
a).Development version b).Production version c).Beta
57.  Why do we usually add the stop() method before Version d).Alpha version
calling animate()?
a) stop() halts the execution of the scripts on the page 65).$(selector).action() – What does this jquery
until the animation has finished. syntax format do?
Thursday, August 20, 2020 Page |6
a).Select an HTML element and then use HTML to act Submit, Focus,Change etc are examples of what type
on it of events?
b).Select an HTML element and perform some actin 75).Explain the syntax for hiding a paragraph element.
on it 76).$(“#div_alpha”).fadeIn(1000); what does this
c).Perform an action on an element and then select it mean?
d).Perform selection and ignore the action 77).Give the jQuery method name to create custom
animations.
66).What does the dollar sign in jQuery statement 78).text() – Sets or returns the text content of
do? selected elements – Is this true?
a).It loads the jQuery methods b).It loads the DOM 79).$(“#div_beta”).html(“Hello“); What is the error in
c).It loads PHP d).It is used to define or access jQuery this piece of code?
80).$(“p”).append(“append me at the end.”); What is
67).Here is a jquery code: the output of this jQuery?
$(document).ready(function(){});
Why do we place all jQuery methods inside this 1. Which of the following is correct?
code?
a).Because jQuery is never compiled b).It shows jQuery is a JavaScript Library
where jQuery starts and ends jQuery is a JSON Library
c).To enable the DOM to load jQuery d).To prevent 2. jQuery uses CSS selectors to select elements?
jQuery code from running before the document is
fully loaded False
True
68).$(function(){});
What does this piece of jQuery do? 3. Which sign does jQuery use as a shortcut for
a).This is a shorter version for $ jQuery?
(document).ready(function(){});
b).This is to test if jQuery can be loaded again the $ sign
c).This is to test if jQuery has completed execution
the ? Sign
d).This is to create a method in jQuery
the % sign
69).$(‘#temp’).action() 4. Look at the following selector: $("div"). What does
What type of selector is used in the above jQuery it select?
syntax?
All div elements
a).id selector
b).class selector The first div element
c).name selector 5. Is jQuery a library for client scripting or server
d).value selector scripting?

70).Which of the following jQuery syntax uses the Client scripting


class selector Server scripting
a).$(‘#temp’) b).$(‘.temp’) c).$(‘class’) d).$ 6. Is it possible to use jQuery together with AJAX?
(‘temp’).class
Yes
No
7. The jQuery html() method works for both HTML
and XML documents
Important JQuery Questions that can be asked in Top
Companies :- False
True
71).Give the syntax for selecting the current HTML 8. What is the correct jQuery code to set the
element. background color of all p elements to red?
72).How do we select odd tr elements.
73).How do we write a click event that gets fired on a $("p").css("background-color","red");
paragraph element.
$("p").style("background-color","red");
74).We have mouse events, key board events etc. So
Thursday, August 20, 2020 Page |7
$("p").layout("background-color","red"); C++
$("p").manipulate("background-color","red"); VBScript
9. With jQuery, look at the following selector: $ 16. Which jQuery function is used to prevent code
("div.intro"). What does it select? from running, before the document is finished
loading?
The first div element with class="intro"
$(body).onload()
The first div element with id="intro"
$(document).load()
All div elements with id="intro"
$(document).ready()
All div elements with class="intro"
17. Which jQuery method should be used to deal with
10. Which jQuery method is used to hide selected
name conflicts?
elements?
noNameConflict()
hidden()
nameConflict()
visible(false)
conflict()
hide()
noConflict()
display(none)
18. Which jQuery method is used to switch between
11. Which jQuery method is used to set one or more
adding/removing one or more classes (for CSS) from
style properties for selected elements?
selected elements?
css()
altClass()
style()
switchClass()
html()
toggleClass()
12. Which jQuery method is used to perform an
asynchronous HTTP request? switch()
19. Look at the following selector: $("div p"). What
jQuery.ajaxSetup()
does it select?
jQuery.ajaxAsync()
All div elements with a p element
jQuery.ajax()
All p elements inside a div element
13. What is the correct jQuery code for making all div
elements 100 pixels high? The first p element inside a div element
20. Is jQuery a W3C standard?
$("div").yPos(100)
No
$("div").height="100"
Yes
$("div").height(100)
21. Look at the following selector: $("p#intro"). What
14. Which statement is true?
does it select?
To use jQuery, you must buy the jQuery library at
All p elements with class="intro"
www.jquery.com
The p element with id="intro"
To use jQuery, you can refer to a hosted jQuery
22. Which jQuery method is used to remove selected
library at Google
elements?
To use jQuery, you do not have to do anything.
Both methods can be used
Most browsers (Internet Explorer, Chrome, Firefox
and Opera) have the jQuery library built in the detach()
browser
remove()
15. What scripting language is jQuery written in?
23. Look at the following selector: $(":disabled").
JavaScript What does it select?
C# All disabled input elements

Thursday, August 20, 2020 Page |8


Ans:
All elements containing the text "disabled"
All elements that does not contain the text 8. What does the filter() method do in the
"disabled" following line?
$('div').filter('.nav')
All hidden elements A. It filters all the '.nav' elements on the page
24. Which jQuery method returns the direct parent and leaves only the divs.
element of the selected element? B. It sifts through all the divs and leaves only
parents() those which have the nav class.
9. How do you fetch the first span on the page,
parent() which has the class 'green'?
ancestor() A. $('span, .green, :first')
B. $('first .green span')
ancestors() C. $('span.green:first')
25. The jQuery animate() method can be used to 10. What is the difference between
animate ANY CSS property? $('#myDiv').bind('click',function(){
Only properties containing numeric values // do something
});
All properties except the shorthand properties and
$('#myDiv').click(function(){
Yes
// do something
});
1. Which sign does jQuery use as a shortcut for A. There is no difference. They do the same.
jQuery? B. bind() binds an event listening function to the
a. the % sign click event, whereas click() triggers it.
b. the $ sign C. Both bind a function to the click event. The
c. the ? Sign difference is that with bind() an event object is passed
2. With jQuery, look at the following selector: $ as a parameter.
("div"). What does it select?
a. The first div element Short Ques:
b. All div elements 1. Discuss html() and text() method.
3. Is jQuery a library for client scripting or server 2. What bind() and unbind() do?
scripting? 3. What’s the difference between load and get?
a. Server scripting
4. What are the services in AngularJS?
b. Client scripting
A) Services are singleton objects which are
4. What is the correct jQuery code to set the
instantiated only once in app and are used
background color of all p elements to red?
to do the defined task.
a. $("p").style("background-color","red");
B) Services are objects which AngularJS uses
b. $("p").manipulate("background-color","red");
internally.
c. $("p").layout("background-color","red");
C) Services are not used in AngularJS.
d. $("p").css("background-color","red");
D) Services are server side components of
5. With jQuery, look at the following selector: $
AngularJS.
("div.intro"). What does it select?
a. The first div element with class="intro"
5. What happens when page containing
b. All div elements with class="intro"
AngularJS based Application loads.
c. The first div element with id="intro"
A) HTML document is loaded into the
d. All div elements with id="intro"
browser, and evaluated by the browser.
6. Which jQuery method is used to hide selected
B) AngularJS JavaScript file is loaded; the
elements?
angular global object is created.
a. hide()
C) JavaScript which registers controller
b. display(none)
functions is executed.
c. hidden()
D) All of these
d. visible(false)
7. Select the fourth list item below, and use the
6. Which of the following is true about
css method to set its background color to 'gray'.
AngularJS?
Thursday, August 20, 2020 Page |9
A) AngularJS is a framework to build large
scale and high performance web appliation 11. Which of the following is not a core
while keeping them as easy-to-maintain. AngularJSdirective.
B) AngularJS provides developers options to A) ng-app
write client side application (using B) ng-model
JavaScript) in a clean MVC (Model View C) ng-bind
Controller) way. D) ng-state
C) AngularJS is a powerful JavaScript based 12. Which of the following is true about AngularJS
development framework to create RICH expressions?
Internet Application(RIA). A) Expressions are used to bind application
D) All of these data to html.
B) Expressions are written inside double
7. What is View in MVC? braces like {{ expression}}.
A) View represents a database view. C) Expressions behave in same way as ng-
B) View is responsible for displaying all or a bind directives.
portion of the data to the user. D) All of these
C) View is responsible to act and process 13. Which of the following is true about ng-
the data. controller directive?
D) None of these A) ng-controller directive tells AngularJS
8. On which of the following types of component what controller to use with this view.
can we create a custom directive? B) AngularJS application mainly relies on
A) Element directives controllers to control the flow of data in the
B) Attribute application.
C) CSS C) A controller is a JavaScript object
D) All of these containing attributes/properties and
Explanation:AngularJS provides support to create functions.
custom directives for following type of elements. D) All of these
Element directives - Directive activates when a 14. Which of the following is true about
matching element is encountered. Attribute - $routeProvider?
Directive activates when a matching attribute is A) $routeProvider is the key service which
encountered. CSS - Directive activates when a set the configuration of urls.
matching css style is encountered. NB - Directive B) $routeProvider maps Urls with the
activates when a matching comment is encountered. corresponding html page or ng-template.
9. Which of the following is true about AngularJS C) $routeProvider attaches a controller with
service? the view.
A) Services are JavaScript functions. D) All of these
B) Services are responsible to do specific 15. Which components can be injected as a
tasks only dependency in AngularJS?
C) Inbuilt services are always prefixed with A) value
$ symbol. B) factory
D) All of these C) service
Explanation: Services are JavaScript functions and are D) all of these
responsible to do specific tasks only. Each service is
responsible for a specific task for example, $http is 16. What is Model in MVC?
used to make ajax call to get the server data. $route is A) Model represents server side data.
used to define the routing information and so on. B) Model represents data stored in
Inbuilt services are always prefixed with $ symbol. database.
10. How angular.module works? C) Model is the lowest level of the pattern
A) angular.module is used to create responsible for maintaining data.
AngularJS modules along with its D) None of these.
dependent modules. 17. In AngularJS, Scope contains the model data.
B) angular.module is primarily used to A) True
create application module. B) False
C) Both of these 18. AngularJS Expressions are used to bind
D) None of these application data to html
Thursday, August 20, 2020 P a g e | 10
A) True D) None of these.
B) False 28. Which of the following is true about ng-app
19. AngularJS applications can run on all major directive?
browsers and smart phones including Android A) ng-app directive defines and links an
and iOS based phones/tablets. AngularJS application to HTML.
A) True B) ng-app directive indicates the start of the
B) False application.
20. In controllers, model data is not accessed via C) Both of these above.
$scope object. D) None of these.
A) True Explanation:ng-app directive defines and links an
B) False AngularJS application to HTML. It also indicate the
Explanation: In controllers, model data is accessed via start of the application.
$scope object. 29. The argument to the controller function is
21. ng-init directive can be used to put values to called _____
the variables to be used in the application. A) $scope
A) True B) scope
B) False C) $app
22. AngularJS uses dependency injection and D) $scopes
make use of separation of concerns. 30. Which directive clones HTML elements once
A) True for each item in a collection (in an array)?
B) False A) ng-loop
23. Scope act as glue between controller and B) ng-repeat
view. C) ng-array
A) True D) none of these
B) False 31. Which directive can bind HTML elements to
Explanation: Scopes are objects that refer to the HTML forms?
model. They act as glue between controller and view. A) ng-init
24. config phase is the phase during which B) ng-data
AngularJS bootstraps itself. C) ng-model
A) True D) ng-app
B) False 32. Which directive can provide CSS classes for
25. Which of the following is true about $invalid HTML elements?
flag? A) ng-init
A) $invalid flag states that value has been B) ng-app
changed. C) ng-class
B) $invalid flag states that form has invalid D) ng-model
data. 33. Which directive can also provide status for
C) Both of these above. application data (invalid, dirty, touched,
D) None of these. error)?
26. Which of the following is true about $dirty A) ng-model
flag? B) ng-app
A) $dirty flag states that value has been C) ng-bind
changed. D) ng-init
B) $dirty flag states that form has invalid 34. Which directive can also provide type
data. validation for application data (number,
C) Both of the these. email, required)?
D) None of the above. A) ng-app
Explanation: $dirty flag states that value in the form B) ng-bind
has been changed. C) ng-model
27. What is controller in MVC? D) ng-validate
A) It is a software Code that stores the data. 35. Which directive will auto-bootstrap
B) It is a software Code that renders the (automatically initialize) the application when
user interface. a web page is loaded?
C) It is a software Code that controls the A) ng-app
interactions between the Model and View. B) ng-init
Thursday, August 20, 2020 P a g e | 11
C) ng-css 42. Which directive binds application data to the
D) ng-module HTML view?
A) ng-model
36. Which is the correct syntax of creating B) ng-bind
AngularJS Controller? C) ng-controller
A) var app = angular.module('myApp', []); D) ng-app
angular.controller('myCtrl', function(app, E) All of these
$scope) { 43. Which directive binds the value of HTML
}); controls (input, select, textarea) to application
B) var app = angular.module('myApp', []); data?
app.controller('myCtrl', function($scope) { A) ng-bind
}); B) ng-model
C) var app = module('myApp', []); C) ng-expression
app.controller('myCtrl', function($scope) { D) ng-data
}); E) ng-controller
D) var app = angular.module('myApp', []); 44. Which directive defines an AngularJS
app.controller( function($scope) { application?
}); A) ng-controller
B) ng-model
37. Which is the correct syntax of creating C) ng-app
AngularJS application module? D) ng-bind
A) var app = angularJS.module('myApp',[]);
B) var app = angular.module('myApp', []);
C) var app = angular.module('myApp'); 45. Which of the following is not the valid
D) var app = angular.module([],'myApp',); AngularJS directive?
38. AngularJS expressions bind AngularJS data to A) ng-app
HTML the same way as the ______ directive. B) ng-bind
A) ng-model C) ng-model
B) {{expression}} D) data-app-ng
C) ng-bind E) data-ng-app
D) ng-model F) ng-controller
E) None of these G) ng-repeat
39. Which directive initializeAngularJS application H) ng-if
variables? 46. AngularJS binds data to HTML with ______.
A) ng-init A) Directive
B) ng-app B) Expressions
C) ng-inital C) Module
D) ng-model D) Filter
E) None of these 47. AngularJS extends HTML attributes with
_____
40. Which directive binds the innerHTML of the A) Filter
element to the application variable? B) Expression
A) ng-contorller C) Directive
B) ng-model D) Module
C) ng-view 48. AngularJS is perfect for ______
D) ng-bind A) AJAX
E) ng-app B) Multi Page Applications
41. Which directive binds the value of the input C) Single Page Applications (SPAs)
field to the application variable name? D) Windows Application
A) ng-app 49. Which of the following is component of
B) ng-controller AngularJS
C) ng-bind A) directives
D) ng-model B) expressions
E) ng-data C) filters
D) modules
Thursday, August 20, 2020 P a g e | 12
E) controllers 11:22 am, page no: 0        Powered by-Intellect
F) All of these Software Ltd. Preview
G) None of these A) AngularJS is a framework to build large scale and
high performance web appliation while keeping them
as easy-to-maintain.
50. Who is the creator of AngularJS? B) AngularJS provides developers options to write
A) Guido van Rossum client side application (using JavaScript) in a clean
B) RasmusLerdorf MVC (Model View Controller) way.
C) Brendan Eich C) AngularJS is a powerful JavaScript based
D) MiškoHevery development framework to create RICH Internet
51. AngularJS applications are built around a Application(RIA).
design pattern called ______ D) All of these
A) AJAX
B) MVC Explanation:
C) Object Oriented
D) Procedural 28247. What is View in MVC?
52. AngularJS is the library of -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
A) JavaScript (23)AngularJS Fundamentals, added on: 06-12-2015
B) PHP 11:19 am, page no: 0        Powered by-Intellect
C) Python Software Ltd. Preview
D) None of these A) View represents a database view.
28250. What are the services in AngularJS? B) View is responsible for displaying all or a portion of
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: the data to the user.
(1223)Service, added on: 06-12-2015 11:26 am, page C) View is responsible to act and process the data.
no: 0        Powered by-Intellect Software Ltd. Preview D) None of these
A) Services are singleton objects which are
instantiated only once in app and are used to do the Explanation:
defined task.
B) Services are objects which AngularJS uses 28246. On which of the following types of component
internally. can we create a custom directive?
C) Services are not used in AngularJS. -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
D) Services are server side components of AngularJS. (25)Directives, added on: 06-12-2015 11:17 am, page
no: 0        Powered by-Intellect Software Ltd. Preview
Explanation: A) Element directives
B) Attribute
28249. What happens when page containing C) CSS
AngularJS based Application loads. D) All of these
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(23)AngularJS Fundamentals, added on: 06-12-2015 Explanation:AngularJS provides support to create
11:24 am, page no: 0        Powered by-Intellect custom directives for following type of elements.
Software Ltd. Preview Element directives - Directive activates when a
A) HTML document is loaded into the browser, and matching element is encountered. Attribute -
evaluated by the browser. Directive activates when a matching attribute is
B) AngularJS JavaScript file is loaded; the angular encountered. CSS - Directive activates when a
global object is created. matching css style is encountered. NB - Directive
C) JavaScript which registers controller functions is activates when a matching comment is encountered.
executed.
D) All of these 28245. Which of the following is true about AngularJS
service?
Explanation: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(1223)Service, added on: 06-12-2015 11:14 am, page
28248. Which of the following is true about no: 0        Powered by-Intellect Software Ltd. Preview
AngularJS? A) Services are JavaScript functions.
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: B) Services are responsible to do specific tasks only
(23)AngularJS Fundamentals, added on: 06-12-2015 C) Inbuilt services are always prefixed with $ symbol.
Thursday, August 20, 2020 P a g e | 13
D) All of these -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(26)Controllers, added on: 06-12-2015 11:08 am, page
Explanation: Services are JavaScript functions and are no: 0        Powered by-Intellect Software Ltd. Preview
responsible to do specific tasks only. Each service is A) ng-controller directive tells AngularJS what
responsible for a specific task for example, $http is controller to use with this view.
used to make ajax call to get the server data. $route is B) AngularJS application mainly relies on controllers to
used to define the routing information and so on. control the flow of data in the application.
Inbuilt services are always prefixed with $ symbol. C) A controller is a JavaScript object containing
attributes/properties and functions.
28244. How angular.module works? D) All of these
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(1198)Modules, added on: 06-12-2015 11:13 am, Explanation:
page no: 0        Powered by-Intellect Software
Ltd. Preview 28240. Which of the following is true about
A) angular.module is used to create AngularJS $routeProvider?
modules along with its dependent modules. -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
B) angular.module is primarily used to create (1222)Provider, added on: 06-12-2015 11:07 am, page
application module. no: 0        Powered by-Intellect Software Ltd. Preview
C) Both of these A) $routeProvider is the key service which set the
D) None of these configuration of urls.
B) $routeProvider maps Urls with the corresponding
Explanation: html page or ng-template.
C) $routeProvider attaches a controller with the view.
28243. Which of the following is not a core D) All of these
AngularJSdirective.
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: Explanation:
(25)Directives, added on: 06-12-2015 11:11 am, page
no: 0        Powered by-Intellect Software Ltd. Preview 28239. Which components can be injected as a
A) ng-app dependency in AngularJS?
B) ng-model -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
C) ng-bind (1222)Provider, added on: 06-12-2015 11:04 am, page
D) ng-state no: 0        Powered by-Intellect Software Ltd. Preview
A) value
Explanation: B) factory
C) service
28242. Which of the following is true about AngularJS D) all of these
expressions?
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: Explanation:
(24)Expressions, added on: 06-12-2015 11:10 am,
page no: 0        Powered by-Intellect Software 28238. What is Model in MVC?
Ltd. Preview -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
A) Expressions are used to bind application data to (23)AngularJS Fundamentals, added on: 06-12-2015
html. 11:03 am, page no: 0        Powered by-Intellect
B) Expressions are written inside double braces like Software Ltd. Preview
{{ expression}}. A) Model represents server side data.
C) Expressions behave in same way as ng-bind B) Model represents data stored in database.
directives. C) Model is the lowest level of the pattern responsible
D) All of these for maintaining data.
D) None of the these.
Explanation:
Explanation:
28241. Which of the following is true about ng-
controller directive? 28237. In AngularJS, Scope contains the model data.
-     Book id: 219,   Type:TF,   editor id: 3,   Topic:
(1197)Object and DOM, added on: 06-12-2015 11:01
Thursday, August 20, 2020 P a g e | 14
am, page no: 0        Powered by-Intellect Software -     Book id: 219,   Type:TF,   editor id: 3,   Topic:
Ltd. Preview (1222)Provider, added on: 06-12-2015 10:57 am, page
A) True no: 0        Powered by-Intellect Software Ltd. Preview
B) False A) True
B) False
Explanation:
Explanation:
28236. AngularJS Expressions are used to bind
application data to html 28231. Scope act as glue between controller and view.
-     Book id: 219,   Type:TF,   editor id: 3,   Topic: -     Book id: 219,   Type:TF,   editor id: 3,   Topic:
(24)Expressions, added on: 06-12-2015 11:01 am, (1197)Object and DOM, added on: 06-12-2015 10:55
page no: 0        Powered by-Intellect Software am, page no: 0        Powered by-Intellect Software
Ltd. Preview Ltd. Preview
A) True A) True
B) False B) False

Explanation: Explanation: Scopes are objects that refer to the


63 Characters model. They act as glue between controller and view.
28235. AngularJS applications can run on all major
browsers and smart phones including Android and iOS 28230. config phase is the phase during which
based phones/tablets. AngularJS bootstraps itself.
-     Book id: 219,   Type:TF,   editor id: 3,   Topic: -     Book id: 219,   Type:TF,   editor id: 3,   Topic:
(23)AngularJS Fundamentals, added on: 06-12-2015 (1222)Provider, added on: 06-12-2015 10:53 am, page
11:00 am, page no: 0        Powered by-Intellect no: 0        Powered by-Intellect Software Ltd. Preview
Software Ltd. Preview A) True
A) True B) False
B) False
Explanation:
Explanation:
28225. Which of the following is true about $invalid
28234. In controllers, model data is not accessed via flag?
$scope object. -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
-     Book id: 219,   Type:TF,   editor id: 3,   Topic: (1223)Service, added on: 06-12-2015 10:37 am, page
(26)Controllers, added on: 06-12-2015 10:58 am, page no: 0        Powered by-Intellect Software Ltd. Preview
no: 0        Powered by-Intellect Software Ltd. Preview A) $invalid flag states that value has been changed.
A) True B) $invalid flag states that form has invalid data.
B) False C) Both of the these.
D) None of the these.
Explanation: In controllers, model data is accessed via
$scope object. Explanation:
108 Characters
28233. ng-init directive can be used to put values to 28224. Which of the following is true about $dirty
the variables to be used in the application. flag?
-     Book id: 219,   Type:TF,   editor id: 3,   Topic: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(25)Directives, added on: 06-12-2015 10:57 am, page (1223)Service, added on: 06-12-2015 10:34 am, page
no: 0        Powered by-Intellect Software Ltd. Preview no: 0        Powered by-Intellect Software Ltd. Preview
A) True A) $dirty flag states that value has been changed.
B) False B) $dirty flag states that form has invalid data.
C) Both of the these.
Explanation: D) None of the above.

28232. AngularJS uses dependency injection and Explanation: $dirty flag states that value in the form
make use of separation of concerns. has been changed.

28217. What is controller in MVC?


Thursday, August 20, 2020 P a g e | 15
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(26)Controllers, added on: 06-12-2015 10:27 am, page (25)Directives, added on: 22-09-2015 05:22 pm, page
no: 0        Powered by-Intellect Software Ltd. Preview no: 0        Powered by-Intellect Software Ltd. Preview
A) It is a software Code that stores the data. A) ng-init
B) It is a software Code that renders the user B) ng-data
interface. C) ng-model
C) It is a software Code that controls the interactions D) ng-app
between the Model and View.
D) None of the these. Explanation:

Explanation: 17193. Which directive can provide CSS classes for


HTML elements?
28215. Which of the following is true about ng-app -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
directive? (25)Directives, added on: 22-09-2015 05:20 pm, page
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: no: 0        Powered by-Intellect Software Ltd. Preview
(25)Directives, added on: 06-12-2015 10:26 am, page A) ng-init
no: 0        Powered by-Intellect Software Ltd. Preview B) ng-app
A) ng-app directive defines and links an AngularJS C) ng-class
application to HTML. D) ng-model
B) ng-app directive indicates the start of the
application. Explanation:
C) Both of the these.
D) None of the these. 17192. Which directive can also provide status for
application data (invalid, dirty, touched, error)?
Explanation:ng-app directive defines and links an -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
AngularJS application to HTML. It also indicate the (25)Directives, added on: 22-09-2015 05:18 pm, page
start of the application. no: 0        Powered by-Intellect Software Ltd. Preview
A) ng-model
18981. The argument to the controller function is B) ng-app
called _____ C) ng-bind
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: D) ng-init
(26)Controllers, added on: 10-10-2015 06:44 pm, page
no: 23        Powered by-Intellect Software Ltd. Preview Explanation:
A) $scope
B) scope 17191. Which directive can also provide type
C) $app validation for application data (number, email,
D) $scopes required)?
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
Explanation: (25)Directives, added on: 22-09-2015 05:16 pm, page
no: 0        Powered by-Intellect Software Ltd. Preview
17195. Which directive clones HTML elements once A) ng-app
for each item in a collection (in an array)? B) ng-bind
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: C) ng-model
(25)Directives, added on: 22-09-2015 05:23 pm, page D) ng-validate
no: 0        Powered by-Intellect Software Ltd. Preview
A) ng-loop Explanation:
B) ng-repeat
C) ng-array 17190. Which directive will auto-bootstrap
D) none of these (automatically initialize) the application when a web
page is loaded?
Explanation: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(25)Directives, added on: 22-09-2015 05:13 pm, page
17194. Which directive can bind HTML elements to no: 0        Powered by-Intellect Software Ltd. Preview
HTML forms? A) ng-app
B) ng-init
Thursday, August 20, 2020 P a g e | 16
C) ng-css 17186. Which directive initializeAngularJS application
D) ng-module variables?
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
Explanation: (25)Directives, added on: 22-09-2015 04:46 pm, page
no: 0        Powered by-Intellect Software Ltd. Preview
17189. Which is the correct syntax of creating A) ng-init
AngularJS Controller? B) ng-app
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: C) ng-inital
(26)Controllers, added on: 22-09-2015 05:04 pm, page D) ng-model
no: 0        Powered by-Intellect Software Ltd. Preview E) None of these
A) var app = angular.module('myApp', []);
angular.controller('myCtrl', function(app,$scope) { Explanation:

});
B) var app = angular.module('myApp', []); 17185. Which directive binds the innerHTML of the
app.controller('myCtrl', function($scope) { element to the application variable?
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
}); (25)Directives, added on: 22-09-2015 04:45 pm, page
C) var app = module('myApp', []); no: 0        Powered by-Intellect Software Ltd. Preview
app.controller('myCtrl', function($scope) { A) ng-contorller
B) ng-model
}); C) ng-view
D) var app = angular.module('myApp', []); D) ng-bind
app.controller( function($scope) { E) ng-app

}); Explanation:

Explanation: 17184. Which directive binds the value of the input


349 Characters field to the application variable name?
17188. Which is the correct syntax of creating -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
AngularJS application module? (25)Directives, added on: 22-09-2015 04:43 pm, page
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: no: 0        Powered by-Intellect Software Ltd. Preview
(1198)Modules, added on: 22-09-2015 05:02 pm, A) ng-app
page no: 0        Powered by-Intellect Software B) ng-controller
Ltd. Preview C) ng-bind
A) var app = angularJS.module('myApp',[]); D) ng-model
B) var app = angular.module('myApp', []); E) ng-data
C) var app = angular.module('myApp');
D) var app = angular.module([],'myApp',); Explanation:

Explanation: 17183. Which directive binds application data to the


HTML view?
17187. AngularJS expressions bind AngularJS data to -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
HTML the same way as the ______ directive. (25)Directives, added on: 22-09-2015 04:41 pm, page
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: no: 0        Powered by-Intellect Software Ltd. Preview
(25)Directives, added on: 22-09-2015 04:52 pm, page A) ng-model
no: 0        Powered by-Intellect Software Ltd. Preview B) ng-bind
A) ng-model C) ng-controller
B) {{expression}} D) ng-app
C) ng-bind E) All of these
D) ng-model
E) None of these Explanation:

Explanation: 17182. Which directive binds the value of HTML


controls (input, select, textarea) to application data?
Thursday, August 20, 2020 P a g e | 17
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: A) Filter
(25)Directives, added on: 22-09-2015 04:40 pm, page B) Expression
no: 0        Powered by-Intellect Software Ltd. Preview C) Directive
A) ng-bind D) Module
B) ng-model
C) ng-expression Explanation:
D) ng-data
E) ng-controller 17177. AngularJS is perfect for ______
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
Explanation: (23)AngularJS Fundamentals, added on: 22-09-2015
04:22 pm, page no: 0        Powered by-Intellect
17181. Which directive defines an AngularJS Software Ltd. Preview
application? A) AJAX
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: B) Multi Page Applications
(25)Directives, added on: 22-09-2015 04:38 pm, page C) Single Page Applications (SPAs)
no: 0        Powered by-Intellect Software Ltd. Preview D) Windows Application
A) ng-controller
B) ng-model Explanation:
C) ng-app
D) ng-bind 17176. Which of the following is component of
AngularJS
Explanation: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(23)AngularJS Fundamentals, added on: 22-09-2015
17180. Which of the following is not the valid 04:19 pm, page no: 0        Powered by-Intellect
AngularJS directive? Software Ltd. Preview
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: A) directives
(25)Directives, added on: 22-09-2015 04:34 pm, page B) expressions
no: 0        Powered by-Intellect Software Ltd. Preview C) filters
A) ng-app D) modules
B) ng-bind E) controllers
C) ng-model F) All of these
D) data-app-ng G) None of these
E) data-ng-app
F) ng-controller Explanation:
G) ng-repeat
H) ng-if 17175. Who is the creator of AngularJS?
-     Book id: 219,   Type:SA,   editor id: 3,   Topic:
Explanation: (23)AngularJS Fundamentals, added on: 22-09-2015
04:16 pm, page no: 0        Powered by-Intellect
17179. AngularJS binds data to HTML with ______. Software Ltd. Preview
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: A) Guido van Rossum
(24)Expressions, added on: 22-09-2015 04:27 pm, B) RasmusLerdorf
page no: 0        Powered by-Intellect Software C) Brendan Eich
Ltd. Preview D) MiškoHevery
A) Directive
B) Expressions Explanation:
C) Module
D) Filter 17174. AngularJS applications are built around a
design pattern called ______
Explanation: -     Book id: 219,   Type:SA,   editor id: 3,   Topic:
(23)AngularJS Fundamentals, added on: 22-09-2015
17178. AngularJS extends HTML attributes with _____ 04:13 pm, page no: 0        Powered by-Intellect
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: Software Ltd. Preview
(25)Directives, added on: 22-09-2015 04:26 pm, page A) AJAX
no: 0        Powered by-Intellect Software Ltd. Preview B) MVC
Thursday, August 20, 2020 P a g e | 18
C) Object Oriented We tell jQuery that the animation has to be stopped
D) Procedural at some point.

Explanation: How can you tell if an element is currently being


animated?
17173. AngularJS is the library of if($('#myDiv').is(':animated')){
-     Book id: 219,   Type:SA,   editor id: 3,   Topic: // do stuff
(23)AngularJS Fundamentals, added on: 22-09-2015 }
04:06 pm, page no: 0        Powered by-Intellect if($('#myDiv').isAnimated()){
Software Ltd. Preview // do stuff
A) JavaScript }
B) PHP
C) Python What does the filter() method do in the following
D) None of these line?

Explanation: $('div').filter('.nav')
What does the function $('.selector') return?
It filters all the '.nav' elements on the page and
An array. leaves only the divs.
A node list. It sifts through all the divs and leaves only those
A new jQuery object. which have the nav class.
How do you fetch the first span on the page, which
has the class 'green'?
Why do we usually add our jQuery code to the
document.ready event? $('span, .green, :first')
$('first .green span')
$(document).ready(function(){ $('span.green:first')
// do something
}); A:c
What does the $('#myDiv').hover() method do?
The document.ready event is fired when the DOM is
initialized, and we can access all the elements on the It binds the functions you pass as parameters, to
page with jQuery selectors. We use it because this is the mouseenter and mouseleave events.
the earliest time in the loading of the page that we Converts the element upon which it was called, into
can execute jQuery code safely. a hoverable menu.

This is the only way we can delay the execution of What actually happens when we write something like
jQuery code until the page has fully loaded. this:

A:b $
('#myDiv').find('span').addClass('color','red').width(20
What do we use jQuery.noConflict() for? 0);

To prevent other libraries from stealing the $ (dollar The dollar function creates a new jQuery object.
function). Every method from then on returns that same object
To restore the '$' to its previous, non-jQuery owner. modifying it if necessary. This is called chaining.
This way we can have more than one JavaScript Black magic.
library on the page.
Why do we usually add the stop() method before If you want to make the #myDiv element 200px wide
calling animate()? and 100px tall, can you do this:

stop() halts the execution of the scripts on the page $('#myDiv').width(200).height(100);


until the animation has finished.
stop() ends any currently running animations on the No you can't. The width and height methods return
element, and prevents conflicts and pile-ups. numbers, thus chaining would not work.
Thursday, August 20, 2020 P a g e | 19
Yes you can. When acting as setters, width and Both bind a function to the click event. The
height return the jQuery object. difference is that with bind() an event object is passed
as a parameter.
What does the end() method do in this chain? A:a
Can we do this:
$
('#myDiv').find('span').hide().end().addClass('.spansHi $('#myDiv').bind('myEvent',function(){
dden'); // do something
});
It restores the jQuery object to the state it was No, bind only works with events such as 'click',
before being modified by find('span'). This way 'mousedown', 'mouseover' etc.
.addClass('.spansHidden') is applied directly to Yes, we can bind custom events.
#myDiv.
It ends all the currently running animations and A:b
then adds the .spansHidden class to all the spans. Which of the snippets below can listen for events on
elements that are yet to be created?
A:a
Which of the snippets below creates a new div and $('div.green').bind('click',function(){
appends it to the first span on the page? // do stuff
});
$('span').createElement('div','This is a new div!'); $('div.green').click(function(){
$('<div>',{ // do stuff
html:"This is a new <b>div</b>" });
}).appendTo('span:first'); $('div.green').live('click',function(){
$('span').html('<div>This is a new div!</div>') // do stuff
});
A:b
Why doesn't this work: A:c

$('p').click(function(){ What does this do:


this.html('clicked!');
}); $('#myDiv').trigger('click');

All event listening functions are passed the It simulates a click on the element and runs all the
element, and not the jQuery object. For this to work, event handlers associated with it.
the second line has to become $(this).html('clicked!'); It sets up a trigger. When a click occurs, the trigger
The event listening function is supposed to take is going to be activated.
parameters. A:a

A:a
Which of the below is equivalent to
What is the difference between
if($('#myDiv').hasClass('purple')){
$('#myDiv').bind('click',function(){ // do stuff
// do something }
});
and if($('#myDiv').find('.purple')){
$('#myDiv').click(function(){ // do stuff
// do something }
}); if($('#myDiv').is('.purple')){
There is no difference. They do the same. // do stuff
bind() binds an event listening function to the click }
event, whereas click() triggers it. A:b
Why do we add a return false here?

Thursday, August 20, 2020 P a g e | 20


$('form.contact').submit(function(e){ c)A new jQuery object.
// submit the form via AJAX
return false; 2. Why do we usually add our jQuery code to the
}); document.ready event?

Every function in JavaScript must return a value, so $(document).ready(function(){


we are placing a dummy return line. // do something
return false prevents the web browser from });
submitting the form and reloading the page.
This will not work. a)The document.ready event is fired when the DOM is
A:b initialized, and we can access all the elements on the
page with jQuery selectors. We use it because this is
What does the serialize() method do in the following the earliest time in the loading of the page that we
line? can execute jQuery code safely.

$('#myForm').serialize(); b)This is the only way we can delay the execution of


jQuery code until the page has fully loaded.
It fetches the names and values of all the input
fields contained in the form, and generates a URL 3. How do you fetch the first span on the page, which
encoded string representation, ready to be submitted has the class 'green'?
via AJAX or appended to a URL.
Fetches the names and values of all input fields, and a)$('span, .green, :first')
returns them as an object. b)$('first .green span')
Creates a JSON representation of the form. c)$('span.green:first')
A:a
What does the $.get() jQuery function do? 4. What does the end() method do in this chain?

It fires a GET AJAX request. $


It returns the DOM elements that are contained in ('#myDiv').find('span').hide().end().addClass('.spansHi
the jQuery object. dden');
A:a
a)It restores the jQuery object to the state it was
What does $('#myDiv').load('page.html') do? before being modified by find('span'). This way
.addClass('.spansHidden') is applied directly to
It adds the string 'page.html' as the contents of the #myDiv.
#myDiv div. b)It ends all the currently running animations and
It fires an AJAX request, fetches the result of then adds the .spansHidden class to all the spans.
page.html as text, and inserts it into the div.
A:b 5. Which of the snippets below creates a new div and
appends it to the first span on the page?
What is the difference between $
('#element').remove() and $('#element').detach() a) $('span').createElement('div','This is a new div!');

remove() removes the element from the DOM b) $('<div>',{


along with any jQuery data such as event handlers, html:"This is a new <b>div</b>"
while detach() only removes the element from the }).appendTo('span:first');
DOM.
detach() removes the element along with all the c) $('span').html('<div>This is a new div!</div>')
jQuery data, whereas remove() only removes it from
the DOM. 6. Why doesn't this work:
A:a
1. What does the function $('.selector') return? $('p').click(function(){
this.html('clicked!');
a)An array. });
b)A node list.
Thursday, August 20, 2020 P a g e | 21
a)All event listening functions are passed the b)It sets up a trigger. When a click occurs, the
element, and not the jQuery object. For this to work, trigger is going to be activated.
the second line has to become $(this).html('clicked!');
b)The event listening function is supposed to take 11. Which of the below is equivalent to
parameters.
7. What is the difference between a) if($('#myDiv').hasClass('purple')){
// do stuff
$('#myDiv').bind('click',function(){ }
// do something
}); b) if($('#myDiv').find('.purple')){
// do stuff
and }
c) if($('#myDiv').is('.purple')){
$('#myDiv').click(function(){ // do stuff
// do something }
});
12. Why do we add a return false here?
a)There is no difference. They do the same.
b)bind() binds an event listening function to the $('form.contact').submit(function(e){
click event, whereas click() triggers it. // submit the form via AJAX
c)Both bind a function to the click event. The return false;
difference is that with bind() an event object is passed });
as a parameter.
a)Every function in JavaScript must return a value,
8. Can we do this: so we are placing a dummy return line.
b)return false prevents the web browser from
$('#myDiv').bind('myEvent',function(){ submitting the form and reloading the page.
// do something c)This will not work.
});
13. What does the serialize() method do in the
a)No, bind only works with events such as 'click', following line?
'mousedown', 'mouseover' etc.
b)Yes, we can bind custom events. $('#myForm').serialize();

9. Which of the snippets below can listen for events a)It fetches the names and values of all the input
on elements that are yet to be created? fields contained in the form, and generates a URL
encoded string representation, ready to be submitted
a) $('div.green').bind('click',function(){ via AJAX or appended to a URL.
// do stuff b)Fetches the names and values of all input fields,
}); and returns them as an object.
c)Creates a JSON representation of the form.
b) $('div.green').click(function(){
// do stuff 14. What does the $.get() jQuery function do?
});
a)It fires a GET AJAX request.
c) $('div.green').live('click',function(){ b)It returns the DOM elements that are contained
// do stuff in the jQuery object.
});
15. What does $('#myDiv').load('page.html') do?
10. What does this do:
a)It adds the string 'page.html' as the contents of
$('#myDiv').trigger('click'); the #myDiv div.
b)It fires an AJAX request, fetches the result of
a)It simulates a click on the element and runs all the page.html as text, and inserts it into the div.
event handlers associated with it.
Thursday, August 20, 2020 P a g e | 22
16. What is the difference between $ // do stuff
('#element').remove() and $('#element').detach() }

a)remove() removes the element from the DOM if($('#myDiv').isAnimated()){


along with any jQuery data such as event handlers, // do stuff
while detach() only removes the element from the }
DOM.
b)detach() removes the element along with all the
jQuery data, whereas remove() only removes it from What does the filter() method do in the following
the DOM. line?
What does the function $('.selector') return?
An array. $('div').filter('.nav')
A node list.
A new jQuery object. It filters all the '.nav' elements on the page and
leaves only the divs.
A: a,b It sifts through all the divs and leaves only those
which have the nav class.
Why do we usually add our jQuery code to the
document.ready event?

$(document).ready(function(){ How do you fetch the first span on the page, which
// do something has the class 'green'?
});
$('span, .green, :first')
The document.ready event is fired when the DOM is $('first .green span')
initialized, and we can access all the elements on the $('span.green:first')
page with jQuery selectors. We use it because this is
the earliest time in the loading of the page that we A:c
can execute jQuery code safely.
What does the $('#myDiv').hover() method do?
This is the only way we can delay the execution of
jQuery code until the page has fully loaded. It binds the functions you pass as parameters, to
the mouseenter and mouseleave events.
A:b Converts the element upon which it was called, into
What do we use jQuery.noConflict() for? a hoverable menu.

To prevent other libraries from stealing the $ (dollar What actually happens when we write something like
function). this:
To restore the '$' to its previous, non-jQuery owner.
This way we can have more than one JavaScript $
library on the page. ('#myDiv').find('span').addClass('color','red').width(20
0);
Why do we usually add the stop() method before
calling animate()? The dollar function creates a new jQuery object.
Every method from then on returns that same object
stop() halts the execution of the scripts on the page modifying it if necessary. This is called chaining.
until the animation has finished. Black magic.
stop() ends any currently running animations on the
element, and prevents conflicts and pile-ups. If you want to make the #myDiv element 200px wide
We tell jQuery that the animation has to be stopped and 100px tall, can you do this:
at some point.
How can you tell if an element is currently being $('#myDiv').width(200).height(100);
animated?
No you can't. The width and height methods return
if($('#myDiv').is(':animated')){ numbers, thus chaining would not work.
Thursday, August 20, 2020 P a g e | 23
Yes you can. When acting as setters, width and
height return the jQuery object. There is no difference. They do the same.
bind() binds an event listening function to the click
What does the end() method do in this chain? event, whereas click() triggers it.
Both bind a function to the click event. The
$ difference is that with bind() an event object is passed
('#myDiv').find('span').hide().end().addClass('.spansHi as a parameter.
dden');
A:a
It restores the jQuery object to the state it was
before being modified by find('span'). This way
.addClass('.spansHidden') is applied directly to Can we do this:
#myDiv.
It ends all the currently running animations and $('#myDiv').bind('myEvent',function(){
then adds the .spansHidden class to all the spans. // do something
});
A:a
No, bind only works with events such as 'click',
Which of the snippets below creates a new div and 'mousedown', 'mouseover' etc.
appends it to the first span on the page? Yes, we can bind custom events.

$('span').createElement('div','This is a new div!'); A:b


$('<div>',{
html:"This is a new <b>div</b>"
}).appendTo('span:first');
$('span').html('<div>This is a new div!</div>')
Which of the snippets below can listen for events on
A:b elements that are yet to be created?

Why doesn't this work: $('div.green').bind('click',function(){


// do stuff
$('p').click(function(){ });
this.html('clicked!'); $('div.green').click(function(){
}); // do stuff
});
All event listening functions are passed the $('div.green').live('click',function(){
element, and not the jQuery object. For this to work, // do stuff
the second line has to become $(this).html('clicked!'); });
The event listening function is supposed to take
parameters. A:c

A:a
What does this do:
What is the difference between
$('#myDiv').trigger('click');
$('#myDiv').bind('click',function(){
// do something It simulates a click on the element and runs all the
}); event handlers associated with it.
It sets up a trigger. When a click occurs, the trigger
is going to be activated.
and A:a

$('#myDiv').click(function(){
// do something Which of the below is equivalent to
});
Thursday, August 20, 2020 P a g e | 24
if($('#myDiv').hasClass('purple')){ What is the difference between $
// do stuff ('#element').remove() and $('#element').detach()
}
remove() removes the element from the DOM
if($('#myDiv').find('.purple')){ along with any jQuery data such as event handlers,
// do stuff while detach() only removes the element from the
} DOM.
if($('#myDiv').is('.purple')){ detach() removes the element along with all the
// do stuff jQuery data, whereas remove() only removes it from
} the DOM.
A:b A:a
1. Which of the following are the features of jQuery?
Why do we add a return false here? a. Efficient query method for finding the set of
document elements
$('form.contact').submit(function(e){ b. Expressive syntax for referring to elements in the
// submit the form via AJAX document
return false; c. Useful set of methods for manipulating selected
}); elements
d. All of the mentioned
Every function in JavaScript must return a value, so Answer : d
we are placing a dummy return line. Explanation : These features are at the heart of
return false prevents the web browser from jQuery’s power and utility:
submitting the form and reloading the page. An expressive syntax (CSS selectors) for referring to
This will not work. elements in the document
A:b An efficient query method for finding the set of
document elements that match a CSS selector
What does the serialize() method do in the following A useful set of methods for manipulating selected
line? elements
Powerful functional programming techniques for
$('#myForm').serialize(); operating on sets of elements as
a group, rather than one at a time
It fetches the names and values of all the input A succinct idiom (method chaining) for expressing
fields contained in the form, and generates a URL sequences of operations.
encoded string representation, ready to be submitted
via AJAX or appended to a URL. 2. Which of the following is a single global function
Fetches the names and values of all input fields, and defined in the jQuery library?
returns them as an object. a. jQuery()
Creates a JSON representation of the form. b. $()
A:a c. Queryanalysis()
d. None of the mentioned
What does the $.get() jQuery function do? Answer : a
Explanation : The jQuery library defines a single global
It fires a GET AJAX request. function named jQuery(). This function is so
It returns the DOM elements that are contained in frequently used that the library also defines the global
the jQuery object. symbol $ as a shortcut for it.
A:a
3. Which of the following is a factory function?
What does $('#myDiv').load('page.html') do? a. $()
b. jQuery()
It adds the string 'page.html' as the contents of the c. Queryanalysis()
#myDiv div. d. None of the mentioned
It fires an AJAX request, fetches the result of Answer : b
page.html as text, and inserts it into the div. Explanation : jQuery() is a factory function rather than
A:b a constructor: it returns a newly created object but is
not used with the new keyword. jQuery objects define
Thursday, August 20, 2020 P a g e | 25
many methods for operating on the sets of elements b. $(f)
they represent, and most of this chapter is devoted to c. #(f)
explaining those methods. d. None of the mentioned
4. Which is the code that asks for the set of all div Answer : b
elements in a document? Explanation : The equivalent replacement of $
(document).ready(f) is $(f).
a. var divs = $(div);
b. var divs = jQuery("div"); 9. Which of the following is a utility function in
c. var divs = $("div"); jQuery?
d. var divs = #("div"); a. jQuery.each()
Answer : c b. jQuery.parseJSON()
Explanation : The code to ask for the set of all div c. jQuery.noConflict()
elements in a document is d. None of the mentioned
var divs = $("div"); Answer : c
Explanation : jQuery.noConflict() is the utility function
5. Which is the method that operates on the return in jQuery.
value of $()?
a. show() 10. Which of the following is used for parsing JSON
b. css() text?
c. click() a. jQuery.each()
d. done() b. jQuery.parseJSON()
Answer : b c. jQuery.noConflict()
Explanation : The css() method operates on the jQuery d. None of the mentioned
object returned by $(), and returns that same object, Answer : b
so that the show() method can be invoked next in a Explanation : jQuery.parseJSON() is used for parsing
compact “method chain.” JSON text.

6. Consider the following code snippet 1).jQuery is a 


<script src="jquery-1.4.2.min.js"></script> a). JavaScript Library. b).JavaScript Language
What does the min mean? c).JavaScript Method d). PHP Method
a. Minimised version
b. Miniature 2).jQuery is
c. Minimised parameters a).Light weight b).Interpreter compiled c).parallelly
d. Minimum value processed d).Runs in js shell
Answer : a
Explanation : The min means the minimised version of 3).jQuery does not support which of the following
the library, with unnecessary comments and a).HTML/DOM Manipulation b).HTML events c).AJAX
whitespace removed, and internal identifiers replaced d).PHP Bytecode
with shorter ones.
4).Minified and compressed version of jQuery is
7. Which of the following is a heavily overloaded usually used as
function? a).Development version b).Production version c).Beta
a. jQuery() Version d).Alpha version
b. $()
c. script() 5).$(selector).action() – What does this jquery syntax
d. Both a and b format do?
Answer : d a).Select an HTML element and then use HTML to act
Explanation : The jQuery() function (a.k.a. $()) is the on it
most important one in the jQuery library. It is heavily b).Select an HTML element and perform some actin
overloaded, however, and there are four different on it
ways you can invoke it. c).Perform an action on an element and then select it
d).Perform selection and ignore the action
8. Which of the following is an equivalent
replacement of $(document).ready(f)?
a. jQuery(f)
Thursday, August 20, 2020 P a g e | 26
6).What does the dollar sign in jQuery statement do?
3. What will happen by $("#wblogo").html()
a).It loads the jQuery methods b).It loads the DOM
c).It loads PHP d).It is used to define or access jQuery
   It will return html from wblogo id element
7).Here is a jquery code:
$(document).ready(function(){});
   It will set blank html to wblogo id element
Why do we place all jQuery methods inside this code?
a).Because jQuery is never compiled b).It shows
where jQuery starts and ends     It will return html from wblogo class element
c).To enable the DOM to load jQuery d).To prevent
jQuery code from running before the document is
   It will set blank html to wblogo class element
fully loaded
4. $(".block").animate({left: "-=50px"}, "slow"); 
8).$(function(){});
This a valid script.
What does this piece of jQuery do?
a).This is a shorter version for $
(document).ready(function(){});    True
b).This is to test if jQuery can be loaded again
c).This is to test if jQuery has completed execution
   False
d).This is to create a method in jQuery

9).$(‘#temp’).action() 5. $("#p1").css("color","red").slideUp(2000).slideDown(2000);
What type of selector is used in the above jQuery This is a valid script.
syntax?
a).id selector
b).class selector    True
c).name selector
d).value selector    False

10).Which of the following jQuery syntax uses the 6. With jQuery, look at the following selector: $("div.intro"). W
class selector
a).$(‘#temp’) b).$(‘.temp’) c).$(‘class’) d).$
(‘temp’).class    The first div element with class="intro"

  
1. Look at the following jQuery selector: $("div#intro .head"). What All div
does elements with class="intro"
it select?

   All elements with class="head" inside the first div element   withThe first div element with id="intro"
id="intro"

      class="intro"
The first element with id="head" inside any div element with All div elements with id="intro"

   All div elements with id="intro" or class="head" 7. Which jquery .js version file should be deployed to producti

   First element with id=“intro” or class=“head”    jquery-1.x.x.js

2. jQuery is free and open source.


   jquery-1.x.x.min.js

   True
   validation.js

   False
   required.js

Thursday, August 20, 2020 P a g e | 27


8. How can you get href value from <a href=\"http://www.xchanging.com\" id=\"logo\"/>
   Selected element will be animate with toggle

   $("#logo").attr("#href")
   Selected element will be sliding up and down

   $("logo").("href")
   Selected element will be hide and show

   $("#logo").attr("href")
13. In which year jQuery developed?
   $("#logo").href
   2001

9. Who developed jQuery?


   2004

   John Richard
   2005

   Mark Bensman
   2006

   John Resig 14. What script need to write for toggling fade?

   Joffman Denieu    fadeIn()

10. What is the correct jQuery code to set the background color of all p elements to red?
   fadeOut()

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

   $("p").style("background-color","red");
   fadeToggle()
1) Which of the following statements about the features of jQ
   $("p").layout("background-color","red");
i) jQuery has an expressive syntax for referring to elements in
   $("p").css("background-color","red");
ii) jQuery has an efficient query method for finding the set of d

iii) jQuery
11. Which jQuery method is used to switch between adding/removing onehas
oramore
usefulclasses
set of (for
methods for manipulating
CSS) from selecte
selected elements?
A. i, ii and iii only
   switchClass() B. i, ii and iv only
C. i, iii and iv only
   addRemoveClass() D. All i, ii, iii and iv

2) If you are using $ in your own code, or are using another lib
   altClass() restore $ to its original value.
A. jQuery.noConflict()
   toggleClass() B. jQuery.removeConflict()
C. jQuery.restoreDefault()
12. What does it mean by toggle()? D. jQuery.restoreFunction()

3) Which of the following is/are the sources of Content Distrib


   Selected element will be fadeIn and FadeOut A. jQuery CDN

Thursday, August 20, 2020 P a g e | 28


B. Microsoft CDN B. index()
C. Google CDN C. each()
D. All of the above D. map() 

4) Which of the following are the different ways of invoking jQuery()11) ........
function.
handles browser incompatibilities and special cases a
i) invoke $() is to pass a CSS selector to it JavaScript property equivalents.
ii) invoke $() is to pass an element or document or window object A. attr()
iii) invoke $() is to pass a string of JavaScript code B. removeattr()
iv) invoke $() is to pass a function to it C. handleattr()
A. i, ii and iii only D. useattr()
B. i, ii and iv only
C. i, iii and iv only 12) Match the following methods for working with the class a
D. All i, ii, iii and iv i) addClass()           a) tests for the presence of specified class
ii) toggleClass()      b) adds classes to elements that don't alrea
5) The jQuery library defines a number of utility functions, one iii)of them
hasClass()       
is ............  c)
function
removefor
classes
general
from
purpose
selected
iteration
elements
and
another is ............ function for parsing JSON text.
A. jQuery.each(), jQuery.JSONtext() iv) removeClass()   d) adds classes from selected elements
B. jQuery.iterate(), jQuery.parseJSON() A. i-b, ii-c, iii-d, iv-a
C. jQuery.each(), jQuery.parseJSON() B. i-c, ii-d, iii-a, iv-b
D. jQuery.general(), jQuery.parseJSON() C. i-d, ii-c, iii-b, iv-a
D. i-d, ii-b, iii-a, iv-c
6) The value returned by $() are ......... ,they are array like, they have a length property and have numeric properties from o
to length -1. 13) ........ is a method for setting and querying the value attribu
A. jQuery result the selection state of check boxes, radio buttons and <select>
B. jQuery objects A. set()
C. jQuery array B. val()
D. jQuery length C. query()
D. attr()
7) In order to loop over all elements in a jQuery object, you can call the .......... method instead of writing a for loop.
A. array.map()
B. index()
C. each()
D. map() 14) In jQuery, .......... method measures positions relative to th
and top properties that hold the X and Y coordinates.
8) ......... method expects a callback function as A. offset()
its sole argument, and it invokes that callback B. position()
function once for each element in the C. offsetparent()
jQuery object in document order. D. setparent()
A. array.map()
B. index() 15) The .......... method is like offset(), except that it is a getter
C. each() parent, rather to the document as a whole.
D. map() A. width()
B. position()
9) ........... accepts a callback function as its argument C. offsetparent()
and invokes that function once for each element D. setparent()
of the jQuery object.
A. is() Answers
B. index() 1) D. All i, ii, iii and iv
C. each() 2) A. jQuery.noConflict()
D. map() 3) D. All of the above
4) B. i, ii and iv only
10) ........ takes a selector as its argument and returns true if at 5)
least
C. jQuery.each(),
one of the selected jQuery.parseJSON()
elements also matches the specified
selector. 6) B. jQuery objects
A. is() 7) C. each()

Thursday, August 20, 2020 P a g e | 29


8) C. each()
9) D. map()
10) A. is()
11) A. attr()
12) D. i-d, ii-b, iii-a, iv-c
13) B. val()
14) A. offset()
15) B. position()

Thursday, August 20, 2020 P a g e | 30

Вам также может понравиться